Skip to content

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

2.9 KB
Raw Blame
//-----------------------------------------------------------------------
// <copyright file="StatusResponse.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.Status;

using AliasVault.Shared.Models.WebApi.V2.Vault;

/// <summary>
/// Response for GET /v2/Status: a single generic status endpoint that combines session/version checks
/// with the vault storage-format and revision info.
/// </summary>
public class StatusResponse
{
    /// <summary>
    /// Gets or sets a value indicating whether the client version is supported by this API, as
    /// determined by the server based on the client provided header.
    /// </summary>
    public required bool ClientVersionSupported { get; set; }

    /// <summary>
    /// Gets or sets the API version of the server. This is used by the client to determine if it
    /// is compatible with the server or if the server should be updated to a newer version.
    /// </summary>
    public required string ServerVersion { get; set; }

    /// <summary>
    /// Gets or sets the SRP salt. This is used by the client to validate that the local encryption key
    /// still matches the latest vault revision. If it doesn't match, the client should trigger a logout
    /// to make the user re-authenticate with the new password.
    /// </summary>
    public required string SrpSalt { get; set; }

    /// <summary>
    /// Gets or sets the latest revision for each logical manifest the user has access to.
    /// </summary>
    public List<ManifestRevision> ManifestRevisions { get; set; } = [];

    /// <summary>
    /// Gets or sets the caller's personal manifest id: the single manifest owned by their personal group. Every other
    /// entry in <see cref="ManifestRevisions"/> is a shared one. Null for a user still on the legacy sqlite-blob format.
    /// </summary>
    public Guid? PersonalManifestId { get; set; }

    /// <summary>Gets or sets the latest revision for each data-bucket kind the user has. Empty when none stored.</summary>
    public List<BucketRevision> BucketRevisions { get; set; } = [];

    /// <summary>
    /// Gets or sets what this caller may do, keyed by capability.
    /// </summary>
    public Dictionary<string, string> Capabilities { get; set; } = [];

    /// <summary>
    /// Gets or sets the email domains this server serves, so clients pick up a domain change without a vault pull.
    /// </summary>
    public EmailDomains EmailDomains { get; set; } = new();

    /// <summary>
    /// Gets or sets the number of open invitations to shared manifests addressed to this caller, so a client knows when
    /// to fetch them.
    /// </summary>
    public int PendingSharingInvitations { get; set; }
}