using Bit.Core.Entities; using Bit.Core.Utilities; namespace Bit.Core.Auth.Entities; public class OpaqueKeyExchangeCredential : ITableObject { /// /// Identity column /// public Guid Id { get; set; } /// /// User who owns the credential /// public Guid UserId { get; set; } /// /// This describes the cipher configuration that both the server and client know. /// This is returned on the /prelogin api call for the user. /// public string CipherConfiguration { get; set; } /// /// This contains Credential specific information. Storing as a blob gives us flexibility for future /// iterations of the specifics of the OPAQUE implementation. /// public string CredentialBlob { get; set; } /// /// User key encapsulated OPAQUE credential public key (enables user key rotation). /// public string EncryptedPublicKey { get; set; } /// /// The OPAQUE clientside export key encapsulated OPAQUE credential private key. /// The client uses the export key to decrypt the private key and then decrypt the user key. /// public string EncryptedPrivateKey { get; set; } /// /// The OPAQUE Credential Public key encapsulated user key. /// The client uses the private key to decrypt the user key. /// public string EncryptedUserKey { get; set; } /// /// Date credential was created. When we update we are creating a new key set so in effect we are creating a new credential. /// public DateTime CreationDate { get; internal set; } = DateTime.UtcNow; public void SetNewId() { Id = CoreHelpers.GenerateComb(); } }