Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add signing key logic scaffolding (#2469)
Leendert de Borst5ae1a396de2c
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultCrypto.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultCrypto.ktindex f07741bb0..9d05476fc 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultCrypto.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultCrypto.kt@@ -90,6 +90,12 @@ class VaultCrypto(internal val accountPrivateKey: String?get() = sessionKeys()?.accountPrivateKey+ /**+ * The Account Key of the unlocked session (base64), which the sync engine opens the signing key with.+ */+ internal val accountKeyBase64: String?+ get() = sessionKeys()?.accountKey?.let { Base64.encodeToString(it, Base64.NO_WRAP) }+/*** What the Account Key opens in the cached account key chain; a legacy key converts (see [LegacyKeyConversion]).*/diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.ktindex eb8145006..de908670d 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.kt@@ -249,6 +249,12 @@ class VaultStore(internal val accountPrivateKey: String?get() = crypto.accountPrivateKey+ /**+ * The Account Key of the unlocked session (base64), which the sync engine opens the signing key with.+ */+ internal val accountKeyBase64: String?+ get() = crypto.accountKeyBase64+/*** Decrypt base64 RSA-OAEP ciphertext with the session's account private key as UTF-8 text, or null when the session* holds no private key or it does not open the ciphertext.diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultSyncEngine.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultSyncEngine.ktindex db6b6de2c..3fccddfe7 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultSyncEngine.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultSyncEngine.kt@@ -98,6 +98,7 @@ class VaultSyncEngine((encryptionKey ?: vaultStore.getEncryptionKeyBase64())?.let { request.put("encryptionKey", it) }(state("accountPublicKey") as? String)?.let { request.put("accountPublicKey", it) }vaultStore.accountPrivateKey?.let { request.put("accountPrivateKey", it) }+ vaultStore.accountKeyBase64?.let { request.put("accountKey", it) }sharing?.let { request.put("sharing", it) }return request.toString()}diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/SigningKeyAlgorithm.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/SigningKeyAlgorithm.ktnew file mode 100644index 000000000..4c8770744--- /dev/null+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/SigningKeyAlgorithm.kt@@ -0,0 +1,20 @@+// <auto-generated />+// This file is auto-generated from core/models/scripts/generate-key-vocabulary.cjs.+// Do not edit this file directly. Run 'core/models/build.sh' (or 'node core/models/scripts/generate-key-vocabulary.cjs') to regenerate.++package net.aliasvault.app.vaultstore.models++/**+ * The algorithms an account signing keypair can sign with.+ */+object SigningKeyAlgorithm {+ /**+ * Ed25519 (RFC 8032), verified strictly.+ */+ const val ED25519 = "ed25519"++ /**+ * All known SigningKeyAlgorithm tokens.+ */+ val all = listOf(ED25519)+}diff --git a/apps/mobile-app/ios/VaultModels/SigningKeyAlgorithm.swift b/apps/mobile-app/ios/VaultModels/SigningKeyAlgorithm.swiftnew file mode 100644index 000000000..1351247cd--- /dev/null+++ b/apps/mobile-app/ios/VaultModels/SigningKeyAlgorithm.swift@@ -0,0 +1,14 @@+// <auto-generated />+// This file is auto-generated from core/models/scripts/generate-key-vocabulary.cjs.+// Do not edit this file directly. Run 'core/models/build.sh' (or 'node core/models/scripts/generate-key-vocabulary.cjs') to regenerate.++import Foundation++/// The algorithms an account signing keypair can sign with.+public struct SigningKeyAlgorithm {+ /// Ed25519 (RFC 8032), verified strictly.+ public static let ed25519 = "ed25519"++ /// All known SigningKeyAlgorithm tokens.+ public static let all = [ed25519]+}diff --git a/apps/mobile-app/ios/VaultStoreKit/Services/VaultSyncEngine.swift b/apps/mobile-app/ios/VaultStoreKit/Services/VaultSyncEngine.swiftindex adce51901..e669ab408 100644--- a/apps/mobile-app/ios/VaultStoreKit/Services/VaultSyncEngine.swift+++ b/apps/mobile-app/ios/VaultStoreKit/Services/VaultSyncEngine.swift@@ -95,6 +95,9 @@ public final class VaultSyncEngine {if let privateKey = vaultStore.accountPrivateKey {request["accountPrivateKey"] = privateKey}+ if let accountKey = vaultStore.accountKeyBase64 {+ request["accountKey"] = accountKey+ }if let sharing = sharing {request["sharing"] = sharing}diff --git a/apps/mobile-app/ios/VaultStoreKit/VaultStore.swift b/apps/mobile-app/ios/VaultStoreKit/VaultStore.swiftindex b7eaa637f..c1088bacd 100644--- a/apps/mobile-app/ios/VaultStoreKit/VaultStore.swift+++ b/apps/mobile-app/ios/VaultStoreKit/VaultStore.swift@@ -45,6 +45,11 @@ public class VaultStore {return sessionKeys?.accountPrivateKey}+ /// The Account Key of the unlocked session (base64), which the sync engine opens the signing key with.+ internal var accountKeyBase64: String? {+ return sessionKeys?.accountKey.base64EncodedString()+ }+/// What the Account Key opens in the cached account key chain.private var sessionKeys: SessionKeys? {guard let accountKey = accountKey else {diff --git a/apps/server/AliasVault.Api/Controllers/V1/VaultController.cs b/apps/server/AliasVault.Api/Controllers/V1/VaultController.csindex e0a935f92..774557c90 100644--- a/apps/server/AliasVault.Api/Controllers/V1/VaultController.cs+++ b/apps/server/AliasVault.Api/Controllers/V1/VaultController.cs@@ -539,47 +539,21 @@ public class VaultController(ILogger<VaultController> logger, IAliasServerDbCont}/// <summary>- /// Updates the user's public key based on the provided public key. If it already exists, do nothing.+ /// Stores the user's first delivery public key. A v1 push never replaces an existing one: changing it needs a signature+ /// by the account signing key, which only the v2 endpoint checks./// </summary>/// <param name="context">The database context.</param>/// <param name="personalManifestId">The caller's personal manifest, which their personal keys are scoped to.</param>- /// <param name="newPublicKey">The new public key to sync and set as default.</param>+ /// <param name="newPublicKey">The public key to store.</param>/// <returns>A task representing the asynchronous operation.</returns>private async Task UpdateUserPublicKey(AliasServerDbContext context, Guid personalManifestId, string newPublicKey){- var publicKeyExists = await context.VaultManifestDeliveryKeys- .AnyAsync(x => x.VaultManifestId == personalManifestId && x.IsPrimary && x.PublicKey == newPublicKey);-- // If the public key already exists and is marked as primary (default), do nothing.- if (publicKeyExists)+ if (await context.VaultManifestDeliveryKeys.AnyAsync(x => x.VaultManifestId == personalManifestId)){return;}- // Update all existing personal keys to not be primary.- var otherKeys = await context.VaultManifestDeliveryKeys- .Where(x => x.VaultManifestId == personalManifestId)- .ToListAsync();-- foreach (var key in otherKeys)- {- key.IsPrimary = false;- key.UpdatedAt = timeProvider.GetUtcNow().UtcDateTime;- }-- // Check if the new public key already exists but is not marked as primary.- var existingPublicKey = otherKeys.FirstOrDefault(x => x.PublicKey == newPublicKey);- if (existingPublicKey is not null)- {- // Set the existing key to be primary.- existingPublicKey.IsPrimary = true;- existingPublicKey.UpdatedAt = timeProvider.GetUtcNow().UtcDateTime;- await context.SaveChangesAsync();- return;- }-- // Public key is new, so create it.- var newPublicKeyEntry = new VaultManifestDeliveryKey+ context.VaultManifestDeliveryKeys.Add(new VaultManifestDeliveryKey{VaultManifestId = personalManifestId,Algorithm = VaultKeyAlgorithm.RsaOaepSha256,@@ -587,8 +561,7 @@ public class VaultController(ILogger<VaultController> logger, IAliasServerDbContIsPrimary = true,CreatedAt = timeProvider.GetUtcNow().UtcDateTime,UpdatedAt = timeProvider.GetUtcNow().UtcDateTime,- };- context.VaultManifestDeliveryKeys.Add(newPublicKeyEntry);+ });await context.SaveChangesAsync();}diff --git a/apps/server/AliasVault.Api/Controllers/V2/AuthController.cs b/apps/server/AliasVault.Api/Controllers/V2/AuthController.csindex e18a9cafa..4d0cd2a36 100644--- a/apps/server/AliasVault.Api/Controllers/V2/AuthController.cs+++ b/apps/server/AliasVault.Api/Controllers/V2/AuthController.cs@@ -444,7 +444,7 @@ public class AuthController(IAliasServerDbContextFactory dbContextFactory, UserMreturn BadRequest(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.VAULT_KEY_NOT_FOUND, 400));}- if (!model.AccountKeysFitStorageLimits)+ if (!model.AccountKeysFitStorageLimits || !Signing.VerifyAccountPublicKey(model.SigningPublicKey, model.AccountPublicKey, model.AccountPublicKeySignature)){return BadRequest(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.VAULT_ERROR, 400));}@@ -535,6 +535,19 @@ public class AuthController(IAliasServerDbContextFactory dbContextFactory, UserMAlgorithm = VaultKeyAlgorithm.RsaOaepSha256,PublicKey = model.AccountPublicKey!,EncryptedPrivateKey = model.EncryptedAccountPrivateKey!,+ PublicKeySignature = model.AccountPublicKeySignature!,+ IsPrimary = true,+ CreatedAt = timeProvider.GetUtcNow().UtcDateTime,+ UpdatedAt = timeProvider.GetUtcNow().UtcDateTime,+ });++ context.UserSigningKeys.Add(new UserSigningKey+ {+ Id = Guid.NewGuid(),+ UserId = user.Id,+ Algorithm = SigningKeyAlgorithm.Ed25519,+ PublicKey = model.SigningPublicKey!,+ EncryptedPrivateKey = model.EncryptedSigningPrivateKey!,IsPrimary = true,CreatedAt = timeProvider.GetUtcNow().UtcDateTime,UpdatedAt = timeProvider.GetUtcNow().UtcDateTime,diff --git a/apps/server/AliasVault.Api/Controllers/V2/GroupsController.cs b/apps/server/AliasVault.Api/Controllers/V2/GroupsController.csindex 686429695..1063329de 100644--- a/apps/server/AliasVault.Api/Controllers/V2/GroupsController.cs+++ b/apps/server/AliasVault.Api/Controllers/V2/GroupsController.cs@@ -13,6 +13,7 @@ using AliasVault.Api.Filters;using AliasVault.Api.Helpers;using AliasVault.Api.Models;using AliasVault.Auth;+using AliasVault.Cryptography;using AliasVault.Shared.Models.Enums;using AliasVault.Shared.Models.WebApi;using AliasVault.Shared.Models.WebApi.V2.Auth;@@ -77,7 +78,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use.ToListAsync();var manifests = await context.VaultManifests.Where(m => groupIds.Contains(m.OwnerGroupId))- .Select(m => new { m.ManifestId, m.OwnerGroupId, m.CreatedAt })+ .Select(m => new { m.ManifestId, m.OwnerGroupId, m.KeyVersion, m.CreatedAt }).ToListAsync();var grantHolders = await GrantHelper.GetGrantHoldersByManifestAsync(context, manifests.ConvertAll(m => m.ManifestId));@@ -109,6 +110,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use.Select(m => new SharedManifestInfo{ManifestId = m.Manifest.ManifestId,+ KeyVersion = m.Manifest.KeyVersion,MemberUserIds = [.. m.Holders],PendingInvitations = canAdminister ? openInvitations.GetValueOrDefault(m.Manifest.ManifestId) ?? [] : [],})],@@ -119,6 +121,8 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, UseRole = m.Role.ToString(),PublicKeyId = canAdminister ? publicKeys.GetValueOrDefault(m.UserId)?.PublicKeyId : null,PublicKey = canAdminister ? publicKeys.GetValueOrDefault(m.UserId)?.PublicKey : null,+ PublicKeySignature = canAdminister ? publicKeys.GetValueOrDefault(m.UserId)?.PublicKeySignature : null,+ SigningPublicKey = canAdminister ? publicKeys.GetValueOrDefault(m.UserId)?.SigningPublicKey : null,})],});}@@ -170,6 +174,13 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Usereturn NotFound(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.RECIPIENT_KEY_NOT_FOUND, 404));}+ // The caller signs their own grant like any other, so a reader can tell it was not made up by somebody else.+ var signerPublicKey = await GrantHelper.GetPrimarySigningKeyAsync(context, me.Id);+ if (!Signing.Verify(signerPublicKey, Signing.GrantMessage(model.ManifestId, 0, me.Id, model.SelfPublicKey, model.Algorithm, model.SelfEncryptedVek), model.SelfGrantSignature))+ {+ return BadRequest(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.SIGNATURE_INVALID, 400));+ }+// A family holds a handful of manifests, enough to keep e.g. streaming and banking apart without growing without bound.if (await context.VaultManifests.CountAsync(x => x.OwnerGroupId == groupId) >= MaxSharedVaults){@@ -183,6 +194,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, UseOwnerGroupId = groupId,StorageFormat = VaultManifestBase.ManifestStorageFormat,RevisionNumber = 0,+ KeyVersion = 0,FileSize = 0,Client = ClientHeader,CreatedAt = timeProvider.GetUtcNow().UtcDateTime,@@ -190,7 +202,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use};context.VaultManifests.Add(manifest);context.VaultManifestShareDetails.Add(new VaultManifestShareDetails { ManifestId = manifest.ManifestId, EncryptedName = model.EncryptedName, CreatedAt = timeProvider.GetUtcNow().UtcDateTime, UpdatedAt = timeProvider.GetUtcNow().UtcDateTime });- context.VaultManifestAccessKeys.Add(GrantHelper.BuildGrant(manifest.ManifestId, me.Id, selfPublicKeyId.Value, model.SelfEncryptedVek, algorithm, manifest.KeyVersion, timeProvider.GetUtcNow().UtcDateTime));+ context.VaultManifestAccessKeys.Add(GrantHelper.BuildGrant(manifest.ManifestId, me.Id, selfPublicKeyId.Value, model.SelfEncryptedVek, algorithm, manifest.KeyVersion, model.SelfGrantSignature, me.Id, signerPublicKey!, timeProvider.GetUtcNow().UtcDateTime));try{@@ -269,11 +281,18 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use}// The key it was encrypted for must really be theirs.- if (!await context.UserGrantKeys.AnyAsync(k => k.Id == model.Grant.RecipientPublicKeyId && k.UserId == model.UserId))+ var recipientPublicKey = await context.UserGrantKeys.Where(k => k.Id == model.Grant.RecipientPublicKeyId && k.UserId == model.UserId).Select(k => k.PublicKey).FirstOrDefaultAsync();+ if (recipientPublicKey is null){return NotFound(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.RECIPIENT_KEY_NOT_FOUND, 404));}+ var signerPublicKey = await GrantHelper.GetPrimarySigningKeyAsync(context, me.Id);+ if (!Signing.Verify(signerPublicKey, Signing.GrantMessage(manifestId, manifestKeyVersion.Value, me.Id, recipientPublicKey, model.Algorithm, model.Grant.EncryptedVek), model.Grant.Signature))+ {+ return BadRequest(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.SIGNATURE_INVALID, 400));+ }+if (await ManifestAccessHelper.HoldsGrantAsync(context, model.UserId, manifestId)){return BadRequest(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.ACCESS_ALREADY_GRANTED, 400));@@ -298,6 +317,8 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, UseEncryptedVek = model.Grant.EncryptedVek,EncryptedName = model.Grant.EncryptedName,UserGrantKeyId = model.Grant.RecipientPublicKeyId,+ GrantSignature = model.Grant.Signature,+ GrantSignerPublicKey = signerPublicKey,VaultKeyVersion = manifestKeyVersion.Value,Algorithm = algorithm,CreatedAt = timeProvider.GetUtcNow().UtcDateTime,@@ -602,6 +623,8 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Useinvitation.EncryptedVek = null;invitation.EncryptedName = null;invitation.UserGrantKeyId = null;+ invitation.GrantSignature = null;+ invitation.GrantSignerPublicKey = null;await context.SaveChangesAsync();return Ok();@@ -739,6 +762,8 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Useinvitation.EncryptedVek = null;invitation.EncryptedName = null;invitation.UserGrantKeyId = null;+ invitation.GrantSignature = null;+ invitation.GrantSignerPublicKey = null;invitation.RespondedAt = timeProvider.GetUtcNow().UtcDateTime;invitation.UpdatedAt = timeProvider.GetUtcNow().UtcDateTime;}@@ -753,7 +778,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use/// <returns>Whether the accepting user ends up holding a grant on the manifest.</returns>private async Task<bool> PromoteInvitationGrantAsync(AliasServerDbContext context, GroupInvitation invitation, string userId, int keyVersion){- if (invitation.EncryptedVek is null || invitation.UserGrantKeyId is null || invitation.VaultManifestId is null)+ if (invitation.EncryptedVek is null || invitation.UserGrantKeyId is null || invitation.VaultManifestId is null || invitation.GrantSignature is null || invitation.GrantSignerPublicKey is null){return false;}@@ -764,7 +789,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Usereturn true;}- context.VaultManifestAccessKeys.Add(GrantHelper.BuildGrant(manifestId, userId, invitation.UserGrantKeyId.Value, invitation.EncryptedVek, invitation.Algorithm, keyVersion, timeProvider.GetUtcNow().UtcDateTime));+ context.VaultManifestAccessKeys.Add(GrantHelper.BuildGrant(manifestId, userId, invitation.UserGrantKeyId.Value, invitation.EncryptedVek, invitation.Algorithm, keyVersion, invitation.GrantSignature, invitation.InviterUserId, invitation.GrantSignerPublicKey, timeProvider.GetUtcNow().UtcDateTime));return true;}diff --git a/apps/server/AliasVault.Api/Controllers/V2/Tests/TestController.cs b/apps/server/AliasVault.Api/Controllers/V2/Tests/TestController.csindex b7feed2a7..3dced3ea6 100644--- a/apps/server/AliasVault.Api/Controllers/V2/Tests/TestController.cs+++ b/apps/server/AliasVault.Api/Controllers/V2/Tests/TestController.cs@@ -396,6 +396,7 @@ public class TestController(user.SrpIdentity = request.SrpIdentity;context.UserUnlockKeys.RemoveRange(context.UserUnlockKeys.Where(x => x.UserId == user.Id));context.UserGrantKeys.RemoveRange(context.UserGrantKeys.Where(x => x.UserId == user.Id));+ context.UserSigningKeys.RemoveRange(context.UserSigningKeys.Where(x => x.UserId == user.Id));context.VaultManifestAccessKeys.RemoveRange(context.VaultManifestAccessKeys.Where(x => x.UserId == user.Id));var manifest = await context.VaultManifests.FirstOrDefaultAsync(x => x.OwnerGroupId == user.PersonalGroupId);diff --git a/apps/server/AliasVault.Api/Controllers/V2/VaultController.cs b/apps/server/AliasVault.Api/Controllers/V2/VaultController.csindex 54128b624..a64e36592 100644--- a/apps/server/AliasVault.Api/Controllers/V2/VaultController.cs+++ b/apps/server/AliasVault.Api/Controllers/V2/VaultController.cs@@ -14,6 +14,7 @@ using AliasVault.Api.Models;using AliasVault.Api.Services;using AliasVault.Api.Vault;using AliasVault.Api.Vault.RetentionRules;+using AliasVault.Cryptography;using AliasVault.Shared.Models.Enums;using AliasVault.Shared.Models.WebApi;using AliasVault.Shared.Models.WebApi.V2.Vault;@@ -154,6 +155,10 @@ public class VaultController(EncryptedVek = grant?.EncryptedVek,Algorithm = grant != null ? VaultKeyAlgorithms.ToToken(grant.Algorithm) : null,EncryptionPublicKey = grant?.UserGrantKeyId != null ? encryptionPublicKeys.GetValueOrDefault(grant.UserGrantKeyId.Value) : null,+ GrantSignature = grant?.GrantSignature,+ GrantSignerUserId = grant?.GrantSignerUserId,+ GrantSignerPublicKey = grant?.GrantSignerPublicKey,+ KeyVersion = grant?.KeyVersion ?? 0,};}).ToList();@@ -216,6 +221,10 @@ public class VaultController({manifest.EncryptedVek = accessKey.EncryptedVek;manifest.Algorithm = VaultKeyAlgorithms.ToToken(accessKey.Algorithm);+ manifest.GrantSignature = accessKey.GrantSignature;+ manifest.GrantSignerUserId = accessKey.GrantSignerUserId;+ manifest.GrantSignerPublicKey = accessKey.GrantSignerPublicKey;+ manifest.KeyVersion = accessKey.KeyVersion;if (accessKey.UserGrantKeyId != null){manifest.EncryptionPublicKey = await context.UserGrantKeys.Where(k => k.Id == accessKey.UserGrantKeyId).Select(k => k.PublicKey).FirstOrDefaultAsync();@@ -388,7 +397,7 @@ public class VaultController(return BadRequest(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.VAULT_KEY_NOT_FOUND, 400));}- if (!accountKeys.FitsStorageLimits)+ if (!accountKeys.FitsStorageLimits || !Signing.VerifyAccountPublicKey(accountKeys.SigningPublicKey, accountKeys.AccountPublicKey, accountKeys.AccountPublicKeySignature)){return BadRequest(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.VAULT_ERROR, 400));}@@ -433,6 +442,12 @@ public class VaultController(});}+ // A new delivery key must be signed by the caller, so a stolen access token alone cannot redirect incoming mail.+ if (!await DeliveryKeyChangesAreSignedAsync(context, user.Id, resolved, accountKeys))+ {+ return BadRequest(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.SIGNATURE_INVALID, 400));+ }+// The DbContext uses a retrying execution strategy (EnableRetryOnFailure), which forbids user-initiated// transactions unless the whole unit runs inside the strategy so it can be retried atomically.var strategy = context.Database.CreateExecutionStrategy();@@ -533,6 +548,19 @@ public class VaultController(Algorithm = VaultKeyAlgorithm.RsaOaepSha256,PublicKey = accountKeys.AccountPublicKey!,EncryptedPrivateKey = accountKeys.EncryptedAccountPrivateKey!,+ PublicKeySignature = accountKeys.AccountPublicKeySignature!,+ IsPrimary = true,+ CreatedAt = timeProvider.GetUtcNow().UtcDateTime,+ UpdatedAt = timeProvider.GetUtcNow().UtcDateTime,+ });++ context.UserSigningKeys.Add(new UserSigningKey+ {+ Id = Guid.NewGuid(),+ UserId = user.Id,+ Algorithm = SigningKeyAlgorithm.Ed25519,+ PublicKey = accountKeys.SigningPublicKey!,+ EncryptedPrivateKey = accountKeys.EncryptedSigningPrivateKey!,IsPrimary = true,CreatedAt = timeProvider.GetUtcNow().UtcDateTime,UpdatedAt = timeProvider.GetUtcNow().UtcDateTime,@@ -920,6 +948,31 @@ public class VaultController(return await ManifestAccessHelper.AccessibleManifests(context, accessScope).Where(x => x.ManifestId == manifestId).Select(x => (Guid?)x.OwnerGroupId).FirstOrDefaultAsync();}+ /// <summary>+ /// Whether every delivery key this write would make primary is signed by the caller (a key that is already primary needs no signature).+ /// </summary>+ /// <param name="context">Database context.</param>+ /// <param name="userId">The calling user.</param>+ /// <param name="resolved">The manifest writes with their rows.</param>+ /// <param name="accountKeys">The key hierarchy an upgrade push creates, if any.</param>+ /// <returns>True when every change is signed.</returns>+ private static async Task<bool> DeliveryKeyChangesAreSignedAsync(AliasServerDbContext context, string userId, List<(ManifestWrite Write, VaultManifest Row)> resolved, AccountKeysUpload? accountKeys)+ {+ var publishing = resolved.Where(r => !string.IsNullOrEmpty(r.Write.EncryptionPublicKey)).ToList();+ if (publishing.Count == 0)+ {+ return true;+ }++ var manifestIds = publishing.Select(r => r.Row.ManifestId).ToList();+ var primaryKeys = await context.VaultManifestDeliveryKeys.Where(k => manifestIds.Contains(k.VaultManifestId) && k.IsPrimary).ToDictionaryAsync(k => k.VaultManifestId, k => k.PublicKey);++ // The upgrade push carries the signing key it signs with; it is stored in the same write.+ var signingKey = accountKeys?.SigningPublicKey ?? await GrantHelper.GetPrimarySigningKeyAsync(context, userId);+ return publishing.All(r => primaryKeys.GetValueOrDefault(r.Row.ManifestId) == r.Write.EncryptionPublicKey+ || Signing.Verify(signingKey, Signing.DeliveryKeyMessage(r.Row.ManifestId, r.Write.EncryptionPublicKey!, r.Write.CurrentRevision), r.Write.EncryptionPublicKeySignature));+ }+/// <summary>/// Gets the caller's key row on each of the given manifests, whichever way that manifest's VEK is encrypted for/// them: an account-key row (unlocked through their password chain) or a grant encrypted to one of their publicdiff --git a/apps/server/AliasVault.Api/Controllers/V2/VaultKeyController.cs b/apps/server/AliasVault.Api/Controllers/V2/VaultKeyController.csindex 2c9f71c97..01293a354 100644--- a/apps/server/AliasVault.Api/Controllers/V2/VaultKeyController.cs+++ b/apps/server/AliasVault.Api/Controllers/V2/VaultKeyController.cs@@ -62,6 +62,10 @@ public class VaultKeyController(IAliasServerDbContextFactory dbContextFactory, U.Where(x => x.UserId == user.Id && x.IsPrimary).Select(x => new { x.PublicKey, x.EncryptedPrivateKey }).FirstOrDefaultAsync();+ var signingKeypair = await context.UserSigningKeys+ .Where(x => x.UserId == user.Id && x.IsPrimary)+ .Select(x => new { x.PublicKey, x.EncryptedPrivateKey })+ .FirstOrDefaultAsync();// Get the KEK derivation parameters.var credentials = VaultKeyMetadata.Parse(unlockKey.Metadata).RequireSrpCredentials();@@ -75,6 +79,8 @@ public class VaultKeyController(IAliasServerDbContextFactory dbContextFactory, UEncryptedVek = encryptedVek,AccountPublicKey = accountKeypair?.PublicKey,EncryptedAccountPrivateKey = accountKeypair?.EncryptedPrivateKey,+ SigningPublicKey = signingKeypair?.PublicKey,+ EncryptedSigningPrivateKey = signingKeypair?.EncryptedPrivateKey,Salt = credentials.Salt,EncryptionType = credentials.EncryptionType,EncryptionSettings = credentials.EncryptionSettings,diff --git a/apps/server/AliasVault.Api/Helpers/GrantHelper.cs b/apps/server/AliasVault.Api/Helpers/GrantHelper.csindex dc725afc5..daf5cd213 100644--- a/apps/server/AliasVault.Api/Helpers/GrantHelper.cs+++ b/apps/server/AliasVault.Api/Helpers/GrantHelper.cs@@ -26,9 +26,12 @@ public static class GrantHelper/// <param name="encryptedVek">The encrypted VEK.</param>/// <param name="algorithm">The algorithm it was encrypted with.</param>/// <param name="keyVersion">The version of the manifest's VEK that <paramref name="encryptedVek"/> yields.</param>+ /// <param name="signature">The granter's signature over the grant.</param>+ /// <param name="signerUserId">The granter.</param>+ /// <param name="signerPublicKey">The granter's signing public key.</param>/// <param name="now">Current time.</param>/// <returns>The unpersisted grant.</returns>- public static VaultManifestAccessKey BuildGrant(Guid manifestId, string userId, Guid publicKeyId, string encryptedVek, VaultKeyAlgorithm algorithm, int keyVersion, DateTime now)+ public static VaultManifestAccessKey BuildGrant(Guid manifestId, string userId, Guid publicKeyId, string encryptedVek, VaultKeyAlgorithm algorithm, int keyVersion, string signature, string signerUserId, string signerPublicKey, DateTime now){return new VaultManifestAccessKey{@@ -40,6 +43,9 @@ public static class GrantHelperEncryptedVek = encryptedVek,KeyVersion = keyVersion,UserGrantKeyId = publicKeyId,+ GrantSignature = signature,+ GrantSignerUserId = signerUserId,+ GrantSignerPublicKey = signerPublicKey,CreatedAt = now,UpdatedAt = now,};@@ -75,9 +81,24 @@ public static class GrantHelperreturn [];}+ var signingKeys = await context.UserSigningKeys+ .Where(k => ids.Contains(k.UserId) && k.IsPrimary)+ .ToDictionaryAsync(k => k.UserId, k => k.PublicKey);+return await context.UserGrantKeys.Where(k => ids.Contains(k.UserId) && k.IsPrimary)- .ToDictionaryAsync(k => k.UserId, k => new MemberPublicKey(k.Id, k.PublicKey));+ .ToDictionaryAsync(k => k.UserId, k => new MemberPublicKey(k.Id, k.PublicKey, k.PublicKeySignature, signingKeys.GetValueOrDefault(k.UserId)));+ }++ /// <summary>+ /// Get a user's primary signing public key.+ /// </summary>+ /// <param name="context">The database context.</param>+ /// <param name="userId">The user.</param>+ /// <returns>The public key, or null for an account not yet on the account key model (no key hierarchy at all).</returns>+ public static async Task<string?> GetPrimarySigningKeyAsync(AliasServerDbContext context, string userId)+ {+ return await context.UserSigningKeys.Where(k => k.UserId == userId && k.IsPrimary).Select(k => k.PublicKey).FirstOrDefaultAsync();}/// <summary>diff --git a/apps/server/AliasVault.Api/Models/MemberPublicKey.cs b/apps/server/AliasVault.Api/Models/MemberPublicKey.csindex 09b1c9023..29b8950f4 100644--- a/apps/server/AliasVault.Api/Models/MemberPublicKey.cs+++ b/apps/server/AliasVault.Api/Models/MemberPublicKey.cs@@ -12,4 +12,6 @@ namespace AliasVault.Api.Models;/// </summary>/// <param name="PublicKeyId">The id of the key row.</param>/// <param name="PublicKey">The public key itself (JWK).</param>-public sealed record MemberPublicKey(Guid PublicKeyId, string PublicKey);+/// <param name="PublicKeySignature">The member's signature over <paramref name="PublicKey"/>.</param>+/// <param name="SigningPublicKey">The member's signing public key the signature verifies under.</param>+public sealed record MemberPublicKey(Guid PublicKeyId, string PublicKey, string PublicKeySignature, string? SigningPublicKey);diff --git a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs b/apps/server/Databases/AliasServerDb/AliasServerDbContext.csindex 32b54a3bd..69b6437e5 100644--- a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs+++ b/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs@@ -217,6 +217,11 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyCon/// </summary>public DbSet<UserGrantKey> UserGrantKeys { get; set; }+ /// <summary>+ /// Gets or sets the UserSigningKeys DbSet.+ /// </summary>+ public DbSet<UserSigningKey> UserSigningKeys { get; set; }+/// <summary>/// Gets or sets the VaultManifestAccessKeys DbSet./// </summary>@@ -511,6 +516,18 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyConbuilder.Property(e => e.Algorithm).HasConversion(v => VaultKeyAlgorithms.ToToken(v), v => VaultKeyAlgorithms.Parse(v));});+ // Configure UserSigningKey: the account signing keypair; one primary per user.+ modelBuilder.Entity<UserSigningKey>(builder =>+ {+ builder.HasOne(e => e.User)+ .WithMany()+ .HasForeignKey(e => e.UserId)+ .OnDelete(DeleteBehavior.Cascade);++ builder.HasIndex(e => e.UserId).IsUnique().HasFilter("\"IsPrimary\"").HasDatabaseName("UX_UserSigningKeys_User_Primary");+ builder.Property(e => e.Algorithm).HasConversion(v => SigningKeyAlgorithms.ToToken(v), v => SigningKeyAlgorithms.Parse(v));+ });+/** Configure EmailClaim - one owning manifest per address.*/diff --git a/apps/server/Databases/AliasServerDb/GroupInvitation.cs b/apps/server/Databases/AliasServerDb/GroupInvitation.csindex 11dd51b07..f736862fb 100644--- a/apps/server/Databases/AliasServerDb/GroupInvitation.cs+++ b/apps/server/Databases/AliasServerDb/GroupInvitation.cs@@ -89,6 +89,18 @@ public class GroupInvitation/// </summary>public virtual UserGrantKey? UserGrantKey { get; set; }+ /// <summary>+ /// Gets or sets the inviter's signature over the grant in <see cref="EncryptedVek"/>. Cleared with it when the invitation closes.+ /// </summary>+ [StringLength(255)]+ public string? GrantSignature { get; set; }++ /// <summary>+ /// Gets or sets the inviter's signing public key that <see cref="GrantSignature"/> verifies under.+ /// </summary>+ [StringLength(100)]+ public string? GrantSignerPublicKey { get; set; }+/// <summary>/// Gets or sets the version of the manifest's VEK that this invitation was encrypted under. Used to check/// if this invitation is still valid for the manifest upon accepting.diff --git a/apps/server/Databases/AliasServerDb/Legacy/LegacyVaultRollback.cs b/apps/server/Databases/AliasServerDb/Legacy/LegacyVaultRollback.csindex 5f3d9ed48..f5fd0f641 100644--- a/apps/server/Databases/AliasServerDb/Legacy/LegacyVaultRollback.cs+++ b/apps/server/Databases/AliasServerDb/Legacy/LegacyVaultRollback.cs@@ -65,6 +65,7 @@ public static class LegacyVaultRollback*/await context.VaultManifestAccessKeys.Where(x => x.UserId == userId).ExecuteDeleteAsync();await context.UserGrantKeys.Where(x => x.UserId == userId).ExecuteDeleteAsync();+ await context.UserSigningKeys.Where(x => x.UserId == userId).ExecuteDeleteAsync();await context.UserUnlockKeysHistory.Where(x => x.UserId == userId).ExecuteDeleteAsync();await context.UserUnlockKeys.Where(x => x.UserId == userId).ExecuteDeleteAsync();diff --git a/apps/server/Databases/AliasServerDb/Migrations/20261005080213_AddAccountSigningKeys.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20261005080213_AddAccountSigningKeys.Designer.csnew file mode 100644index 000000000..0b600a540--- /dev/null+++ b/apps/server/Databases/AliasServerDb/Migrations/20261005080213_AddAccountSigningKeys.Designer.cs@@ -0,0 +1,2196 @@+// <auto-generated />+using System;+using AliasServerDb;+using Microsoft.EntityFrameworkCore;+using Microsoft.EntityFrameworkCore.Infrastructure;+using Microsoft.EntityFrameworkCore.Migrations;+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;++#nullable disable++namespace AliasServerDb.Migrations+{+ [DbContext(typeof(AliasServerDbContext))]+ [Migration("20261005080213_AddAccountSigningKeys")]+ partial class AddAccountSigningKeys+ {+ /// <inheritdoc />+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder+ .HasAnnotation("ProductVersion", "10.0.10")+ .HasAnnotation("Proxies:ChangeTracking", false)+ .HasAnnotation("Proxies:CheckEquality", false)+ .HasAnnotation("Proxies:LazyLoading", true)+ .HasAnnotation("Relational:MaxIdentifierLength", 63);++ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);++ modelBuilder.Entity("AliasServerDb.AdminUser", b =>+ {+ b.Property<string>("Id")+ .HasColumnType("text");++ b.Property<int>("AccessFailedCount")+ .HasColumnType("integer");++ b.Property<string>("ConcurrencyStamp")+ .HasColumnType("text");++ b.Property<string>("Email")+ .HasColumnType("text");++ b.Property<bool>("EmailConfirmed")+ .HasColumnType("boolean");++ b.Property<DateTime?>("LastPasswordChanged")+ .HasColumnType("timestamp with time zone");++ b.Property<bool>("LockoutEnabled")+ .HasColumnType("boolean");++ b.Property<DateTimeOffset?>("LockoutEnd")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("NormalizedEmail")+ .HasColumnType("text");++ b.Property<string>("NormalizedUserName")+ .HasColumnType("text");++ b.Property<string>("PasswordHash")+ .HasColumnType("text");++ b.Property<string>("PhoneNumber")+ .HasColumnType("text");++ b.Property<bool>("PhoneNumberConfirmed")+ .HasColumnType("boolean");++ b.Property<string>("SecurityStamp")+ .HasColumnType("text");++ b.Property<bool>("TwoFactorEnabled")+ .HasColumnType("boolean");++ b.Property<string>("UserName")+ .HasColumnType("text");++ b.HasKey("Id");++ b.ToTable("AdminUsers");+ });++ modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>+ {+ b.Property<string>("Id")+ .HasColumnType("text");++ b.Property<int>("AccessFailedCount")+ .HasColumnType("integer");++ b.Property<bool>("Blocked")+ .HasColumnType("boolean");++ b.Property<DateTime?>("BlockedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("ConcurrencyStamp")+ .HasColumnType("text");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("Email")+ .HasColumnType("text");++ b.Property<bool>("EmailConfirmed")+ .HasColumnType("boolean");++ b.Property<DateTime?>("LastActivityDate")+ .HasColumnType("timestamp with time zone");++ b.Property<bool>("LockoutEnabled")+ .HasColumnType("boolean");++ b.Property<DateTimeOffset?>("LockoutEnd")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("NormalizedEmail")+ .HasColumnType("text");++ b.Property<string>("NormalizedUserName")+ .HasColumnType("text");++ b.Property<DateTime>("PasswordChangedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("PasswordHash")+ .HasColumnType("text");++ b.Property<Guid>("PersonalGroupId")+ .HasColumnType("uuid");++ b.Property<string>("PhoneNumber")+ .HasColumnType("text");++ b.Property<bool>("PhoneNumberConfirmed")+ .HasColumnType("boolean");++ b.Property<string>("SecurityStamp")+ .HasColumnType("text");++ b.Property<string>("SrpIdentity")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<bool>("TwoFactorEnabled")+ .HasColumnType("boolean");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UserName")+ .HasColumnType("text");++ b.HasKey("Id");++ b.HasIndex("PersonalGroupId")+ .IsUnique()+ .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");++ b.ToTable("AliasVaultUsers");+ });++ modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("DeviceIdentifier")+ .IsRequired()+ .HasColumnType("text");++ b.Property<DateTime>("ExpireDate")+ .HasMaxLength(255)+ .HasColumnType("timestamp with time zone");++ b.Property<string>("IpAddress")+ .HasMaxLength(45)+ .HasColumnType("character varying(45)");++ b.Property<string>("PreviousTokenValue")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("UserId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("Value")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("Id");++ b.HasIndex("UserId");++ b.ToTable("AliasVaultUserRefreshTokens");+ });++ modelBuilder.Entity("AliasServerDb.AuthLog", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("integer");++ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));++ b.Property<string>("AdditionalInfo")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("Browser")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("Client")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("Country")+ .HasMaxLength(50)+ .HasColumnType("character varying(50)");++ b.Property<string>("DeviceType")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<int>("EventType")+ .HasColumnType("integer");++ b.Property<int?>("FailureReason")+ .HasColumnType("integer");++ b.Property<string>("IpAddress")+ .HasMaxLength(50)+ .HasColumnType("character varying(50)");++ b.Property<bool>("IsSuccess")+ .HasColumnType("boolean");++ b.Property<bool>("IsSuspiciousActivity")+ .HasColumnType("boolean");++ b.Property<string>("OperatingSystem")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("RequestPath")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime>("Timestamp")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("Username")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("Id");++ b.HasIndex(new[] { "EventType" }, "IX_EventType");++ b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");++ b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");++ b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")+ .IsDescending(false, false, true);++ b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")+ .IsDescending(false, true);++ b.ToTable("AuthLogs");+ });++ modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("integer");++ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));++ b.Property<bool>("BlockLogin")+ .HasColumnType("boolean");++ b.Property<bool>("BlockRegistration")+ .HasColumnType("boolean");++ b.Property<bool>("BlockShadow")+ .HasColumnType("boolean");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("CreatedBy")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<bool>("Enabled")+ .HasColumnType("boolean");++ b.Property<string>("IpRange")+ .IsRequired()+ .HasMaxLength(50)+ .HasColumnType("character varying(50)");++ b.Property<string>("Reason")+ .HasMaxLength(500)+ .HasColumnType("character varying(500)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.HasKey("Id");++ b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");++ b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")+ .IsUnique();++ b.ToTable("BlockedIpRanges");+ });++ modelBuilder.Entity("AliasServerDb.CapabilityRule", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<string>("CapabilityKey")+ .IsRequired()+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("ClientName")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("CreatedBy")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime?>("EffectiveFrom")+ .HasColumnType("timestamp with time zone");++ b.Property<DateTime?>("EffectiveUntil")+ .HasColumnType("timestamp with time zone");++ b.Property<bool>("Enabled")+ .HasColumnType("boolean");++ b.Property<Guid?>("GroupId")+ .HasColumnType("uuid");++ b.Property<string>("Kind")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.Property<string>("Notes")+ .HasMaxLength(1000)+ .HasColumnType("character varying(1000)");++ b.Property<string>("Tier")+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UserId")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("Value")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("Id");++ b.HasIndex("GroupId");++ b.HasIndex("Tier");++ b.HasIndex("UserId");++ b.HasIndex("CapabilityKey", "Enabled");++ b.ToTable("CapabilityRules");+ });++ modelBuilder.Entity("AliasServerDb.ClientAction", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<Guid?>("ManifestId")+ .HasColumnType("uuid");++ b.Property<string>("Payload")+ .HasColumnType("jsonb");++ b.Property<Guid?>("TargetGroupId")+ .HasColumnType("uuid");++ b.Property<string>("TargetUserId")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("Type")+ .IsRequired()+ .HasMaxLength(50)+ .HasColumnType("character varying(50)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.HasKey("Id");++ b.HasIndex("TargetGroupId");++ b.HasIndex("TargetUserId");++ b.ToTable("ClientActions");+ });++ modelBuilder.Entity("AliasServerDb.Email", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("integer");++ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));++ b.Property<int>("AttachmentCount")+ .HasColumnType("integer");++ b.Property<DateTime>("Date")+ .HasColumnType("timestamp with time zone");++ b.Property<DateTime>("DateSystem")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("From")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("FromDomain")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("FromLocal")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("MessageHtml")+ .HasColumnType("text");++ b.Property<string>("MessagePlain")+ .HasColumnType("text");++ b.Property<string>("MessagePreview")+ .HasColumnType("text");++ b.Property<string>("MessageSource")+ .HasColumnType("text");++ b.Property<byte[]>("MessageSourceBytes")+ .HasColumnType("bytea");++ b.Property<bool>("PushNotificationSent")+ .HasColumnType("boolean");++ b.Property<string>("Subject")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("To")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("ToDomain")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("ToLocal")+ .IsRequired()+ .HasColumnType("text");++ b.Property<bool>("Visible")+ .HasColumnType("boolean");++ b.HasKey("Id");++ b.HasIndex("Date");++ b.HasIndex("DateSystem");++ b.HasIndex("PushNotificationSent");++ b.HasIndex("Visible");++ b.HasIndex("To", "DateSystem");++ b.ToTable("Emails");+ });++ modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("integer");++ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));++ b.Property<byte[]>("Bytes")+ .IsRequired()+ .HasColumnType("bytea");++ b.Property<DateTime>("Date")+ .HasColumnType("timestamp with time zone");++ b.Property<int>("EmailId")+ .HasColumnType("integer");++ b.Property<string>("Filename")+ .IsRequired()+ .HasColumnType("text");++ b.Property<int>("Filesize")+ .HasColumnType("integer");++ b.Property<string>("MimeType")+ .IsRequired()+ .HasColumnType("text");++ b.HasKey("Id");++ b.HasIndex("EmailId");++ b.ToTable("EmailAttachments");+ });++ modelBuilder.Entity("AliasServerDb.EmailClaim", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<string>("Address")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("AddressDomain")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("AddressLocal")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<bool>("AnonymizedSenderCounted")+ .HasColumnType("boolean");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("State")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<Guid?>("VaultManifestId")+ .HasColumnType("uuid");++ b.HasKey("Id");++ b.HasIndex("Address")+ .IsUnique();++ b.HasIndex("VaultManifestId", "CreatedAt");++ b.HasIndex("VaultManifestId", "State");++ b.ToTable("EmailClaims");+ });++ modelBuilder.Entity("AliasServerDb.EmailDecryptionKey", b =>+ {+ b.Property<int>("EmailId")+ .HasColumnType("integer");++ b.Property<Guid>("VaultManifestDeliveryKeyId")+ .HasColumnType("uuid");++ b.Property<string>("EncryptedSymmetricKey")+ .IsRequired()+ .HasColumnType("text");++ b.HasKey("EmailId", "VaultManifestDeliveryKeyId");++ b.HasIndex("VaultManifestDeliveryKeyId", "EmailId");++ b.ToTable("EmailDecryptionKeys");+ });++ modelBuilder.Entity("AliasServerDb.EmailPart", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("integer");++ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));++ b.Property<byte[]>("Bytes")+ .IsRequired()+ .HasColumnType("bytea");++ b.Property<int>("EmailId")+ .HasColumnType("integer");++ b.Property<int>("PartIndex")+ .HasColumnType("integer");++ b.HasKey("Id");++ b.HasIndex("EmailId", "PartIndex")+ .IsUnique();++ b.ToTable("EmailParts");+ });++ modelBuilder.Entity("AliasServerDb.Group", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.PrimitiveCollection<int[]>("AnonymizedEmailAliasSenderCounts")+ .IsRequired()+ .ValueGeneratedOnAdd()+ .HasColumnType("integer[]")+ .HasDefaultValueSql("array_fill(0, ARRAY[64])");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<int>("EmailsReceived")+ .HasColumnType("integer");++ b.Property<int>("MaxEmailAgeDays")+ .HasColumnType("integer");++ b.Property<int>("MaxEmails")+ .HasColumnType("integer");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<bool>("ShadowBlocked")+ .HasColumnType("boolean");++ b.Property<DateTime?>("ShadowBlockedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("Type")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.HasKey("Id");++ b.ToTable("Groups");+ });++ modelBuilder.Entity("AliasServerDb.GroupInvitation", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<string>("Algorithm")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("EncryptedName")+ .HasColumnType("text");++ b.Property<string>("EncryptedVek")+ .HasColumnType("text");++ b.Property<string>("GrantSignature")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("GrantSignerPublicKey")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<Guid>("GroupId")+ .HasColumnType("uuid");++ b.Property<string>("InviteeUserId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("InviterUserId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime?>("RespondedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("Role")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.Property<string>("State")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<Guid?>("UserGrantKeyId")+ .HasColumnType("uuid");++ b.Property<int>("VaultKeyVersion")+ .HasColumnType("integer");++ b.Property<Guid?>("VaultManifestId")+ .HasColumnType("uuid");++ b.HasKey("Id");++ b.HasIndex("GroupId");++ b.HasIndex("InviterUserId");++ b.HasIndex("UserGrantKeyId");++ b.HasIndex("InviteeUserId", "State");++ b.HasIndex("VaultManifestId", "InviteeUserId")+ .IsUnique()+ .HasDatabaseName("UX_GroupInvitations_Manifest_Invitee_Pending")+ .HasFilter("\"State\" = 'Pending'");++ b.ToTable("GroupInvitations");+ });++ modelBuilder.Entity("AliasServerDb.GroupMember", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<Guid>("GroupId")+ .HasColumnType("uuid");++ b.Property<string>("Role")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UserId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("Id");++ b.HasIndex("UserId");++ b.HasIndex("GroupId", "UserId")+ .IsUnique();++ b.ToTable("GroupMembers");+ });++ modelBuilder.Entity("AliasServerDb.Log", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("integer");++ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));++ b.Property<string>("Application")+ .IsRequired()+ .HasMaxLength(50)+ .HasColumnType("character varying(50)");++ b.Property<string>("Exception")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("Level")+ .IsRequired()+ .HasMaxLength(128)+ .HasColumnType("character varying(128)");++ b.Property<string>("LogEvent")+ .IsRequired()+ .HasColumnType("text")+ .HasColumnName("LogEvent");++ b.Property<string>("Message")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("MessageTemplate")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("Properties")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("SourceContext")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime>("TimeStamp")+ .HasColumnType("timestamp with time zone");++ b.HasKey("Id");++ b.HasIndex("Application");++ b.HasIndex("TimeStamp");++ b.ToTable("Logs", (string)null);+ });++ modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>+ {+ b.Property<string>("Id")+ .HasColumnType("text");++ b.Property<string>("Algorithm")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime?>("ClearedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("ClientBrowser")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("ClientIpAddress")+ .HasColumnType("text");++ b.Property<string>("ClientName")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("ClientOperatingSystem")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("ClientPublicKey")+ .IsRequired()+ .HasColumnType("text");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<DateTime?>("DeclinedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("EncryptedAccountKey")+ .HasColumnType("text");++ b.Property<DateTime?>("FulfilledAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("MobileIpAddress")+ .HasColumnType("text");++ b.Property<string>("PollSecretHash")+ .IsRequired()+ .HasMaxLength(44)+ .HasColumnType("character varying(44)");++ b.Property<DateTime?>("RetrievedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UserId")+ .HasColumnType("text");++ b.HasKey("Id");++ b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");++ b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");++ b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");++ b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");++ b.HasIndex(new[] { "UserId" }, "IX_UserId");++ b.ToTable("MobileLoginRequests");+ });++ modelBuilder.Entity("AliasServerDb.RateLimit", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<int?>("AppliesToAccountAgeMaxDays")+ .HasColumnType("integer");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("CreatedBy")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime?>("EffectiveFrom")+ .HasColumnType("timestamp with time zone");++ b.Property<DateTime?>("EffectiveUntil")+ .HasColumnType("timestamp with time zone");++ b.Property<bool>("Enabled")+ .HasColumnType("boolean");++ b.Property<Guid?>("GroupId")+ .HasColumnType("uuid");++ b.Property<int>("LimitType")+ .HasColumnType("integer");++ b.Property<int>("MaxCount")+ .HasColumnType("integer");++ b.Property<string>("Notes")+ .HasMaxLength(1000)+ .HasColumnType("character varying(1000)");++ b.Property<int?>("Tier")+ .HasColumnType("integer");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<int>("WindowSeconds")+ .HasColumnType("integer");++ b.HasKey("Id");++ b.HasIndex("GroupId");++ b.HasIndex("Tier");++ b.HasIndex("LimitType", "Enabled");++ b.ToTable("RateLimits");+ });++ modelBuilder.Entity("AliasServerDb.RegistrationInvite", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<string>("Code")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("character varying(32)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("CreatedBy")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime?>("ExpiresAt")+ .HasColumnType("timestamp with time zone");++ b.Property<DateTime?>("LastUsedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<int>("MaxUses")+ .HasColumnType("integer");++ b.Property<string>("Note")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<int>("UseCount")+ .HasColumnType("integer");++ b.HasKey("Id");++ b.HasIndex(new[] { "Code" }, "IX_RegistrationInvite_Code")+ .IsUnique();++ b.ToTable("RegistrationInvites");+ });++ modelBuilder.Entity("AliasServerDb.ServerSetting", b =>+ {+ b.Property<string>("Key")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("Value")+ .HasColumnType("text");++ b.HasKey("Key");++ b.ToTable("ServerSettings");+ });++ modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("integer");++ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));++ b.Property<TimeOnly?>("EndTime")+ .HasColumnType("time without time zone");++ b.Property<string>("ErrorMessage")+ .HasColumnType("text");++ b.Property<bool>("IsOnDemand")+ .HasColumnType("boolean");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(50)+ .HasColumnType("character varying(50)");++ b.Property<DateTime>("RunDate")+ .HasColumnType("timestamp with time zone");++ b.Property<TimeOnly>("StartTime")+ .HasColumnType("time without time zone");++ b.Property<int>("Status")+ .HasColumnType("integer");++ b.HasKey("Id");++ b.ToTable("TaskRunnerJobs");+ });++ modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<int>("AccountKeyVersion")+ .HasColumnType("integer");++ b.Property<string>("Algorithm")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("EncryptedPrivateKey")+ .IsRequired()+ .HasMaxLength(4000)+ .HasColumnType("character varying(4000)");++ b.Property<bool>("IsPrimary")+ .HasColumnType("boolean");++ b.Property<string>("PublicKey")+ .IsRequired()+ .HasMaxLength(2000)+ .HasColumnType("character varying(2000)");++ b.Property<string>("PublicKeySignature")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UserId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("Id");++ b.HasIndex("UserId")+ .IsUnique()+ .HasDatabaseName("UX_UserGrantKeys_User_Primary")+ .HasFilter("\"IsPrimary\"");++ b.ToTable("UserGrantKeys");+ });++ modelBuilder.Entity("AliasServerDb.UserSigningKey", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<int>("AccountKeyVersion")+ .HasColumnType("integer");++ b.Property<string>("Algorithm")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("EncryptedPrivateKey")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<bool>("IsPrimary")+ .HasColumnType("boolean");++ b.Property<string>("PublicKey")+ .IsRequired()+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UserId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("Id");++ b.HasIndex("UserId")+ .IsUnique()+ .HasDatabaseName("UX_UserSigningKeys_User_Primary")+ .HasFilter("\"IsPrimary\"");++ b.ToTable("UserSigningKeys");+ });++ modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<int>("AccountKeyVersion")+ .HasColumnType("integer");++ b.Property<string>("Algorithm")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("EncryptedAccountKey")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("Label")+ .IsRequired()+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<DateTime?>("LastUsedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("Metadata")+ .HasColumnType("jsonb");++ b.Property<string>("Type")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UserId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("Id");++ b.HasIndex("UserId", "Type", "Label")+ .IsUnique()+ .HasDatabaseName("UX_UserUnlockKeys_UserId_Type_Label");++ b.ToTable("UserUnlockKeys");+ });++ modelBuilder.Entity("AliasServerDb.UserUnlockKeysHistory", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<int>("AccountKeyVersion")+ .HasColumnType("integer");++ b.Property<string>("Algorithm")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime>("ArchivedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("ArchivedByClient")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("EncryptedAccountKey")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("Label")+ .IsRequired()+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("Metadata")+ .HasColumnType("jsonb");++ b.Property<string>("Type")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<Guid>("UnlockKeyId")+ .HasColumnType("uuid");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UserId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("Id");++ b.HasIndex("ArchivedAt")+ .HasDatabaseName("IX_UserUnlockKeysHistory_ArchivedAt");++ b.HasIndex("UserId", "Type", "ArchivedAt")+ .HasDatabaseName("IX_UserUnlockKeysHistory_UserId_Type_ArchivedAt");++ b.ToTable("UserUnlockKeysHistory", (string)null);+ });++ modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>+ {+ b.Property<Guid>("ManifestId")+ .HasColumnType("uuid");++ b.Property<string>("Hash")+ .HasMaxLength(64)+ .HasColumnType("character varying(64)");++ b.Property<string>("Category")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("EncryptedBlobKey")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<byte[]>("EncryptedData")+ .IsRequired()+ .HasColumnType("bytea");++ b.Property<int>("KeyVersion")+ .HasColumnType("integer");++ b.Property<int>("SizeBytes")+ .HasColumnType("integer");++ b.HasKey("ManifestId", "Hash");++ b.ToTable("VaultBlobObjects");+ });++ modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>+ {+ b.Property<Guid>("ManifestId")+ .HasColumnType("uuid");++ b.Property<long>("RevisionNumber")+ .HasColumnType("bigint");++ b.Property<string>("BlobHash")+ .HasMaxLength(64)+ .HasColumnType("character varying(64)");++ b.HasKey("ManifestId", "RevisionNumber", "BlobHash");++ b.ToTable("VaultBlobReferences");+ });++ modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>+ {+ b.Property<Guid>("ManifestId")+ .HasColumnType("uuid");++ b.Property<string>("Category")+ .HasMaxLength(50)+ .HasColumnType("character varying(50)");++ b.Property<string>("CiphertextHash")+ .HasMaxLength(64)+ .HasColumnType("character varying(64)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<byte[]>("EncryptedData")+ .IsRequired()+ .HasColumnType("bytea");++ b.Property<int>("KeyVersion")+ .HasColumnType("integer");++ b.Property<long>("RevisionNumber")+ .HasColumnType("bigint");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.HasKey("ManifestId", "Category");++ b.ToTable("VaultDataBuckets");+ });++ modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>+ {+ b.Property<Guid>("ManifestId")+ .HasColumnType("uuid");++ b.Property<string>("Category")+ .HasMaxLength(50)+ .HasColumnType("character varying(50)");++ b.Property<long>("RevisionNumber")+ .HasColumnType("bigint");++ b.Property<string>("CiphertextHash")+ .HasMaxLength(64)+ .HasColumnType("character varying(64)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<byte[]>("EncryptedData")+ .IsRequired()+ .HasColumnType("bytea");++ b.Property<int>("KeyVersion")+ .HasColumnType("integer");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.HasKey("ManifestId", "Category", "RevisionNumber");++ b.ToTable("VaultDataBucketsHistory");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifest", b =>+ {+ b.Property<Guid>("ManifestId")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<string>("Client")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<int>("CredentialsCount")+ .HasColumnType("integer");++ b.Property<int>("EmailClaimsCount")+ .HasColumnType("integer");++ b.Property<string>("EncryptionSettings")+ .HasColumnType("text");++ b.Property<string>("EncryptionType")+ .HasColumnType("text");++ b.Property<int>("FileSize")+ .HasColumnType("integer");++ b.Property<int>("KeyVersion")+ .HasColumnType("integer");++ b.Property<byte[]>("ManifestBlob")+ .HasColumnType("bytea");++ b.Property<string>("ManifestCiphertextHash")+ .HasMaxLength(64)+ .HasColumnType("character varying(64)");++ b.Property<Guid>("OwnerGroupId")+ .HasColumnType("uuid");++ b.Property<long>("RevisionNumber")+ .HasColumnType("bigint");++ b.Property<string>("Salt")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("StorageFormat")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UpdatedByUserId")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("VaultBlob")+ .HasColumnType("text");++ b.Property<string>("Verifier")+ .HasMaxLength(1000)+ .HasColumnType("character varying(1000)");++ b.Property<string>("Version")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("ManifestId");++ b.HasIndex("OwnerGroupId");++ b.HasIndex("UpdatedByUserId");++ b.ToTable("VaultManifests");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<int?>("AccountKeyVersion")+ .HasColumnType("integer");++ b.Property<string>("Algorithm")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("EncryptedVek")+ .IsRequired()+ .HasColumnType("text");++ b.Property<string>("GrantSignature")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("GrantSignerPublicKey")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("GrantSignerUserId")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<int>("KeyVersion")+ .HasColumnType("integer");++ b.Property<DateTime?>("LastUsedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("Metadata")+ .HasColumnType("jsonb");++ b.Property<string>("Type")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<Guid?>("UserGrantKeyId")+ .HasColumnType("uuid");++ b.Property<string>("UserId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<Guid>("VaultManifestId")+ .HasColumnType("uuid");++ b.HasKey("Id");++ b.HasIndex("UserGrantKeyId");++ b.HasIndex("VaultManifestId")+ .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");++ b.HasIndex("UserId", "Type", "VaultManifestId", "KeyVersion")+ .IsUnique()+ .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest_Version");++ b.ToTable("VaultManifestAccessKeys");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<string>("Algorithm")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<bool>("IsPrimary")+ .HasColumnType("boolean");++ b.Property<string>("PublicKey")+ .IsRequired()+ .HasMaxLength(2000)+ .HasColumnType("character varying(2000)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<Guid>("VaultManifestId")+ .HasColumnType("uuid");++ b.HasKey("Id");++ b.HasIndex("VaultManifestId")+ .IsUnique()+ .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")+ .HasFilter("\"IsPrimary\"");++ b.HasIndex("VaultManifestId", "IsPrimary");++ b.ToTable("VaultManifestDeliveryKeys");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifestShareDetails", b =>+ {+ b.Property<Guid>("ManifestId")+ .HasColumnType("uuid");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("EncryptedName")+ .HasMaxLength(2000)+ .HasColumnType("character varying(2000)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.HasKey("ManifestId");++ b.ToTable("VaultManifestShareDetails");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>+ {+ b.Property<Guid>("ManifestId")+ .HasColumnType("uuid");++ b.Property<long>("RevisionNumber")+ .HasColumnType("bigint");++ b.Property<string>("Client")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<int>("CredentialsCount")+ .HasColumnType("integer");++ b.Property<int>("EmailClaimsCount")+ .HasColumnType("integer");++ b.Property<string>("EncryptionSettings")+ .HasColumnType("text");++ b.Property<string>("EncryptionType")+ .HasColumnType("text");++ b.Property<int>("FileSize")+ .HasColumnType("integer");++ b.Property<int>("KeyVersion")+ .HasColumnType("integer");++ b.Property<byte[]>("ManifestBlob")+ .HasColumnType("bytea");++ b.Property<string>("ManifestCiphertextHash")+ .HasMaxLength(64)+ .HasColumnType("character varying(64)");++ b.Property<string>("Salt")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("StorageFormat")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UpdatedByUserId")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("VaultBlob")+ .HasColumnType("text");++ b.Property<string>("Verifier")+ .HasMaxLength(1000)+ .HasColumnType("character varying(1000)");++ b.Property<string>("Version")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("ManifestId", "RevisionNumber");++ b.HasIndex("UpdatedByUserId");++ b.ToTable("VaultManifestsHistory", (string)null);+ });++ modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("integer");++ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));++ b.Property<string>("CurrentStatus")+ .IsRequired()+ .HasMaxLength(50)+ .HasColumnType("character varying(50)");++ b.Property<DateTime>("Heartbeat")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("ServiceName")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("Id");++ b.ToTable("WorkerServiceStatuses");+ });++ modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("integer");++ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));++ b.Property<string>("FriendlyName")+ .HasColumnType("text");++ b.Property<string>("Xml")+ .HasColumnType("text");++ b.HasKey("Id");++ b.ToTable("DataProtectionKeys");+ });++ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("integer");++ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));++ b.Property<string>("ClaimType")+ .HasColumnType("text");++ b.Property<string>("ClaimValue")+ .HasColumnType("text");++ b.Property<string>("UserId")+ .HasColumnType("text");++ b.HasKey("Id");++ b.ToTable("UserClaims", (string)null);+ });++ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>+ {+ b.Property<string>("UserId")+ .HasColumnType("text");++ b.Property<string>("LoginProvider")+ .HasColumnType("text");++ b.Property<string>("Name")+ .HasColumnType("text");++ b.Property<string>("Value")+ .HasColumnType("text");++ b.HasKey("UserId", "LoginProvider", "Name");++ b.ToTable("UserTokens", (string)null);+ });++ modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>+ {+ b.HasOne("AliasServerDb.Group", "PersonalGroup")+ .WithOne()+ .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")+ .OnDelete(DeleteBehavior.Restrict)+ .IsRequired();++ b.Navigation("PersonalGroup");+ });++ modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>+ {+ b.HasOne("AliasServerDb.AliasVaultUser", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");+ });++ modelBuilder.Entity("AliasServerDb.CapabilityRule", b =>+ {+ b.HasOne("AliasServerDb.Group", "Group")+ .WithMany()+ .HasForeignKey("GroupId")+ .OnDelete(DeleteBehavior.Cascade);++ b.HasOne("AliasServerDb.AliasVaultUser", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade);++ b.Navigation("Group");++ b.Navigation("User");+ });++ modelBuilder.Entity("AliasServerDb.ClientAction", b =>+ {+ b.HasOne("AliasServerDb.Group", "TargetGroup")+ .WithMany()+ .HasForeignKey("TargetGroupId")+ .OnDelete(DeleteBehavior.Cascade);++ b.HasOne("AliasServerDb.AliasVaultUser", "TargetUser")+ .WithMany()+ .HasForeignKey("TargetUserId")+ .OnDelete(DeleteBehavior.Cascade);++ b.Navigation("TargetGroup");++ b.Navigation("TargetUser");+ });++ modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>+ {+ b.HasOne("AliasServerDb.Email", "Email")+ .WithMany("Attachments")+ .HasForeignKey("EmailId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Email");+ });++ modelBuilder.Entity("AliasServerDb.EmailClaim", b =>+ {+ b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")+ .WithMany()+ .HasForeignKey("VaultManifestId")+ .OnDelete(DeleteBehavior.SetNull);++ b.Navigation("VaultManifest");+ });++ modelBuilder.Entity("AliasServerDb.EmailDecryptionKey", b =>+ {+ b.HasOne("AliasServerDb.Email", "Email")+ .WithMany("DecryptionKeys")+ .HasForeignKey("EmailId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "VaultManifestDeliveryKey")+ .WithMany("DecryptionKeys")+ .HasForeignKey("VaultManifestDeliveryKeyId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired()+ .HasConstraintName("FK_EmailDecryptionKeys_VaultManifestDeliveryKeys_DeliveryKeyId");++ b.Navigation("Email");++ b.Navigation("VaultManifestDeliveryKey");+ });++ modelBuilder.Entity("AliasServerDb.EmailPart", b =>+ {+ b.HasOne("AliasServerDb.Email", "Email")+ .WithMany("Parts")+ .HasForeignKey("EmailId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Email");+ });++ modelBuilder.Entity("AliasServerDb.GroupInvitation", b =>+ {+ b.HasOne("AliasServerDb.Group", "Group")+ .WithMany()+ .HasForeignKey("GroupId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("AliasServerDb.AliasVaultUser", "Invitee")+ .WithMany()+ .HasForeignKey("InviteeUserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("AliasServerDb.AliasVaultUser", "Inviter")+ .WithMany()+ .HasForeignKey("InviterUserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")+ .WithMany()+ .HasForeignKey("UserGrantKeyId")+ .OnDelete(DeleteBehavior.SetNull);++ b.Navigation("Group");++ b.Navigation("Invitee");++ b.Navigation("Inviter");++ b.Navigation("UserGrantKey");+ });++ modelBuilder.Entity("AliasServerDb.GroupMember", b =>+ {+ b.HasOne("AliasServerDb.Group", "Group")+ .WithMany("Members")+ .HasForeignKey("GroupId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("AliasServerDb.AliasVaultUser", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Group");++ b.Navigation("User");+ });++ modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>+ {+ b.HasOne("AliasServerDb.AliasVaultUser", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade);++ b.Navigation("User");+ });++ modelBuilder.Entity("AliasServerDb.RateLimit", b =>+ {+ b.HasOne("AliasServerDb.Group", "Group")+ .WithMany()+ .HasForeignKey("GroupId")+ .OnDelete(DeleteBehavior.Cascade);++ b.Navigation("Group");+ });++ modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>+ {+ b.HasOne("AliasServerDb.AliasVaultUser", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");+ });++ modelBuilder.Entity("AliasServerDb.UserSigningKey", b =>+ {+ b.HasOne("AliasServerDb.AliasVaultUser", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");+ });++ modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>+ {+ b.HasOne("AliasServerDb.AliasVaultUser", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");+ });++ modelBuilder.Entity("AliasServerDb.UserUnlockKeysHistory", b =>+ {+ b.HasOne("AliasServerDb.AliasVaultUser", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");+ });++ modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>+ {+ b.HasOne("AliasServerDb.VaultManifest", "Manifest")+ .WithMany()+ .HasForeignKey("ManifestId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Manifest");+ });++ modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>+ {+ b.HasOne("AliasServerDb.VaultManifest", "Manifest")+ .WithMany()+ .HasForeignKey("ManifestId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Manifest");+ });++ modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>+ {+ b.HasOne("AliasServerDb.VaultManifest", "Manifest")+ .WithMany()+ .HasForeignKey("ManifestId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Manifest");+ });++ modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>+ {+ b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")+ .WithMany()+ .HasForeignKey("ManifestId", "Category")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Bucket");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifest", b =>+ {+ b.HasOne("AliasServerDb.Group", "OwnerGroup")+ .WithMany()+ .HasForeignKey("OwnerGroupId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")+ .WithMany()+ .HasForeignKey("UpdatedByUserId")+ .OnDelete(DeleteBehavior.SetNull);++ b.Navigation("OwnerGroup");++ b.Navigation("UpdatedByUser");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>+ {+ b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")+ .WithMany()+ .HasForeignKey("UserGrantKeyId")+ .OnDelete(DeleteBehavior.SetNull);++ b.HasOne("AliasServerDb.AliasVaultUser", "User")+ .WithMany("VaultManifestAccessKeys")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");++ b.Navigation("UserGrantKey");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>+ {+ b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")+ .WithMany()+ .HasForeignKey("VaultManifestId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("VaultManifest");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifestShareDetails", b =>+ {+ b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")+ .WithOne()+ .HasForeignKey("AliasServerDb.VaultManifestShareDetails", "ManifestId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("VaultManifest");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>+ {+ b.HasOne("AliasServerDb.VaultManifest", "Manifest")+ .WithMany()+ .HasForeignKey("ManifestId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")+ .WithMany()+ .HasForeignKey("UpdatedByUserId")+ .OnDelete(DeleteBehavior.SetNull);++ b.Navigation("Manifest");++ b.Navigation("UpdatedByUser");+ });++ modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>+ {+ b.Navigation("VaultManifestAccessKeys");+ });++ modelBuilder.Entity("AliasServerDb.Email", b =>+ {+ b.Navigation("Attachments");++ b.Navigation("DecryptionKeys");++ b.Navigation("Parts");+ });++ modelBuilder.Entity("AliasServerDb.Group", b =>+ {+ b.Navigation("Members");+ });++ modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>+ {+ b.Navigation("DecryptionKeys");+ });+#pragma warning restore 612, 618+ }+ }+}diff --git a/apps/server/Databases/AliasServerDb/Migrations/20261005080213_AddAccountSigningKeys.cs b/apps/server/Databases/AliasServerDb/Migrations/20261005080213_AddAccountSigningKeys.csnew file mode 100644index 000000000..997450a52--- /dev/null+++ b/apps/server/Databases/AliasServerDb/Migrations/20261005080213_AddAccountSigningKeys.cs@@ -0,0 +1,121 @@+using System;+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace AliasServerDb.Migrations+{+ /// <inheritdoc />+ public partial class AddAccountSigningKeys : Migration+ {+ /// <inheritdoc />+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.AddColumn<string>(+ name: "GrantSignature",+ table: "VaultManifestAccessKeys",+ type: "character varying(255)",+ maxLength: 255,+ nullable: true);++ migrationBuilder.AddColumn<string>(+ name: "GrantSignerPublicKey",+ table: "VaultManifestAccessKeys",+ type: "character varying(100)",+ maxLength: 100,+ nullable: true);++ migrationBuilder.AddColumn<string>(+ name: "GrantSignerUserId",+ table: "VaultManifestAccessKeys",+ type: "character varying(255)",+ maxLength: 255,+ nullable: true);++ migrationBuilder.AddColumn<string>(+ name: "PublicKeySignature",+ table: "UserGrantKeys",+ type: "character varying(255)",+ maxLength: 255,+ nullable: false,+ defaultValue: "");++ migrationBuilder.AddColumn<string>(+ name: "GrantSignature",+ table: "GroupInvitations",+ type: "character varying(255)",+ maxLength: 255,+ nullable: true);++ migrationBuilder.AddColumn<string>(+ name: "GrantSignerPublicKey",+ table: "GroupInvitations",+ type: "character varying(100)",+ maxLength: 100,+ nullable: true);++ migrationBuilder.CreateTable(+ name: "UserSigningKeys",+ columns: table => new+ {+ Id = table.Column<Guid>(type: "uuid", nullable: false),+ UserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),+ Algorithm = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),+ PublicKey = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),+ EncryptedPrivateKey = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),+ IsPrimary = table.Column<bool>(type: "boolean", nullable: false),+ AccountKeyVersion = table.Column<int>(type: "integer", nullable: false),+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_UserSigningKeys", x => x.Id);+ table.ForeignKey(+ name: "FK_UserSigningKeys_AliasVaultUsers_UserId",+ column: x => x.UserId,+ principalTable: "AliasVaultUsers",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ migrationBuilder.CreateIndex(+ name: "UX_UserSigningKeys_User_Primary",+ table: "UserSigningKeys",+ column: "UserId",+ unique: true,+ filter: "\"IsPrimary\"");+ }++ /// <inheritdoc />+ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropTable(+ name: "UserSigningKeys");++ migrationBuilder.DropColumn(+ name: "GrantSignature",+ table: "VaultManifestAccessKeys");++ migrationBuilder.DropColumn(+ name: "GrantSignerPublicKey",+ table: "VaultManifestAccessKeys");++ migrationBuilder.DropColumn(+ name: "GrantSignerUserId",+ table: "VaultManifestAccessKeys");++ migrationBuilder.DropColumn(+ name: "PublicKeySignature",+ table: "UserGrantKeys");++ migrationBuilder.DropColumn(+ name: "GrantSignature",+ table: "GroupInvitations");++ migrationBuilder.DropColumn(+ name: "GrantSignerPublicKey",+ table: "GroupInvitations");+ }+ }+}diff --git a/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.csindex 03bcc55fc..9f7482453 100644--- a/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs+++ b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs@@ -720,6 +720,14 @@ namespace AliasServerDb.Migrationsb.Property<string>("EncryptedVek").HasColumnType("text");+ b.Property<string>("GrantSignature")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("GrantSignerPublicKey")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");+b.Property<Guid>("GroupId").HasColumnType("uuid");@@ -1126,6 +1134,11 @@ namespace AliasServerDb.Migrations.HasMaxLength(2000).HasColumnType("character varying(2000)");+ b.Property<string>("PublicKeySignature")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");+b.Property<DateTime>("UpdatedAt").HasColumnType("timestamp with time zone");@@ -1144,6 +1157,54 @@ namespace AliasServerDb.Migrationsb.ToTable("UserGrantKeys");});+ modelBuilder.Entity("AliasServerDb.UserSigningKey", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("uuid");++ b.Property<int>("AccountKeyVersion")+ .HasColumnType("integer");++ b.Property<string>("Algorithm")+ .IsRequired()+ .HasMaxLength(30)+ .HasColumnType("character varying(30)");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("EncryptedPrivateKey")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<bool>("IsPrimary")+ .HasColumnType("boolean");++ b.Property<string>("PublicKey")+ .IsRequired()+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("timestamp with time zone");++ b.Property<string>("UserId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.HasKey("Id");++ b.HasIndex("UserId")+ .IsUnique()+ .HasDatabaseName("UX_UserSigningKeys_User_Primary")+ .HasFilter("\"IsPrimary\"");++ b.ToTable("UserSigningKeys");+ });+modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>{b.Property<Guid>("Id")@@ -1484,6 +1545,18 @@ namespace AliasServerDb.Migrations.IsRequired().HasColumnType("text");+ b.Property<string>("GrantSignature")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");++ b.Property<string>("GrantSignerPublicKey")+ .HasMaxLength(100)+ .HasColumnType("character varying(100)");++ b.Property<string>("GrantSignerUserId")+ .HasMaxLength(255)+ .HasColumnType("character varying(255)");+b.Property<int>("KeyVersion").HasColumnType("integer");@@ -1938,6 +2011,17 @@ namespace AliasServerDb.Migrationsb.Navigation("User");});+ modelBuilder.Entity("AliasServerDb.UserSigningKey", b =>+ {+ b.HasOne("AliasServerDb.AliasVaultUser", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");+ });+modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>{b.HasOne("AliasServerDb.AliasVaultUser", "User")diff --git a/apps/server/Databases/AliasServerDb/UserGrantKey.cs b/apps/server/Databases/AliasServerDb/UserGrantKey.csindex b38a9353d..4e4fe3c0b 100644--- a/apps/server/Databases/AliasServerDb/UserGrantKey.cs+++ b/apps/server/Databases/AliasServerDb/UserGrantKey.cs@@ -53,6 +53,12 @@ public class UserGrantKey[StringLength(4000)]public required string EncryptedPrivateKey { get; set; }+ /// <summary>+ /// Gets or sets the user's signature over <see cref="PublicKey"/>, made with their primary <see cref="UserSigningKey"/>.+ /// </summary>+ [StringLength(255)]+ public required string PublicKeySignature { get; set; }+/// <summary>/// Gets or sets a value indicating whether this is the user's active keypair./// </summary>diff --git a/apps/server/Databases/AliasServerDb/UserSigningKey.cs b/apps/server/Databases/AliasServerDb/UserSigningKey.csnew file mode 100644index 000000000..be346a267--- /dev/null+++ b/apps/server/Databases/AliasServerDb/UserSigningKey.cs@@ -0,0 +1,75 @@+//-----------------------------------------------------------------------+// <copyright file="UserSigningKey.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 AliasServerDb;++using System.ComponentModel.DataAnnotations;+using System.ComponentModel.DataAnnotations.Schema;+using AliasVault.Shared.Models.Enums;++/// <summary>+/// A user's account signing keypair: other clients check what this user published (their grant key, grants they+/// create) against its public key. The private half is stored encrypted by the Account Key.+/// </summary>+public class UserSigningKey+{+ /// <summary>+ /// Gets or sets the primary key.+ /// </summary>+ [Key]+ public Guid Id { get; set; }++ /// <summary>+ /// Gets or sets the foreign key to the user this keypair belongs to.+ /// </summary>+ [StringLength(255)]+ public required string UserId { get; set; }++ /// <summary>+ /// Gets or sets the user object.+ /// </summary>+ [ForeignKey("UserId")]+ public virtual AliasVaultUser User { get; set; } = null!;++ /// <summary>+ /// Gets or sets the signature algorithm of this keypair.+ /// </summary>+ [StringLength(30)]+ public required SigningKeyAlgorithm Algorithm { get; set; }++ /// <summary>+ /// Gets or sets the public half (base64).+ /// </summary>+ [StringLength(100)]+ public required string PublicKey { get; set; }++ /// <summary>+ /// Gets or sets the private half, encrypted by the user's Account Key.+ /// </summary>+ [StringLength(255)]+ public required string EncryptedPrivateKey { get; set; }++ /// <summary>+ /// Gets or sets a value indicating whether this is the user's active signing keypair.+ /// </summary>+ public bool IsPrimary { get; set; }++ /// <summary>+ /// Gets or sets the version of the user's Account Key that <see cref="EncryptedPrivateKey"/> is encrypted with;+ /// see <see cref="UserUnlockKey.AccountKeyVersion"/>.+ /// </summary>+ public int AccountKeyVersion { get; set; }++ /// <summary>+ /// Gets or sets the timestamp at which this keypair was created.+ /// </summary>+ public DateTime CreatedAt { get; set; }++ /// <summary>+ /// Gets or sets the timestamp at which this keypair was last updated.+ /// </summary>+ public DateTime UpdatedAt { get; set; }+}diff --git a/apps/server/Databases/AliasServerDb/VaultManifestAccessKey.cs b/apps/server/Databases/AliasServerDb/VaultManifestAccessKey.csindex cc612af8b..6a13c241f 100644--- a/apps/server/Databases/AliasServerDb/VaultManifestAccessKey.cs+++ b/apps/server/Databases/AliasServerDb/VaultManifestAccessKey.cs@@ -77,6 +77,27 @@ public class VaultManifestAccessKey/// </summary>public virtual UserGrantKey? UserGrantKey { get; set; }+ /// <summary>+ /// Gets or sets the signature over this grant by the user who handed it out. Grant rows only: an account-key row is+ /// encrypted with the user's own Account Key, which nobody else can do.+ /// </summary>+ [StringLength(255)]+ public string? GrantSignature { get; set; }++ /// <summary>+ /// Gets or sets the id of the user who signed this grant (grant rows only). Not a foreign key: the grant stays+ /// verifiable after its signer deletes their account.+ /// </summary>+ [StringLength(255)]+ public string? GrantSignerUserId { get; set; }++ /// <summary>+ /// Gets or sets the signing public key <see cref="GrantSignature"/> verifies under (grant rows only), kept on the row+ /// for the same reason as <see cref="GrantSignerUserId"/>.+ /// </summary>+ [StringLength(100)]+ public string? GrantSignerPublicKey { get; set; }+/// <summary>/// Gets or sets optional per-key-type fields as JSON, e.g. SRP salt and verifier, KDF parameters etc. Read and written/// through <see cref="VaultKeyMetadata"/>.diff --git a/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs b/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.csindex 3e7906adf..ca8cdf570 100644--- a/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs@@ -292,4 +292,9 @@ public enum ApiErrorCode/// The email address is already in use by another account./// </summary>CLAIM_TAKEN,++ /// <summary>+ /// A required signature is missing or does not verify under the caller's signing key.+ /// </summary>+ SIGNATURE_INVALID,}diff --git a/apps/server/Shared/AliasVault.Shared/Models/Enums/SigningKeyAlgorithm.cs b/apps/server/Shared/AliasVault.Shared/Models/Enums/SigningKeyAlgorithm.csnew file mode 100644index 000000000..0f57f1fb0--- /dev/null+++ b/apps/server/Shared/AliasVault.Shared/Models/Enums/SigningKeyAlgorithm.cs@@ -0,0 +1,70 @@+// <auto-generated />+// This file is auto-generated from core/models/scripts/generate-key-vocabulary.cjs.+// Do not edit this file directly. Run 'core/models/build.sh' (or 'node core/models/scripts/generate-key-vocabulary.cjs') to regenerate.++#nullable enable++namespace AliasVault.Shared.Models.Enums;++/// <summary>+/// The algorithms an account signing keypair can sign with.+/// The token is the only persisted and transmitted identifier; the ordinals below are cosmetic.+/// </summary>+public enum SigningKeyAlgorithm+{+ /// <summary>+ /// Ed25519 (RFC 8032), verified strictly.+ /// </summary>+ Ed25519 = 0,+}++/// <summary>+/// Token conversions for <see cref="SigningKeyAlgorithm"/>.+/// </summary>+public static class SigningKeyAlgorithms+{+ /// <summary>+ /// Returns the wire/storage token for a SigningKeyAlgorithm.+ /// </summary>+ /// <param name="type">The SigningKeyAlgorithm to convert.</param>+ /// <returns>The token.</returns>+ public static string ToToken(SigningKeyAlgorithm type) => type switch+ {+ SigningKeyAlgorithm.Ed25519 => "ed25519",+ _ => throw new ArgumentOutOfRangeException(nameof(type), type, "Unknown SigningKeyAlgorithm."),+ };++ /// <summary>+ /// Parses a token.+ /// </summary>+ /// <param name="token">The token to parse.</param>+ /// <param name="type">The parsed SigningKeyAlgorithm.</param>+ /// <returns>True when the token names a SigningKeyAlgorithm this build supports.</returns>+ public static bool TryParse(string? token, out SigningKeyAlgorithm type)+ {+ switch (token)+ {+ case "ed25519":+ type = SigningKeyAlgorithm.Ed25519;+ return true;+ default:+ type = default;+ return false;+ }+ }++ /// <summary>+ /// Parses a token and returns the SigningKeyAlgorithm.+ /// </summary>+ /// <param name="token">The token to parse.</param>+ /// <returns>The parsed SigningKeyAlgorithm.</returns>+ public static SigningKeyAlgorithm Parse(string? token)+ {+ if (!TryParse(token, out var type))+ {+ throw new ArgumentOutOfRangeException(nameof(token), token, "Unknown SigningKeyAlgorithm token.");+ }++ return type;+ }+}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Auth/RegisterRequest.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Auth/RegisterRequest.csindex 00d85f58c..9c3f7e45d 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Auth/RegisterRequest.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Auth/RegisterRequest.cs@@ -26,8 +26,11 @@ public class RegisterRequest/// <param name="encryptedAccountKey">The KEK encrypted Account Key.</param>/// <param name="accountPublicKey">The account public key.</param>/// <param name="encryptedAccountPrivateKey">The AK encrypted account private key.</param>+ /// <param name="signingPublicKey">The account signing public key.</param>+ /// <param name="encryptedSigningPrivateKey">The AK encrypted account signing private key.</param>+ /// <param name="accountPublicKeySignature">The signing key's signature over the account public key.</param>/// <param name="srpIdentity">The SRP identity.</param>- public RegisterRequest(string username, string salt, string verifier, string encryptionType, string encryptionSettings, string encryptedVek, string encryptedAccountKey, string accountPublicKey, string encryptedAccountPrivateKey, string srpIdentity)+ public RegisterRequest(string username, string salt, string verifier, string encryptionType, string encryptionSettings, string encryptedVek, string encryptedAccountKey, string accountPublicKey, string encryptedAccountPrivateKey, string signingPublicKey, string encryptedSigningPrivateKey, string accountPublicKeySignature, string srpIdentity){Username = username.ToLowerInvariant().Trim();Salt = salt;@@ -39,6 +42,9 @@ public class RegisterRequestEncryptedAccountKey = encryptedAccountKey;AccountPublicKey = accountPublicKey;EncryptedAccountPrivateKey = encryptedAccountPrivateKey;+ SigningPublicKey = signingPublicKey;+ EncryptedSigningPrivateKey = encryptedSigningPrivateKey;+ AccountPublicKeySignature = accountPublicKeySignature;}/// <summary>@@ -91,6 +97,21 @@ public class RegisterRequest/// </summary>public string? EncryptedAccountPrivateKey { get; }+ /// <summary>+ /// Gets the account signing public key.+ /// </summary>+ public string? SigningPublicKey { get; }++ /// <summary>+ /// Gets the account signing private key encrypted with the Account Key.+ /// </summary>+ public string? EncryptedSigningPrivateKey { get; }++ /// <summary>+ /// Gets the signing key's signature over <see cref="AccountPublicKey"/>.+ /// </summary>+ public string? AccountPublicKeySignature { get; }+/// <summary>/// Gets the registration invite code, required when public registration is disabled./// </summary>@@ -99,10 +120,12 @@ public class RegisterRequest/// <summary>/// Gets a value indicating whether the client sent the complete account key hierarchy. A partial one is not usable./// </summary>- public bool HasCompleteAccountKeys => !string.IsNullOrEmpty(EncryptedVek) && !string.IsNullOrEmpty(EncryptedAccountKey) && !string.IsNullOrEmpty(AccountPublicKey) && !string.IsNullOrEmpty(EncryptedAccountPrivateKey);+ public bool HasCompleteAccountKeys => !string.IsNullOrEmpty(EncryptedVek) && !string.IsNullOrEmpty(EncryptedAccountKey) && !string.IsNullOrEmpty(AccountPublicKey) && !string.IsNullOrEmpty(EncryptedAccountPrivateKey)+ && !string.IsNullOrEmpty(SigningPublicKey) && !string.IsNullOrEmpty(EncryptedSigningPrivateKey) && !string.IsNullOrEmpty(AccountPublicKeySignature);/// <summary>/// Gets a value indicating whether every account key fits its storage column, so an oversized value is a validation error instead of a half-created account./// </summary>- public bool AccountKeysFitStorageLimits => (EncryptedVek?.Length ?? 0) <= AccountKeysUpload.MaxWrappedKeyLength && (EncryptedAccountKey?.Length ?? 0) <= AccountKeysUpload.MaxWrappedKeyLength && (AccountPublicKey?.Length ?? 0) <= AccountKeysUpload.MaxPublicKeyLength && (EncryptedAccountPrivateKey?.Length ?? 0) <= AccountKeysUpload.MaxEncryptedPrivateKeyLength;+ public bool AccountKeysFitStorageLimits => (EncryptedVek?.Length ?? 0) <= AccountKeysUpload.MaxWrappedKeyLength && (EncryptedAccountKey?.Length ?? 0) <= AccountKeysUpload.MaxWrappedKeyLength && (AccountPublicKey?.Length ?? 0) <= AccountKeysUpload.MaxPublicKeyLength && (EncryptedAccountPrivateKey?.Length ?? 0) <= AccountKeysUpload.MaxEncryptedPrivateKeyLength+ && (SigningPublicKey?.Length ?? 0) <= AccountKeysUpload.MaxSigningPublicKeyLength && (EncryptedSigningPrivateKey?.Length ?? 0) <= AccountKeysUpload.MaxSigningValueLength && (AccountPublicKeySignature?.Length ?? 0) <= AccountKeysUpload.MaxSigningValueLength;}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Auth/VaultKeyResponse.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Auth/VaultKeyResponse.csindex 50a62c49f..efdc2d3fc 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Auth/VaultKeyResponse.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Auth/VaultKeyResponse.cs@@ -24,6 +24,12 @@ public class VaultKeyResponse/// <summary>Gets or sets the account public key.</summary>public string? AccountPublicKey { get; set; }+ /// <summary>Gets or sets the account signing public key.</summary>+ public string? SigningPublicKey { get; set; }++ /// <summary>Gets or sets the account signing private key encrypted with the Account Key.</summary>+ public string? EncryptedSigningPrivateKey { get; set; }+/// <summary>/// Gets or sets the encrypted VEK./// </summary>diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/CreateSharedManifestRequest.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/CreateSharedManifestRequest.csindex a60693e07..5ed1d08e5 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/CreateSharedManifestRequest.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/CreateSharedManifestRequest.cs@@ -28,6 +28,10 @@ public class CreateSharedManifestRequest/// <summary>Gets or sets the asymmetric algorithm the caller's own grant was encrypted with.</summary>public required string Algorithm { get; set; }+ /// <summary>Gets or sets the caller's signature over their own grant.</summary>+ [StringLength(255)]+ public required string SelfGrantSignature { get; set; }+/// <summary>Gets or sets the name of the manifest, encrypted with the manifest's own key (base64).</summary>[StringLength(2000)]public string? EncryptedName { get; set; }diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupMemberInfo.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupMemberInfo.csindex 12c6c0916..e966d4fa0 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupMemberInfo.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupMemberInfo.cs@@ -26,4 +26,10 @@ public class GroupMemberInfo/// <summary>Gets or sets that public key itself (JWK).</summary>public string? PublicKey { get; set; }++ /// <summary>Gets or sets the member's signature over <see cref="PublicKey"/>.</summary>+ public string? PublicKeySignature { get; set; }++ /// <summary>Gets or sets the member's signing public key, which <see cref="PublicKeySignature"/> verifies under.</summary>+ public string? SigningPublicKey { get; set; }}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/ManifestGrant.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/ManifestGrant.csindex 06e63accc..70352ceb1 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/ManifestGrant.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/ManifestGrant.cs@@ -7,6 +7,8 @@namespace AliasVault.Shared.Models.WebApi.V2.Groups;+using System.ComponentModel.DataAnnotations;+/// <summary>/// One recipient's access to a shared manifest: the manifest's VEK encrypted with a public key of theirs./// </summary>@@ -23,4 +25,8 @@ public class ManifestGrant/// <summary>Gets or sets the vault's name encrypted with the same public key, null when the client encrypted none.</summary>public string? EncryptedName { get; set; }++ /// <summary>Gets or sets the caller's signature over the grant.</summary>+ [StringLength(255)]+ public required string Signature { get; set; }}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SharedManifestInfo.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SharedManifestInfo.csindex 39dcd4de0..ad1b454b9 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SharedManifestInfo.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SharedManifestInfo.cs@@ -16,6 +16,9 @@ public class SharedManifestInfo/// <summary>Gets or sets the manifest id.</summary>public required Guid ManifestId { get; set; }+ /// <summary>Gets or sets the version of the manifest's VEK, which a grant on it is signed for.</summary>+ public int KeyVersion { get; set; }+/// <summary>Gets or sets the members holding a grant on this manifest, i.e. the ones who can open it.</summary>public List<string> MemberUserIds { get; set; } = [];diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/AccountKeysUpload.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/AccountKeysUpload.csindex f25b8a3a3..d507f7ede 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/AccountKeysUpload.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/AccountKeysUpload.cs@@ -22,6 +22,12 @@ public class AccountKeysUpload/// <summary>Maximum accepted length of <see cref="EncryptedAccountPrivateKey"/>.</summary>public const int MaxEncryptedPrivateKeyLength = 4000;+ /// <summary>Maximum accepted length of <see cref="SigningPublicKey"/>.</summary>+ public const int MaxSigningPublicKeyLength = 100;++ /// <summary>Maximum accepted length of <see cref="EncryptedSigningPrivateKey"/> and <see cref="AccountPublicKeySignature"/>.</summary>+ public const int MaxSigningValueLength = 255;+/// <summary>Gets or sets the Account Key encrypted with the KEK derived from the unlock method.</summary>public string? EncryptedAccountKey { get; set; }@@ -34,13 +40,24 @@ public class AccountKeysUpload/// <summary>Gets or sets the account private key encrypted with the Account Key.</summary>public string? EncryptedAccountPrivateKey { get; set; }+ /// <summary>Gets or sets the public half (base64) of the account signing keypair.</summary>+ public string? SigningPublicKey { get; set; }++ /// <summary>Gets or sets the account signing private key encrypted with the Account Key.</summary>+ public string? EncryptedSigningPrivateKey { get; set; }++ /// <summary>Gets or sets the signing key's signature over <see cref="AccountPublicKey"/>.</summary>+ public string? AccountPublicKeySignature { get; set; }+/// <summary>- /// Gets a value indicating whether all four fields are present. A partial upload is not usable.+ /// Gets a value indicating whether every field is present. A partial upload is not usable./// </summary>- public bool IsComplete => !string.IsNullOrEmpty(EncryptedAccountKey) && !string.IsNullOrEmpty(EncryptedVek) && !string.IsNullOrEmpty(AccountPublicKey) && !string.IsNullOrEmpty(EncryptedAccountPrivateKey);+ public bool IsComplete => !string.IsNullOrEmpty(EncryptedAccountKey) && !string.IsNullOrEmpty(EncryptedVek) && !string.IsNullOrEmpty(AccountPublicKey) && !string.IsNullOrEmpty(EncryptedAccountPrivateKey)+ && !string.IsNullOrEmpty(SigningPublicKey) && !string.IsNullOrEmpty(EncryptedSigningPrivateKey) && !string.IsNullOrEmpty(AccountPublicKeySignature);/// <summary>/// Gets a value indicating whether every field fits its storage column, so an oversized value is a validation error instead of a database exception./// </summary>- public bool FitsStorageLimits => (EncryptedAccountKey?.Length ?? 0) <= MaxWrappedKeyLength && (EncryptedVek?.Length ?? 0) <= MaxWrappedKeyLength && (AccountPublicKey?.Length ?? 0) <= MaxPublicKeyLength && (EncryptedAccountPrivateKey?.Length ?? 0) <= MaxEncryptedPrivateKeyLength;+ public bool FitsStorageLimits => (EncryptedAccountKey?.Length ?? 0) <= MaxWrappedKeyLength && (EncryptedVek?.Length ?? 0) <= MaxWrappedKeyLength && (AccountPublicKey?.Length ?? 0) <= MaxPublicKeyLength && (EncryptedAccountPrivateKey?.Length ?? 0) <= MaxEncryptedPrivateKeyLength+ && (SigningPublicKey?.Length ?? 0) <= MaxSigningPublicKeyLength && (EncryptedSigningPrivateKey?.Length ?? 0) <= MaxSigningValueLength && (AccountPublicKeySignature?.Length ?? 0) <= MaxSigningValueLength;}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/Manifest.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/Manifest.csindex b373472b5..7a1c5a605 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/Manifest.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/Manifest.cs@@ -54,4 +54,16 @@ public class Manifest/// Gets or sets the public key <see cref="EncryptedVek"/> was encrypted with./// </summary>public string? EncryptionPublicKey { get; set; }++ /// <summary>Gets or sets the granter's signature over the grant in <see cref="EncryptedVek"/>.</summary>+ public string? GrantSignature { get; set; }++ /// <summary>Gets or sets the id of the user who signed the grant.</summary>+ public string? GrantSignerUserId { get; set; }++ /// <summary>Gets or sets the granter's signing public key that <see cref="GrantSignature"/> verifies under.</summary>+ public string? GrantSignerPublicKey { get; set; }++ /// <summary>Gets or sets the version of the VEK in <see cref="EncryptedVek"/>, which the grant is signed for.</summary>+ public int KeyVersion { get; set; }}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/ManifestWrite.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/ManifestWrite.csindex e3b325598..79fceb451 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/ManifestWrite.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/ManifestWrite.cs@@ -7,6 +7,8 @@namespace AliasVault.Shared.Models.WebApi.V2.Vault;+using System.ComponentModel.DataAnnotations;+/// <summary>/// A single manifest to write within a <see cref="VaultWriteRequest"/> batch./// </summary>@@ -35,4 +37,10 @@ public class ManifestWrite/// Gets or sets the public half of this manifest's active RSA key pair (used to e.g. encrypt incoming emails)./// </summary>public string? EncryptionPublicKey { get; set; }++ /// <summary>+ /// Gets or sets the caller's signature over <see cref="EncryptionPublicKey"/>, required when it changes the manifest's primary key.+ /// </summary>+ [StringLength(255)]+ public string? EncryptionPublicKeySignature { get; set; }}diff --git a/apps/server/Utilities/AliasVault.Cryptography/AliasVault.Cryptography.csproj b/apps/server/Utilities/AliasVault.Cryptography/AliasVault.Cryptography.csprojindex 828b4479f..afb331c96 100644--- a/apps/server/Utilities/AliasVault.Cryptography/AliasVault.Cryptography.csproj+++ b/apps/server/Utilities/AliasVault.Cryptography/AliasVault.Cryptography.csproj@@ -22,6 +22,7 @@</ItemGroup><ItemGroup>+ <PackageReference Include="BouncyCastle.Cryptography" Version="2.6.2" /><PackageReference Include="srp" Version="1.0.7" /><PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"><PrivateAssets>all</PrivateAssets>diff --git a/apps/server/Utilities/AliasVault.Cryptography/Signing.cs b/apps/server/Utilities/AliasVault.Cryptography/Signing.csnew file mode 100644index 000000000..d484b0094--- /dev/null+++ b/apps/server/Utilities/AliasVault.Cryptography/Signing.cs@@ -0,0 +1,145 @@+//-----------------------------------------------------------------------+// <copyright file="Signing.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.Cryptography;++using System.Buffers.Binary;+using System.Text;+using Org.BouncyCastle.Math.EC.Rfc8032;++/// <summary>+/// Verifies Ed25519 signatures made by account signing keys. Clients sign in the Rust core+/// (<c>core/rust/src/crypto/signing.rs</c>); the message encoding and the labels here must match it byte for byte.+/// </summary>+public static class Signing+{+ /// <summary>+ /// The label of a user's signature over their own account encryption public key.+ /// </summary>+ public const string AccountPublicKeyLabel = "aliasvault/v1/sig/account-public-key";++ /// <summary>+ /// The label of a grant: a manifest's VEK encrypted for one recipient key, signed by whoever handed it out.+ /// </summary>+ public const string GrantLabel = "aliasvault/v1/sig/grant";++ /// <summary>+ /// The label of a manifest's mail delivery public key, signed by whoever published it.+ /// </summary>+ public const string DeliveryKeyLabel = "aliasvault/v1/sig/delivery-key";++ /// <summary>+ /// Builds the bytes a signature covers: the label and each field, each prefixed with its length as a big-endian uint.+ /// </summary>+ /// <param name="label">The purpose label.</param>+ /// <param name="fields">The signed fields.</param>+ /// <returns>The message bytes.</returns>+ public static byte[] SignedMessage(string label, params byte[][] fields)+ {+ var parts = new[] { Encoding.UTF8.GetBytes(label) }.Concat(fields).ToList();+ var message = new byte[parts.Sum(p => 4 + p.Length)];+ var offset = 0;+ foreach (var part in parts)+ {+ BinaryPrimitives.WriteUInt32BigEndian(message.AsSpan(offset), (uint)part.Length);+ part.CopyTo(message, offset + 4);+ offset += 4 + part.Length;+ }++ return message;+ }++ /// <summary>+ /// Builds the signed message of a grant.+ /// </summary>+ /// <param name="manifestId">The manifest the VEK belongs to.</param>+ /// <param name="keyVersion">The version of the manifest's VEK.</param>+ /// <param name="signerUserId">The user who hands out the grant.</param>+ /// <param name="recipientPublicKey">The recipient public key (JWK) the VEK is encrypted for, as stored.</param>+ /// <param name="algorithm">The algorithm token of the encryption.</param>+ /// <param name="encryptedVek">The encrypted VEK.</param>+ /// <returns>The message bytes.</returns>+ public static byte[] GrantMessage(Guid manifestId, int keyVersion, string signerUserId, string recipientPublicKey, string algorithm, string encryptedVek)+ {+ return SignedMessage(GrantLabel, Utf8(manifestId.ToString()), Utf8(keyVersion.ToString(System.Globalization.CultureInfo.InvariantCulture)), Utf8(signerUserId), Utf8(recipientPublicKey), Utf8(algorithm), Utf8(encryptedVek));+ }++ /// <summary>+ /// Builds the signed message of a delivery key publish, bound to the manifest revision the write is based on so it+ /// cannot be replayed in a later write.+ /// </summary>+ /// <param name="manifestId">The manifest the key delivers mail for.</param>+ /// <param name="publicKey">The delivery public key (JWK).</param>+ /// <param name="currentRevision">The revision the write is based on.</param>+ /// <returns>The message bytes.</returns>+ public static byte[] DeliveryKeyMessage(Guid manifestId, string publicKey, long currentRevision)+ {+ return SignedMessage(DeliveryKeyLabel, Utf8(manifestId.ToString()), Utf8(publicKey), Utf8(currentRevision.ToString(System.Globalization.CultureInfo.InvariantCulture)));+ }++ /// <summary>+ /// Whether a value is a base64 Ed25519 public key.+ /// </summary>+ /// <param name="publicKeyBase64">The value to check.</param>+ /// <returns>True when it decodes to a valid public key.</returns>+ public static bool IsValidPublicKey(string? publicKeyBase64)+ {+ var bytes = TryDecode(publicKeyBase64, Ed25519.PublicKeySize);+ return bytes != null && Ed25519.ValidatePublicKeyFull(bytes, 0);+ }++ /// <summary>+ /// Whether a base64 signature over a message verifies under a base64 Ed25519 public key.+ /// </summary>+ /// <param name="publicKeyBase64">The signer's public key.</param>+ /// <param name="message">The signed message, see <see cref="SignedMessage"/>.</param>+ /// <param name="signatureBase64">The signature.</param>+ /// <returns>True when the signature is valid.</returns>+ public static bool Verify(string? publicKeyBase64, byte[] message, string? signatureBase64)+ {+ var publicKey = TryDecode(publicKeyBase64, Ed25519.PublicKeySize);+ var signature = TryDecode(signatureBase64, Ed25519.SignatureSize);+ if (publicKey == null || signature == null || !Ed25519.ValidatePublicKeyFull(publicKey, 0))+ {+ return false;+ }++ return Ed25519.Verify(signature, 0, publicKey, 0, message, 0, message.Length);+ }++ /// <summary>+ /// Whether a signature is the signing key's signature over an account encryption public key.+ /// </summary>+ /// <param name="signingPublicKey">The signer's public key.</param>+ /// <param name="accountPublicKey">The signed account public key (JWK) as sent.</param>+ /// <param name="signature">The signature.</param>+ /// <returns>True when the signature is valid.</returns>+ public static bool VerifyAccountPublicKey(string? signingPublicKey, string? accountPublicKey, string? signature)+ {+ return accountPublicKey != null && Verify(signingPublicKey, SignedMessage(AccountPublicKeyLabel, Encoding.UTF8.GetBytes(accountPublicKey)), signature);+ }++ private static byte[] Utf8(string value) => Encoding.UTF8.GetBytes(value);++ private static byte[]? TryDecode(string? base64, int expectedLength)+ {+ if (string.IsNullOrEmpty(base64))+ {+ return null;+ }++ try+ {+ var bytes = Convert.FromBase64String(base64);+ return bytes.Length == expectedLength ? bytes : null;+ }+ catch (FormatException)+ {+ return null;+ }+ }+}diff --git a/core/client/src/auth/VaultKeyService.ts b/core/client/src/auth/VaultKeyService.tsindex 00b80c8c7..41f357760 100644--- a/core/client/src/auth/VaultKeyService.ts+++ b/core/client/src/auth/VaultKeyService.ts@@ -75,7 +75,7 @@ export class VaultKeyService {}if (!result.vaultKey) {- await getPlatform().storage.removeMany([StorageKeys.ENCRYPTED_VEK, StorageKeys.ENCRYPTED_ACCOUNT_KEY, StorageKeys.ACCOUNT_PUBLIC_KEY, StorageKeys.ENCRYPTED_ACCOUNT_PRIVATE_KEY]);+ await getPlatform().storage.removeMany([StorageKeys.ENCRYPTED_VEK, StorageKeys.ENCRYPTED_ACCOUNT_KEY, StorageKeys.ACCOUNT_PUBLIC_KEY, StorageKeys.ENCRYPTED_ACCOUNT_PRIVATE_KEY, StorageKeys.SIGNING_PUBLIC_KEY, StorageKeys.ENCRYPTED_SIGNING_PRIVATE_KEY]);return unlockKeyBase64;}@@ -238,6 +238,15 @@ export class VaultKeyService {} else {await getPlatform().storage.removeMany([StorageKeys.ACCOUNT_PUBLIC_KEY, StorageKeys.ENCRYPTED_ACCOUNT_PRIVATE_KEY]);}++ if (vaultKey.signingPublicKey && vaultKey.encryptedSigningPrivateKey) {+ await getPlatform().storage.setMany([+ { key: StorageKeys.SIGNING_PUBLIC_KEY, value: vaultKey.signingPublicKey },+ { key: StorageKeys.ENCRYPTED_SIGNING_PRIVATE_KEY, value: vaultKey.encryptedSigningPrivateKey },+ ]);+ } else {+ await getPlatform().storage.removeMany([StorageKeys.SIGNING_PUBLIC_KEY, StorageKeys.ENCRYPTED_SIGNING_PRIVATE_KEY]);+ }}}diff --git a/core/client/src/constants/StorageKeys.ts b/core/client/src/constants/StorageKeys.tsindex e2205d565..7a15ac313 100644--- a/core/client/src/constants/StorageKeys.ts+++ b/core/client/src/constants/StorageKeys.ts@@ -51,6 +51,10 @@ export const StorageKeys = {ACCOUNT_PUBLIC_KEY: 'local:accountPublicKey',/** The account private key encrypted with the Account Key. */ENCRYPTED_ACCOUNT_PRIVATE_KEY: 'local:encryptedAccountPrivateKey',+ /** The account signing public key (Ed25519, base64). */+ SIGNING_PUBLIC_KEY: 'local:signingPublicKey',+ /** The account signing private key encrypted with the Account Key. */+ ENCRYPTED_SIGNING_PRIVATE_KEY: 'local:encryptedSigningPrivateKey',/** -- Sync state --@@ -143,5 +147,7 @@ export const vaultDataStorageKeys = (): StorageKey[] => [StorageKeys.ENCRYPTED_ACCOUNT_KEY,StorageKeys.ACCOUNT_PUBLIC_KEY,StorageKeys.ENCRYPTED_ACCOUNT_PRIVATE_KEY,+ StorageKeys.SIGNING_PUBLIC_KEY,+ StorageKeys.ENCRYPTED_SIGNING_PRIVATE_KEY,...ALL_VAULT_MUTATION_SCOPES.map(scope => dirtyScopeStorageKey(scope)),];diff --git a/core/client/src/rust/RustCoreTypes.ts b/core/client/src/rust/RustCoreTypes.tsindex 3008699ee..fdb3aa0b6 100644--- a/core/client/src/rust/RustCoreTypes.ts+++ b/core/client/src/rust/RustCoreTypes.ts@@ -97,6 +97,9 @@ export type AccountKeyBlobs = {encryptedVek: string;accountPublicKey: string;encryptedAccountPrivateKey: string;+ signingPublicKey: string;+ encryptedSigningPrivateKey: string;+ accountPublicKeySignature: string;};/**@@ -105,6 +108,7 @@ export type AccountKeyBlobs = {export type AccountKeyHierarchy = {vaultEncryptionKey: string;accountPrivateKey: string;+ signingPrivateKey: string;accountKeys: AccountKeyBlobs;};diff --git a/core/client/src/sync/VaultSyncEngine.ts b/core/client/src/sync/VaultSyncEngine.tsindex 5936d621e..a16434f91 100644--- a/core/client/src/sync/VaultSyncEngine.ts+++ b/core/client/src/sync/VaultSyncEngine.ts@@ -39,6 +39,7 @@ export type VaultSyncEngineRequest = {encryptionKey?: string;accountPublicKey?: string;accountPrivateKey?: string;+ accountKey?: string;isDirty: boolean;mutationSequence: number;dirtyScopes: string[];@@ -536,6 +537,7 @@ export async function buildVaultSyncRequest(operation: VaultSyncOperation, optioencryptionKey: sessionKeys?.vaultEncryptionKey,accountPublicKey: accountPublicKey ?? undefined,accountPrivateKey: sessionKeys?.accountPrivateKey ?? undefined,+ accountKey: sessionKeys?.accountKey,isDirty: isDirty ?? false,mutationSequence: mutationSequence ?? 0,dirtyScopes: isDirty ? await getDirtyScopes() : [],diff --git a/core/models/scripts/generate-key-vocabulary.cjs b/core/models/scripts/generate-key-vocabulary.cjsindex 2455b43e4..700f5d348 100644--- a/core/models/scripts/generate-key-vocabulary.cjs+++ b/core/models/scripts/generate-key-vocabulary.cjs@@ -109,6 +109,21 @@ const VOCABULARIES = [},],},+ {+ name: 'SigningKeyAlgorithm',+ helperName: 'SigningKeyAlgorithms',+ summary: [+ 'The algorithms an account signing keypair can sign with.',+ ],+ flags: [],+ members: [+ {+ name: 'Ed25519',+ token: 'ed25519',+ summary: 'Ed25519 (RFC 8032), verified strictly.',+ },+ ],+ },];/** Convert a PascalCase name to camelCase (Swift). */diff --git a/core/models/src/webapi/Groups.ts b/core/models/src/webapi/Groups.tsindex e4d805fba..d85df7e44 100644--- a/core/models/src/webapi/Groups.ts+++ b/core/models/src/webapi/Groups.ts@@ -18,6 +18,8 @@ export type GroupMemberInfo = {role: GroupRole;publicKeyId: string | null;publicKey: string | null;+ publicKeySignature: string | null;+ signingPublicKey: string | null;}/**@@ -48,6 +50,7 @@ export type ReceivedManifestInvitation = {*/export type SharedManifestInfo = {manifestId: string;+ keyVersion: number;memberUserIds: string[];pendingInvitations: SentManifestInvitation[];}@@ -78,6 +81,7 @@ export type CreateSharedManifestRequest = {selfEncryptedVek: string;selfPublicKey: string;algorithm: VaultKeyAlgorithmValue;+ selfGrantSignature: string;/** The name of the manifest, encrypted with the manifest's own key (base64). */encryptedName?: string | null;}@@ -106,6 +110,7 @@ export type ManifestGrant = {recipientPublicKeyId: string;encryptedVek: string;encryptedName?: string | null;+ signature: string;}/**diff --git a/core/models/src/webapi/SigningKeyAlgorithm.ts b/core/models/src/webapi/SigningKeyAlgorithm.tsnew file mode 100644index 000000000..eb9a4d420--- /dev/null+++ b/core/models/src/webapi/SigningKeyAlgorithm.ts@@ -0,0 +1,20 @@+/**+ * <auto-generated />+ * This file is auto-generated from core/models/scripts/generate-key-vocabulary.cjs.+ * Do not edit this file directly. Run 'core/models/build.sh' (or 'node core/models/scripts/generate-key-vocabulary.cjs') to regenerate.+ */++/**+ * The algorithms an account signing keypair can sign with.+ */+export const SigningKeyAlgorithm = {+ /**+ * Ed25519 (RFC 8032), verified strictly.+ */+ Ed25519: 'ed25519',+} as const;++/**+ * Type representing all valid SigningKeyAlgorithm tokens.+ */+export type SigningKeyAlgorithmValue = typeof SigningKeyAlgorithm[keyof typeof SigningKeyAlgorithm];diff --git a/core/models/src/webapi/VaultKey.ts b/core/models/src/webapi/VaultKey.tsindex d8ded0b22..79c15a405 100644--- a/core/models/src/webapi/VaultKey.ts+++ b/core/models/src/webapi/VaultKey.ts@@ -6,6 +6,8 @@ export type VaultKeyResponse = {encryptedAccountKey: string;encryptedAccountPrivateKey: string | null;accountPublicKey: string | null;+ signingPublicKey: string | null;+ encryptedSigningPrivateKey: string | null;encryptedVek: string | null;salt: string;encryptionType: string;diff --git a/core/models/src/webapi/index.ts b/core/models/src/webapi/index.tsindex ca7c54a2b..2e6daca7d 100644--- a/core/models/src/webapi/index.ts+++ b/core/models/src/webapi/index.ts@@ -30,6 +30,7 @@ export * from './VaultKey';export * from './UnlockMethodType';export * from './ManifestKeyType';export * from './VaultKeyAlgorithm';+export * from './SigningKeyAlgorithm';export * from './Groups';export * from './CapabilityKeys';export * from './StorageStatistics';