Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update email claim links db and API message structure (#2159)
Leendert de Borst46f5936e1fd0
diff --git a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs b/apps/server/Databases/AliasServerDb/AliasServerDbContext.csindex 46403d3f7..97f9f6f66 100644--- a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs+++ b/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs@@ -401,6 +401,10 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyCon{builder.HasKey(l => new { l.EmailClaimId, l.VaultManifestId });+ // Stored as its name rather than an ordinal: every query here reads "is this link still Removed", which+ // is worth being able to answer from a raw SQL prompt without a lookup table in your head.+ builder.Property(l => l.State).HasConversion<string>().HasMaxLength(20);+builder.HasOne(l => l.EmailClaim).WithMany(c => c.Links).HasForeignKey(l => l.EmailClaimId)diff --git a/apps/server/Databases/AliasServerDb/EmailClaimLink.cs b/apps/server/Databases/AliasServerDb/EmailClaimLink.csindex ecbac6d76..6cf153af9 100644--- a/apps/server/Databases/AliasServerDb/EmailClaimLink.cs+++ b/apps/server/Databases/AliasServerDb/EmailClaimLink.cs@@ -38,11 +38,7 @@ public class EmailClaimLinkpublic virtual VaultManifest VaultManifest { get; set; } = null!;/// <summary>- /// Gets or sets a value indicating whether this manifest paused (stopped) wanting mail for the alias. A user may switch a- /// single alias off without removing the item that carries it: the link stays, so previously received mail- /// remains readable and re-enabling is a flag flip, but incoming mail is no longer wrapped for this manifest.- /// This is separate from the global <see cref="EmailClaim.Disabled"/> flag, which means the alias is gone from the- /// vault entirely and not read anywhere anymore, which also engages disabled-email pruning.+ /// Gets or sets the state of the link. A link record is permanent and never deleted, except when the owner account/group is permanently deleted./// </summary>- public bool Paused { get; set; } = false;+ public EmailClaimLinkState State { get; set; } = EmailClaimLinkState.Active;}diff --git a/apps/server/Databases/AliasServerDb/EmailClaimLinkState.cs b/apps/server/Databases/AliasServerDb/EmailClaimLinkState.csnew file mode 100644index 000000000..ff342698d--- /dev/null+++ b/apps/server/Databases/AliasServerDb/EmailClaimLinkState.cs@@ -0,0 +1,35 @@+//-----------------------------------------------------------------------+// <copyright file="EmailClaimLinkState.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;++/// <summary>+/// What a manifest's link to an email claim says about the alias right now.+/// <para>+/// The claim link row itself is permanent: it is the record of which manifests have ever held the address, which is what+/// lets a manifest reclaim an alias it dropped and what stops another account from taking the address over.+/// </para>+/// </summary>+public enum EmailClaimLinkState+{+ /// <summary>+ /// The manifest carries the alias and wants its mail: incoming mail is wrapped for this manifest's delivery key.+ /// </summary>+ Active = 0,++ /// <summary>+ /// The manifest carries the alias but the user switched it off. Mail already received stays readable.+ /// New mail is not wrapped for this manifest. Re-enabling is possible by setting the state to 'Active'.+ /// </summary>+ Paused = 1,++ /// <summary>+ /// The manifest no longer carries the alias: the item holding it is gone from that vault, or a revoke severed the+ /// tie. No mail is wrapped for it, so the row survives purely as the ownership record.+ /// </summary>+ Removed = 2,+}diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260810154523_AddEmailMultiWrap.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260810154523_AddEmailMultiWrap.Designer.csindex 2fe3ac44e..d1aa054e4 100644--- a/apps/server/Databases/AliasServerDb/Migrations/20260810154523_AddEmailMultiWrap.Designer.cs+++ b/apps/server/Databases/AliasServerDb/Migrations/20260810154523_AddEmailMultiWrap.Designer.cs@@ -528,6 +528,11 @@ namespace AliasServerDb.Migrationsb.Property<Guid>("VaultManifestId").HasColumnType("uuid");+ b.Property<string>("State")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");+b.HasKey("EmailClaimId", "VaultManifestId");b.HasIndex("VaultManifestId", "EmailClaimId");diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260810154523_AddEmailMultiWrap.cs b/apps/server/Databases/AliasServerDb/Migrations/20260810154523_AddEmailMultiWrap.csindex 2abe2d55a..99118da19 100644--- a/apps/server/Databases/AliasServerDb/Migrations/20260810154523_AddEmailMultiWrap.cs+++ b/apps/server/Databases/AliasServerDb/Migrations/20260810154523_AddEmailMultiWrap.cs@@ -18,7 +18,8 @@ namespace AliasServerDb.Migrationscolumns: table => new{EmailClaimId = table.Column<Guid>(type: "uuid", nullable: false),- VaultManifestId = table.Column<Guid>(type: "uuid", nullable: false)+ VaultManifestId = table.Column<Guid>(type: "uuid", nullable: false),+ State = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false)},constraints: table =>{@@ -73,13 +74,14 @@ namespace AliasServerDb.Migrationscolumns: new[] { "EncryptionKeyId", "EmailId" });// Every existing email gets exactly one wrap (its current key), every claim one link (its current- // manifest). A tombstoned claim (VaultManifestId already null) simply gets zero links.+ // manifest). A tombstoned claim (VaultManifestId already null) simply gets zero links. A disabled claim+ // kept its manifest reference purely as an ownership record, which is what 'Removed' now indicates.migrationBuilder.Sql("""INSERT INTO "EmailKeyWraps" ("EmailId", "EncryptionKeyId", "EncryptedSymmetricKey")SELECT "Id", "EncryptionKeyId", "EncryptedSymmetricKey" FROM "Emails";- INSERT INTO "EmailClaimLinks" ("EmailClaimId", "VaultManifestId")- SELECT "Id", "VaultManifestId" FROM "EmailClaims" WHERE "VaultManifestId" IS NOT NULL;+ INSERT INTO "EmailClaimLinks" ("EmailClaimId", "VaultManifestId", "State")+ SELECT "Id", "VaultManifestId", CASE WHEN "Disabled" THEN 'Removed' ELSE 'Active' END FROM "EmailClaims" WHERE "VaultManifestId" IS NOT NULL;""");migrationBuilder.DropForeignKey(name: "FK_EmailClaims_VaultManifests_VaultManifestId", table: "EmailClaims");diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260810200139_EmailStorageFormatV2.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260810200139_EmailStorageFormatV2.Designer.csindex 50e044cfb..aea638238 100644--- a/apps/server/Databases/AliasServerDb/Migrations/20260810200139_EmailStorageFormatV2.Designer.cs+++ b/apps/server/Databases/AliasServerDb/Migrations/20260810200139_EmailStorageFormatV2.Designer.cs@@ -533,6 +533,11 @@ namespace AliasServerDb.Migrationsb.Property<Guid>("VaultManifestId").HasColumnType("uuid");+ b.Property<string>("State")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");+b.HasKey("EmailClaimId", "VaultManifestId");b.HasIndex("VaultManifestId", "EmailClaimId");diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260811192745_DropUnusedIdentityTables.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260811192745_DropUnusedIdentityTables.Designer.csindex 03ff5e398..18de1826e 100644--- a/apps/server/Databases/AliasServerDb/Migrations/20260811192745_DropUnusedIdentityTables.Designer.cs+++ b/apps/server/Databases/AliasServerDb/Migrations/20260811192745_DropUnusedIdentityTables.Designer.cs@@ -495,6 +495,11 @@ namespace AliasServerDb.Migrationsb.Property<Guid>("VaultManifestId").HasColumnType("uuid");+ b.Property<string>("State")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");+b.HasKey("EmailClaimId", "VaultManifestId");b.HasIndex("VaultManifestId", "EmailClaimId");diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260811194817_ReorderTableColumns.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260811194817_ReorderTableColumns.Designer.csindex 9257e4374..f0502dcea 100644--- a/apps/server/Databases/AliasServerDb/Migrations/20260811194817_ReorderTableColumns.Designer.cs+++ b/apps/server/Databases/AliasServerDb/Migrations/20260811194817_ReorderTableColumns.Designer.cs@@ -495,6 +495,11 @@ namespace AliasServerDb.Migrationsb.Property<Guid>("VaultManifestId").HasColumnType("uuid");+ b.Property<string>("State")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");+b.HasKey("EmailClaimId", "VaultManifestId");b.HasIndex("VaultManifestId", "EmailClaimId");diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260811195539_EmailDetachedParts.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260811195539_EmailDetachedParts.Designer.csindex 082cf0d02..c1dee91e5 100644--- a/apps/server/Databases/AliasServerDb/Migrations/20260811195539_EmailDetachedParts.Designer.cs+++ b/apps/server/Databases/AliasServerDb/Migrations/20260811195539_EmailDetachedParts.Designer.cs@@ -495,6 +495,11 @@ namespace AliasServerDb.Migrationsb.Property<Guid>("VaultManifestId").HasColumnType("uuid");+ b.Property<string>("State")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");+b.HasKey("EmailClaimId", "VaultManifestId");b.HasIndex("VaultManifestId", "EmailClaimId");diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260812141816_AddAnonymizedSenderCounts.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260812141816_AddAnonymizedSenderCounts.Designer.csindex cfcb02b7e..8525aa0b3 100644--- a/apps/server/Databases/AliasServerDb/Migrations/20260812141816_AddAnonymizedSenderCounts.Designer.cs+++ b/apps/server/Databases/AliasServerDb/Migrations/20260812141816_AddAnonymizedSenderCounts.Designer.cs@@ -498,6 +498,11 @@ namespace AliasServerDb.Migrationsb.Property<Guid>("VaultManifestId").HasColumnType("uuid");+ b.Property<string>("State")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");+b.HasKey("EmailClaimId", "VaultManifestId");b.HasIndex("VaultManifestId", "EmailClaimId");diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260813112525_AddEmailClaimLinkPaused.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260813112525_AddEmailClaimLinkPaused.Designer.csdeleted file mode 100644index e58859274..000000000--- a/apps/server/Databases/AliasServerDb/Migrations/20260813112525_AddEmailClaimLinkPaused.Designer.cs+++ /dev/null@@ -1,1677 +0,0 @@-// <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("20260813112525_AddEmailClaimLinkPaused")]- partial class AddEmailClaimLinkPaused- {- /// <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(100)- .HasColumnType("character varying(100)");-- 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.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<bool>("Disabled")- .HasColumnType("boolean");-- b.Property<DateTime>("UpdatedAt")- .HasColumnType("timestamp with time zone");-- b.HasKey("Id");-- b.HasIndex("Address")- .IsUnique();-- b.ToTable("EmailClaims");- });-- modelBuilder.Entity("AliasServerDb.EmailClaimLink", b =>- {- b.Property<Guid>("EmailClaimId")- .HasColumnType("uuid");-- b.Property<Guid>("VaultManifestId")- .HasColumnType("uuid");-- b.Property<bool>("Paused")- .HasColumnType("boolean");-- b.HasKey("EmailClaimId", "VaultManifestId");-- b.HasIndex("VaultManifestId", "EmailClaimId");-- b.ToTable("EmailClaimLinks");- });-- modelBuilder.Entity("AliasServerDb.EmailKeyWrap", b =>- {- b.Property<int>("EmailId")- .HasColumnType("integer");-- b.Property<Guid>("EncryptionKeyId")- .HasColumnType("uuid");-- b.Property<string>("EncryptedSymmetricKey")- .IsRequired()- .HasColumnType("text");-- b.HasKey("EmailId", "EncryptionKeyId");-- b.HasIndex("EncryptionKeyId", "EmailId");-- b.ToTable("EmailKeyWraps");- });-- 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<int>("Type")- .HasColumnType("integer");-- b.Property<DateTime>("UpdatedAt")- .HasColumnType("timestamp with time zone");-- b.HasKey("Id");-- b.ToTable("Groups");- });-- 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<int>("Role")- .HasColumnType("integer");-- 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<DateTime?>("ClearedAt")- .HasColumnType("timestamp with time zone");-- b.Property<string>("ClientIpAddress")- .HasColumnType("text");-- b.Property<string>("ClientPublicKey")- .IsRequired()- .HasColumnType("text");-- b.Property<DateTime>("CreatedAt")- .HasColumnType("timestamp with time zone");-- b.Property<string>("EncryptedDecryptionKey")- .HasColumnType("text");-- b.Property<DateTime?>("FulfilledAt")- .HasColumnType("timestamp with time zone");-- b.Property<string>("MobileIpAddress")- .HasColumnType("text");-- 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.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<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<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.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.VaultBlobObject", b =>- {- b.Property<string>("Hash")- .HasMaxLength(64)- .HasColumnType("character varying(64)");-- b.Property<string>("OwnerUserId")- .HasMaxLength(255)- .HasColumnType("character varying(255)");-- b.Property<string>("Category")- .IsRequired()- .HasMaxLength(20)- .HasColumnType("character varying(20)");-- 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>("LastReferencedAt")- .HasColumnType("timestamp with time zone");-- b.Property<int>("SizeBytes")- .HasColumnType("integer");-- b.HasKey("Hash", "OwnerUserId");-- b.HasIndex("OwnerUserId", "Category");-- 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<string>("Name")- .HasMaxLength(255)- .HasColumnType("character varying(255)");-- 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>("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.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<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<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.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>("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.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<string>("DesiredStatus")- .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.EmailAttachment", b =>- {- b.HasOne("AliasServerDb.Email", "Email")- .WithMany("Attachments")- .HasForeignKey("EmailId")- .OnDelete(DeleteBehavior.Cascade)- .IsRequired();-- b.Navigation("Email");- });-- modelBuilder.Entity("AliasServerDb.EmailClaimLink", b =>- {- b.HasOne("AliasServerDb.EmailClaim", "EmailClaim")- .WithMany("Links")- .HasForeignKey("EmailClaimId")- .OnDelete(DeleteBehavior.Cascade)- .IsRequired();-- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")- .WithMany()- .HasForeignKey("VaultManifestId")- .OnDelete(DeleteBehavior.Cascade)- .IsRequired();-- b.Navigation("EmailClaim");-- b.Navigation("VaultManifest");- });-- modelBuilder.Entity("AliasServerDb.EmailKeyWrap", b =>- {- b.HasOne("AliasServerDb.Email", "Email")- .WithMany("Wraps")- .HasForeignKey("EmailId")- .OnDelete(DeleteBehavior.Cascade)- .IsRequired();-- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "EncryptionKey")- .WithMany("Wraps")- .HasForeignKey("EncryptionKeyId")- .OnDelete(DeleteBehavior.Cascade)- .IsRequired();-- b.Navigation("Email");-- b.Navigation("EncryptionKey");- });-- modelBuilder.Entity("AliasServerDb.EmailPart", b =>- {- b.HasOne("AliasServerDb.Email", "Email")- .WithMany("Parts")- .HasForeignKey("EmailId")- .OnDelete(DeleteBehavior.Cascade)- .IsRequired();-- b.Navigation("Email");- });-- 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.UserUnlockKey", b =>- {- b.HasOne("AliasServerDb.AliasVaultUser", "User")- .WithMany()- .HasForeignKey("UserId")- .OnDelete(DeleteBehavior.Cascade)- .IsRequired();-- b.Navigation("User");- });-- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>- {- b.HasOne("AliasServerDb.AliasVaultUser", "User")- .WithMany()- .HasForeignKey("OwnerUserId")- .OnDelete(DeleteBehavior.Cascade)- .IsRequired();-- b.Navigation("User");- });-- 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.Navigation("OwnerGroup");- });-- 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.VaultManifestsHistory", b =>- {- b.HasOne("AliasServerDb.VaultManifest", "Manifest")- .WithMany()- .HasForeignKey("ManifestId")- .OnDelete(DeleteBehavior.Cascade)- .IsRequired();-- b.Navigation("Manifest");- });-- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>- {- b.Navigation("VaultManifestAccessKeys");- });-- modelBuilder.Entity("AliasServerDb.Email", b =>- {- b.Navigation("Attachments");-- b.Navigation("Parts");-- b.Navigation("Wraps");- });-- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>- {- b.Navigation("Links");- });-- modelBuilder.Entity("AliasServerDb.Group", b =>- {- b.Navigation("Members");- });-- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>- {- b.Navigation("Wraps");- });-#pragma warning restore 612, 618- }- }-}diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260813112525_AddEmailClaimLinkPaused.cs b/apps/server/Databases/AliasServerDb/Migrations/20260813112525_AddEmailClaimLinkPaused.csdeleted file mode 100644index 8b0e0e71a..000000000--- a/apps/server/Databases/AliasServerDb/Migrations/20260813112525_AddEmailClaimLinkPaused.cs+++ /dev/null@@ -1,29 +0,0 @@-using Microsoft.EntityFrameworkCore.Migrations;--#nullable disable--namespace AliasServerDb.Migrations-{- /// <inheritdoc />- public partial class AddEmailClaimLinkPaused : Migration- {- /// <inheritdoc />- protected override void Up(MigrationBuilder migrationBuilder)- {- migrationBuilder.AddColumn<bool>(- name: "Paused",- table: "EmailClaimLinks",- type: "boolean",- nullable: false,- defaultValue: false);- }-- /// <inheritdoc />- protected override void Down(MigrationBuilder migrationBuilder)- {- migrationBuilder.DropColumn(- name: "Paused",- table: "EmailClaimLinks");- }- }-}diff --git a/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.csindex 9ef8f0a8b..8f0c46682 100644--- a/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs+++ b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs@@ -495,8 +495,10 @@ namespace AliasServerDb.Migrationsb.Property<Guid>("VaultManifestId").HasColumnType("uuid");- b.Property<bool>("Paused")- .HasColumnType("boolean");+ b.Property<string>("State")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");b.HasKey("EmailClaimId", "VaultManifestId");diff --git a/apps/server/Services/AliasVault.SmtpService/Handlers/DatabaseMessageStore.cs b/apps/server/Services/AliasVault.SmtpService/Handlers/DatabaseMessageStore.csindex 2b61f537c..2c27ad4bc 100644--- a/apps/server/Services/AliasVault.SmtpService/Handlers/DatabaseMessageStore.cs+++ b/apps/server/Services/AliasVault.SmtpService/Handlers/DatabaseMessageStore.cs@@ -390,7 +390,7 @@ public class DatabaseMessageStore(ILogger<DatabaseMessageStore> logger, Config c// An alias may be claimed by several manifests at once (personal + shared). The mail is stored once, with// the symmetric key wrapped per linked manifest's primary delivery key.- var links = await dbContext.EmailClaimLinks.Where(l => l.EmailClaimId == emailClaim.Id).Select(l => new { l.VaultManifestId, l.Paused }).ToListAsync(CancellationToken.None);+ var links = await dbContext.EmailClaimLinks.Where(l => l.EmailClaimId == emailClaim.Id).Select(l => new { l.VaultManifestId, l.State }).ToListAsync(CancellationToken.None);if (links.Count == 0){// The claim is orphaned: every manifest it was linked to no longer exists (owner deleted account).@@ -410,12 +410,12 @@ public class DatabaseMessageStore(ILogger<DatabaseMessageStore> logger, Config creturn false;}- // Check if there is at least one linked manifest that has not paused the alias.- var linkedManifestIds = links.Where(l => !l.Paused).Select(l => l.VaultManifestId).ToList();+ // Check if there is at least one manifest that still carries the alias and wants its mail.+ var linkedManifestIds = links.Where(l => l.State == EmailClaimLinkState.Active).Select(l => l.VaultManifestId).ToList();if (linkedManifestIds.Count == 0){logger.LogInformation(- "Rejected email: email for {ToAddress} is claimed but every vault claiming it has the alias switched off.",+ "Rejected email: email for {ToAddress} is claimed but every vault that still carries it has the alias switched off.",toAddress.User + "@" + toAddress.Host);return false;}diff --git a/apps/server/Services/AliasVault.TaskRunner/Tasks/EmailCleanupTask.cs b/apps/server/Services/AliasVault.TaskRunner/Tasks/EmailCleanupTask.csindex 4925f7803..4ec13bb64 100644--- a/apps/server/Services/AliasVault.TaskRunner/Tasks/EmailCleanupTask.cs+++ b/apps/server/Services/AliasVault.TaskRunner/Tasks/EmailCleanupTask.cs@@ -77,9 +77,10 @@ public class EmailCleanupTask : IMaintenanceTask{var userCutoffDate = DateTime.UtcNow.AddDays(-user.MaxEmailAgeDays);- // Get all email addresses for this user+ // Get all email addresses this user's vault still carries.var userAddresses = await dbContext.EmailClaims- .Where(c => c.Links.Any(l => dbContext.AliasVaultUsers.Any(u => u.Id == user.Id && u.PersonalGroupId == l.VaultManifest.OwnerGroupId)))+ .Where(c => c.Links.Any(l => l.State != EmailClaimLinkState.Removed+ && dbContext.AliasVaultUsers.Any(u => u.Id == user.Id && u.PersonalGroupId == l.VaultManifest.OwnerGroupId))).Select(c => c.Address).ToListAsync(cancellationToken);diff --git a/apps/server/Services/AliasVault.TaskRunner/Tasks/EmailQuotaCleanupTask.cs b/apps/server/Services/AliasVault.TaskRunner/Tasks/EmailQuotaCleanupTask.csindex 51c6ed20e..8bed95399 100644--- a/apps/server/Services/AliasVault.TaskRunner/Tasks/EmailQuotaCleanupTask.cs+++ b/apps/server/Services/AliasVault.TaskRunner/Tasks/EmailQuotaCleanupTask.cs@@ -49,7 +49,7 @@ public class EmailQuotaCleanupTask : IMaintenanceTaskvar usersWithClaims = await (from u in dbContext.AliasVaultUsersjoin g in dbContext.Groups on u.PersonalGroupId equals g.Idjoin m in dbContext.VaultManifests on g.Id equals m.OwnerGroupId- join l in dbContext.EmailClaimLinks on m.ManifestId equals l.VaultManifestId+ join l in dbContext.EmailClaimLinks.Where(link => link.State != EmailClaimLinkState.Removed) on m.ManifestId equals l.VaultManifestIdselect new { u.Id, u.UserName, g.MaxEmails, u.LastActivityDate, u.CreatedAt, l.EmailClaim.Address }).ToListAsync(cancellationToken);diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailApiModel.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailApiModel.csindex 1d29408b4..1260cdece 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailApiModel.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailApiModel.cs@@ -12,6 +12,12 @@ namespace AliasVault.Shared.Models.WebApi.V2.Email;/// </summary>public class EmailApiModel : EmailApiModelBase{+ /// <summary>+ /// Gets or sets the public keys referenced by this email's wraps. A wrap's+ /// <see cref="EmailKeyWrapApiModel.KeyIndex"/> is its position in this list.+ /// </summary>+ public List<string> PublicKeys { get; set; } = [];+/// <summary>/// Gets or sets the source content of the email message as base64 ciphertext which contains the raw RFC 822 message bytes./// The other MessagePlain and MessageHtml DB fields are no longer served by the v2 API as these columns are deprecated,diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailApiModelBase.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailApiModelBase.csindex f913b1c63..f15afa4d9 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailApiModelBase.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailApiModelBase.cs@@ -66,6 +66,7 @@ public abstract class EmailApiModelBase/// <summary>/// Gets or sets the wrapped copies of the email's symmetric key the caller can open, one per manifest keypair/// the caller holds (their personal key, plus the delivery key of every shared manifest they can access).+ /// Each wrap names its public key by index into the public key table of the response model./// </summary>public List<EmailKeyWrapApiModel> Wraps { get; set; } = [];}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailKeyWrapApiModel.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailKeyWrapApiModel.csindex 7ad327cbe..88bb88ec9 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailKeyWrapApiModel.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/EmailKeyWrapApiModel.cs@@ -14,9 +14,10 @@ namespace AliasVault.Shared.Models.WebApi.V2.Email;public class EmailKeyWrapApiModel{/// <summary>- /// Gets or sets the public key whose private half unwraps this wrap.+ /// Gets or sets the position of the public key in the response-level public key table. The key itself is sent+ /// once as part of the full response./// </summary>- public string PublicKey { get; set; } = string.Empty;+ public int KeyIndex { get; set; }/// <summary>/// Gets or sets the email's symmetric key, encrypted with the public key.diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/MailboxApiModel.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/MailboxApiModel.csindex c71c294b4..987692deb 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/MailboxApiModel.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/MailboxApiModel.cs@@ -22,6 +22,12 @@ public class MailboxApiModel/// </summary>public bool Subscribed { get; set; }+ /// <summary>+ /// Gets or sets the public keys referenced by the wraps of the returned emails, sent once for the whole+ /// response. A wrap's <see cref="EmailKeyWrapApiModel.KeyIndex"/> is its position in this list.+ /// </summary>+ public List<string> PublicKeys { get; set; } = [];+/// <summary>/// Gets or sets the list of mailbox email API models./// </summary>diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/MailboxBulkResponse.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/MailboxBulkResponse.csindex 3e74fc71d..d561424a0 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/MailboxBulkResponse.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Email/MailboxBulkResponse.cs@@ -32,6 +32,12 @@ public class MailboxBulkResponse/// </summary>public int TotalRecords { get; set; }+ /// <summary>+ /// Gets or sets the public keys referenced by the wraps of the returned emails, sent once for the whole+ /// response. A wrap's <see cref="EmailKeyWrapApiModel.KeyIndex"/> is its position in this list.+ /// </summary>+ public List<string> PublicKeys { get; set; } = [];+/// <summary>/// Gets or sets the list of mailbox email API models./// </summary>diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/ClaimedEmailAddress.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/ClaimedEmailAddress.csindex d6450d24f..9fe20ae1a 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/ClaimedEmailAddress.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/ClaimedEmailAddress.cs@@ -21,9 +21,7 @@ public class ClaimedEmailAddresspublic required Guid ManifestId { get; set; }/// <summary>- /// Gets or sets a value indicating whether the user switched this alias off for this manifest. A client pushes- /// every alias it carries, paused ones included: absence from the push means the alias is gone from the vault,- /// while <c>true</c> means the user switched it off and its stored mail must be kept. Defaults to false.+ /// Gets or sets a value indicating whether the user switched this alias off for this manifest./// </summary>public bool Paused { get; set; }}