Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

2.3 KB
Raw Blame
//-----------------------------------------------------------------------
// <copyright file="ValidateLoginRequest.cs" company="aliasvault">
// Copyright (c) aliasvault. All rights reserved.
// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
// </copyright>
//-----------------------------------------------------------------------

namespace AliasVault.Shared.Models.WebApi.V2.Auth;

/// <summary>
/// Request that finishes an SRP handshake with the client's proof.
/// </summary>
public class ValidateLoginRequest
{
    /// <summary>
    /// Initializes a new instance of the <see cref="ValidateLoginRequest"/> class.
    /// </summary>
    /// <param name="username">Username.</param>
    /// <param name="rememberMe">Indicates if the user wants to be remembered which extends the refresh token lifetime.</param>
    /// <param name="clientPublicEphemeral">Client public ephemeral.</param>
    /// <param name="clientSessionProof">Client session proof.</param>
    public ValidateLoginRequest(string username, bool rememberMe, string clientPublicEphemeral, string clientSessionProof)
    {
        Username = username.ToLowerInvariant().Trim();
        RememberMe = rememberMe;
        ClientPublicEphemeral = clientPublicEphemeral;
        ClientSessionProof = clientSessionProof;
    }

    /// <summary>
    /// Gets the username.
    /// </summary>
    public string Username { get; }

    /// <summary>
    /// Gets a value indicating whether the user wants to be remembered which extends the refresh token lifetime.
    /// </summary>
    public bool RememberMe { get; }

    /// <summary>
    /// Gets the client's public ephemeral value.
    /// </summary>
    public string ClientPublicEphemeral { get; }

    /// <summary>
    /// Gets the client's session proof.
    /// </summary>
    public string ClientSessionProof { get; }

    /// <summary>
    /// Gets or sets the login session id from the initiate response.
    /// </summary>
    public required string LoginSessionId { get; set; }

    /// <summary>
    /// Gets or sets the upgrade of a legacy verifier, which the server stores once the login completes.
    /// TODO: remove once no legacy verifiers are left.
    /// </summary>
    public LegacySrpVerifierUpgrade? LegacyVerifierUpgrade { get; set; }
}