//----------------------------------------------------------------------- // // Copyright (c) lanedirt. All rights reserved. // Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information. // //----------------------------------------------------------------------- namespace AliasServerDb; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; /// /// Vault object. /// public class Vault { /// /// Gets or sets Login ID. /// [Key] public Guid Id { get; set; } /// /// Gets or sets user ID foreign key. /// [StringLength(255)] public string UserId { get; set; } = null!; /// /// Gets or sets foreign key to the AliasVaultUser object. /// [ForeignKey("UserId")] public virtual AliasVaultUser User { get; set; } = null!; /// /// Gets or sets the encrypted vault blob. /// public required string VaultBlob { get; set; } /// /// Gets or sets the vault data model version. /// [StringLength(255)] public required string Version { get; set; } /// /// Gets or sets the revision number of the vault. /// This number is incremented with each change to the vault and is used for /// managing concurrency and merging during the synchronization process. /// It helps in detecting conflicts and ensuring data consistency if multiple clients /// update a previous version of the vault simultaneously. /// [Required] public required long RevisionNumber { get; set; } /// /// Gets or sets the vault filesize in kilobytes. /// public int FileSize { get; set; } /// /// Gets or sets the salt used for SRP authentication. Note: the login credentials are stored with the vault because /// the vault itself is encrypted with the same key derived from the user's password. So the password the user /// uses to log in to AliasVault needs to be the same as the vault to keep everything in-sync in case of vault /// backup restores. /// [StringLength(100)] public required string Salt { get; set; } /// /// Gets or sets the verifier used for SRP authentication. Note: the login credentials are stored with the vault /// because the vault itself is encrypted with the same key derived from the user's password. So the password the /// user uses to log in to AliasVault needs to be the same as the vault to keep everything in-sync in case of vault /// backup restores. /// [StringLength(1000)] public required string Verifier { get; set; } /// /// Gets or sets the number of credentials stored in the vault. This anonymous data is used in case a vault back-up /// needs to be restored to get a better idea of the vault size. /// public int CredentialsCount { get; set; } /// /// Gets or sets the number of email claims stored in the vault. This anonymous data is used in case a vault back-up /// needs to be restored to get a better idea of the vault size. /// public int EmailClaimsCount { get; set; } /// /// Gets or sets the encryption type. /// public required string EncryptionType { get; set; } /// /// Gets or sets the encryption settings as a JSON string. /// public required string EncryptionSettings { get; set; } /// /// Gets or sets the client that created the vault. /// [StringLength(255)] public string? Client { get; set; } /// /// Gets or sets created timestamp. /// public DateTime CreatedAt { get; set; } /// /// Gets or sets updated timestamp. /// public DateTime UpdatedAt { get; set; } }