Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add group related API methods (#2159)
Leendert de Borst9644f3ae4261
diff --git a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs b/apps/server/Databases/AliasServerDb/AliasServerDbContext.csindex e413614b8..293e93e6c 100644--- a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs+++ b/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs@@ -121,6 +121,16 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyCon/// </summary>public DbSet<GroupMember> GroupMembers { get; set; }+ /// <summary>+ /// Gets or sets the GroupInvitations DbSet.+ /// </summary>+ public DbSet<GroupInvitation> GroupInvitations { get; set; }++ /// <summary>+ /// Gets or sets the ClientActions DbSet.+ /// </summary>+ public DbSet<ClientAction> ClientActions { get; set; }+/// <summary>/// Gets or sets the VaultManifestDeliveryKeys DbSet./// </summary>@@ -322,6 +332,53 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyConbuilder.HasIndex(e => e.UserId);});+ // Configure GroupInvitation, an offer to join a group.+ modelBuilder.Entity<GroupInvitation>(builder =>+ {+ builder.HasOne(e => e.Group)+ .WithMany()+ .HasForeignKey(e => e.GroupId)+ .OnDelete(DeleteBehavior.Cascade);++ builder.HasOne(e => e.Inviter)+ .WithMany()+ .HasForeignKey(e => e.InviterUserId)+ .OnDelete(DeleteBehavior.Cascade);++ builder.HasOne(e => e.Invitee)+ .WithMany()+ .HasForeignKey(e => e.InviteeUserId)+ .OnDelete(DeleteBehavior.Cascade);++ // At most one open invitation per (group, invitee).+ builder.HasIndex(e => new { e.GroupId, e.InviteeUserId }).IsUnique().HasFilter("\"State\" = 'Pending'").HasDatabaseName("UX_GroupInvitations_Group_Invitee_Pending");+ builder.Property(e => e.State).HasConversion<string>().HasMaxLength(20);+ builder.Property(e => e.Algorithm).HasConversion(v => VaultKeyAlgorithms.ToToken(v), v => VaultKeyAlgorithms.Parse(v));++ // Losing the keypair the vault key was sealed to leaves an invitation nobody could ever open.+ builder.HasOne(e => e.UserGrantKey)+ .WithMany()+ .HasForeignKey(e => e.UserGrantKeyId)+ .OnDelete(DeleteBehavior.SetNull);+ });++ // Configure ClientAction, a work the server needs a client to carry out on its behalf.+ modelBuilder.Entity<ClientAction>(builder =>+ {+ builder.HasOne(e => e.TargetUser)+ .WithMany()+ .HasForeignKey(e => e.TargetUserId)+ .OnDelete(DeleteBehavior.Cascade);++ builder.HasOne(e => e.TargetGroup)+ .WithMany()+ .HasForeignKey(e => e.TargetGroupId)+ .OnDelete(DeleteBehavior.Cascade);++ builder.Property(e => e.Type).HasConversion<string>().HasMaxLength(50);+ builder.Property(e => e.Payload).HasColumnType("jsonb");+ });+// Configure VaultManifest: one row per logical manifest (current revision), keyed by ManifestId.modelBuilder.Entity<VaultManifest>(builder =>{diff --git a/apps/server/Databases/AliasServerDb/GroupInvitation.cs b/apps/server/Databases/AliasServerDb/GroupInvitation.csnew file mode 100644index 000000000..90a8ed69a--- /dev/null+++ b/apps/server/Databases/AliasServerDb/GroupInvitation.cs@@ -0,0 +1,112 @@+//-----------------------------------------------------------------------+// <copyright file="GroupInvitation.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;+using Microsoft.EntityFrameworkCore;++/// <summary>+/// An offer to join a <see cref="GroupType.Shared"/> group, made by one of its admins to an existing account.+/// </summary>+[Index(nameof(InviteeUserId), nameof(State))]+public class GroupInvitation+{+ /// <summary>+ /// Gets or sets the primary key.+ /// </summary>+ [Key]+ public Guid Id { get; set; }++ /// <summary>+ /// Gets or sets the group being joined.+ /// </summary>+ public Guid GroupId { get; set; }++ /// <summary>+ /// Gets or sets the navigation property to the group.+ /// </summary>+ [ForeignKey("GroupId")]+ public virtual Group Group { get; set; } = null!;++ /// <summary>+ /// Gets or sets the admin who sent the invitation.+ /// </summary>+ [StringLength(255)]+ public required string InviterUserId { get; set; }++ /// <summary>+ /// Gets or sets the navigation property to the inviter.+ /// </summary>+ [ForeignKey("InviterUserId")]+ public virtual AliasVaultUser Inviter { get; set; } = null!;++ /// <summary>+ /// Gets or sets the invited account.+ /// </summary>+ [StringLength(255)]+ public required string InviteeUserId { get; set; }++ /// <summary>+ /// Gets or sets the navigation property to the invitee.+ /// </summary>+ [ForeignKey("InviteeUserId")]+ public virtual AliasVaultUser Invitee { get; set; } = null!;++ /// <summary>+ /// Gets or sets the role the invitee gets on accepting.+ /// </summary>+ public GroupRole Role { get; set; } = GroupRole.Member;++ /// <summary>+ /// Gets or sets the manifest the <see cref="EncryptedVek"/> unlocks.+ /// </summary>+ public Guid? VaultManifestId { get; set; }++ /// <summary>+ /// Gets or sets the shared vault's VEK, encrypted for the invitee's public key.+ /// </summary>+ public string? EncryptedVek { get; set; }++ /// <summary>+ /// Gets or sets the invitee's account keypair (<see cref="UserGrantKey"/>) the <see cref="EncryptedVek"/> was encrypted to.+ /// </summary>+ public Guid? UserGrantKeyId { get; set; }++ /// <summary>+ /// Gets or sets the navigation property to that keypair.+ /// </summary>+ public virtual UserGrantKey? UserGrantKey { get; set; }++ /// <summary>+ /// Gets or sets the algorithm the <see cref="EncryptedVek"/> is encrypted with.+ /// </summary>+ [StringLength(30)]+ public VaultKeyAlgorithm Algorithm { get; set; } = VaultKeyAlgorithm.RsaOaepSha256;++ /// <summary>+ /// Gets or sets where the invitation stands.+ /// </summary>+ public GroupInvitationState State { get; set; } = GroupInvitationState.Pending;++ /// <summary>+ /// Gets or sets created timestamp.+ /// </summary>+ public DateTime CreatedAt { get; set; }++ /// <summary>+ /// Gets or sets updated timestamp.+ /// </summary>+ public DateTime UpdatedAt { get; set; }++ /// <summary>+ /// Gets or sets the time the invitation was handled/answered.+ /// </summary>+ public DateTime? RespondedAt { get; set; }+}diff --git a/apps/server/Databases/AliasServerDb/GroupInvitationState.cs b/apps/server/Databases/AliasServerDb/GroupInvitationState.csnew file mode 100644index 000000000..126a187ee--- /dev/null+++ b/apps/server/Databases/AliasServerDb/GroupInvitationState.cs@@ -0,0 +1,34 @@+//-----------------------------------------------------------------------+// <copyright file="GroupInvitationState.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>+/// Where an invitation to join a <see cref="GroupType.Shared"/> group stands.+/// </summary>+public enum GroupInvitationState+{+ /// <summary>+ /// Sent and awaiting the invitee's answer. The only state in which an invitation can be accepted or declined.+ /// </summary>+ Pending = 0,++ /// <summary>+ /// The invitee accepted, which created their <see cref="GroupMember"/> row.+ /// </summary>+ Accepted = 1,++ /// <summary>+ /// The invitee turned it down. The inviter may send a new one.+ /// </summary>+ Declined = 2,++ /// <summary>+ /// Withdrawn by the inviter (or another group admin) before it was answered.+ /// </summary>+ Revoked = 3,+}diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260820120455_AddGroupInvitationsAndClientActions.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260820120455_AddGroupInvitationsAndClientActions.Designer.csnew file mode 100644index 000000000..b49a87172--- /dev/null+++ b/apps/server/Databases/AliasServerDb/Migrations/20260820120455_AddGroupInvitationsAndClientActions.Designer.cs@@ -0,0 +1,1837 @@+// <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("20260820120455_AddGroupInvitationsAndClientActions")]+ partial class AddGroupInvitationsAndClientActions+ {+ /// <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.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<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<string>("State")+ .IsRequired()+ .HasMaxLength(20)+ .HasColumnType("character varying(20)");++ b.HasKey("EmailClaimId", "VaultManifestId");++ b.HasIndex("EmailClaimId")+ .HasDatabaseName("IX_EmailClaimLinks_EmailClaimId_Live")+ .HasFilter("\"State\" <> 'Removed'");++ b.HasIndex("VaultManifestId", "EmailClaimId");++ b.ToTable("EmailClaimLinks");+ });++ 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<int>("Type")+ .HasColumnType("integer");++ 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>("EncryptedVek")+ .HasColumnType("text");++ 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<int>("Role")+ .HasColumnType("integer");++ 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<Guid?>("VaultManifestId")+ .HasColumnType("uuid");++ b.HasKey("Id");++ b.HasIndex("InviterUserId");++ b.HasIndex("UserGrantKeyId");++ b.HasIndex("GroupId", "InviteeUserId")+ .IsUnique()+ .HasDatabaseName("UX_GroupInvitations_Group_Invitee_Pending")+ .HasFilter("\"State\" = 'Pending'");++ b.HasIndex("InviteeUserId", "State");++ 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<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.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.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.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.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("DecryptionKeys");++ b.Navigation("Parts");+ });++ modelBuilder.Entity("AliasServerDb.EmailClaim", b =>+ {+ b.Navigation("Links");+ });++ 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/20260820120455_AddGroupInvitationsAndClientActions.cs b/apps/server/Databases/AliasServerDb/Migrations/20260820120455_AddGroupInvitationsAndClientActions.csnew file mode 100644index 000000000..58f8e7003--- /dev/null+++ b/apps/server/Databases/AliasServerDb/Migrations/20260820120455_AddGroupInvitationsAndClientActions.cs@@ -0,0 +1,134 @@+using System;+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace AliasServerDb.Migrations+{+ /// <inheritdoc />+ public partial class AddGroupInvitationsAndClientActions : Migration+ {+ /// <inheritdoc />+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.CreateTable(+ name: "ClientActions",+ columns: table => new+ {+ Id = table.Column<Guid>(type: "uuid", nullable: false),+ Type = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),+ TargetUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),+ TargetGroupId = table.Column<Guid>(type: "uuid", nullable: true),+ ManifestId = table.Column<Guid>(type: "uuid", nullable: true),+ Payload = table.Column<string>(type: "jsonb", nullable: true),+ 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_ClientActions", x => x.Id);+ table.ForeignKey(+ name: "FK_ClientActions_AliasVaultUsers_TargetUserId",+ column: x => x.TargetUserId,+ principalTable: "AliasVaultUsers",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ table.ForeignKey(+ name: "FK_ClientActions_Groups_TargetGroupId",+ column: x => x.TargetGroupId,+ principalTable: "Groups",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ migrationBuilder.CreateTable(+ name: "GroupInvitations",+ columns: table => new+ {+ Id = table.Column<Guid>(type: "uuid", nullable: false),+ GroupId = table.Column<Guid>(type: "uuid", nullable: false),+ InviterUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),+ InviteeUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),+ Role = table.Column<int>(type: "integer", nullable: false),+ VaultManifestId = table.Column<Guid>(type: "uuid", nullable: true),+ EncryptedVek = table.Column<string>(type: "text", nullable: true),+ UserGrantKeyId = table.Column<Guid>(type: "uuid", nullable: true),+ Algorithm = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),+ State = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),+ RespondedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_GroupInvitations", x => x.Id);+ table.ForeignKey(+ name: "FK_GroupInvitations_AliasVaultUsers_InviteeUserId",+ column: x => x.InviteeUserId,+ principalTable: "AliasVaultUsers",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ table.ForeignKey(+ name: "FK_GroupInvitations_AliasVaultUsers_InviterUserId",+ column: x => x.InviterUserId,+ principalTable: "AliasVaultUsers",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ table.ForeignKey(+ name: "FK_GroupInvitations_Groups_GroupId",+ column: x => x.GroupId,+ principalTable: "Groups",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ table.ForeignKey(+ name: "FK_GroupInvitations_UserGrantKeys_UserGrantKeyId",+ column: x => x.UserGrantKeyId,+ principalTable: "UserGrantKeys",+ principalColumn: "Id",+ onDelete: ReferentialAction.SetNull);+ });++ migrationBuilder.CreateIndex(+ name: "IX_ClientActions_TargetGroupId",+ table: "ClientActions",+ column: "TargetGroupId");++ migrationBuilder.CreateIndex(+ name: "IX_ClientActions_TargetUserId",+ table: "ClientActions",+ column: "TargetUserId");++ migrationBuilder.CreateIndex(+ name: "IX_GroupInvitations_InviteeUserId_State",+ table: "GroupInvitations",+ columns: new[] { "InviteeUserId", "State" });++ migrationBuilder.CreateIndex(+ name: "IX_GroupInvitations_InviterUserId",+ table: "GroupInvitations",+ column: "InviterUserId");++ migrationBuilder.CreateIndex(+ name: "IX_GroupInvitations_UserGrantKeyId",+ table: "GroupInvitations",+ column: "UserGrantKeyId");++ migrationBuilder.CreateIndex(+ name: "UX_GroupInvitations_Group_Invitee_Pending",+ table: "GroupInvitations",+ columns: new[] { "GroupId", "InviteeUserId" },+ unique: true,+ filter: "\"State\" = 'Pending'");+ }++ /// <inheritdoc />+ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropTable(+ name: "ClientActions");++ migrationBuilder.DropTable(+ name: "GroupInvitations");+ }+ }+}diff --git a/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.csindex 7a2a3c6fa..a17700258 100644--- a/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs+++ b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs@@ -77,7 +77,7 @@ namespace AliasServerDb.Migrationsb.HasKey("Id");- b.ToTable("AdminUsers", (string)null);+ b.ToTable("AdminUsers");});modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>@@ -158,7 +158,7 @@ namespace AliasServerDb.Migrations.IsUnique().HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");- b.ToTable("AliasVaultUsers", (string)null);+ b.ToTable("AliasVaultUsers");});modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>@@ -200,7 +200,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("UserId");- b.ToTable("AliasVaultUserRefreshTokens", (string)null);+ b.ToTable("AliasVaultUserRefreshTokens");});modelBuilder.Entity("AliasServerDb.AuthLog", b =>@@ -277,7 +277,7 @@ namespace AliasServerDb.Migrationsb.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp").IsDescending(false, true);- b.ToTable("AuthLogs", (string)null);+ b.ToTable("AuthLogs");});modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>@@ -326,7 +326,46 @@ namespace AliasServerDb.Migrationsb.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange").IsUnique();- b.ToTable("BlockedIpRanges", (string)null);+ b.ToTable("BlockedIpRanges");+ });++ 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 =>@@ -407,7 +446,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("To", "DateSystem");- b.ToTable("Emails", (string)null);+ b.ToTable("Emails");});modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>@@ -443,7 +482,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("EmailId");- b.ToTable("EmailAttachments", (string)null);+ b.ToTable("EmailAttachments");});modelBuilder.Entity("AliasServerDb.EmailClaim", b =>@@ -481,7 +520,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("Address").IsUnique();- b.ToTable("EmailClaims", (string)null);+ b.ToTable("EmailClaims");});modelBuilder.Entity("AliasServerDb.EmailClaimLink", b =>@@ -505,7 +544,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("VaultManifestId", "EmailClaimId");- b.ToTable("EmailClaimLinks", (string)null);+ b.ToTable("EmailClaimLinks");});modelBuilder.Entity("AliasServerDb.EmailDecryptionKey", b =>@@ -524,7 +563,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("VaultManifestDeliveryKeyId", "EmailId");- b.ToTable("EmailDecryptionKeys", (string)null);+ b.ToTable("EmailDecryptionKeys");});modelBuilder.Entity("AliasServerDb.EmailPart", b =>@@ -550,7 +589,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("EmailId", "PartIndex").IsUnique();- b.ToTable("EmailParts", (string)null);+ b.ToTable("EmailParts");});modelBuilder.Entity("AliasServerDb.Group", b =>@@ -596,7 +635,73 @@ namespace AliasServerDb.Migrationsb.HasKey("Id");- b.ToTable("Groups", (string)null);+ 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>("EncryptedVek")+ .HasColumnType("text");++ 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<int>("Role")+ .HasColumnType("integer");++ 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<Guid?>("VaultManifestId")+ .HasColumnType("uuid");++ b.HasKey("Id");++ b.HasIndex("InviterUserId");++ b.HasIndex("UserGrantKeyId");++ b.HasIndex("GroupId", "InviteeUserId")+ .IsUnique()+ .HasDatabaseName("UX_GroupInvitations_Group_Invitee_Pending")+ .HasFilter("\"State\" = 'Pending'");++ b.HasIndex("InviteeUserId", "State");++ b.ToTable("GroupInvitations");});modelBuilder.Entity("AliasServerDb.GroupMember", b =>@@ -629,7 +734,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("GroupId", "UserId").IsUnique();- b.ToTable("GroupMembers", (string)null);+ b.ToTable("GroupMembers");});modelBuilder.Entity("AliasServerDb.Log", b =>@@ -733,7 +838,7 @@ namespace AliasServerDb.Migrationsb.HasIndex(new[] { "UserId" }, "IX_UserId");- b.ToTable("MobileLoginRequests", (string)null);+ b.ToTable("MobileLoginRequests");});modelBuilder.Entity("AliasServerDb.RateLimit", b =>@@ -791,7 +896,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("LimitType", "Enabled");- b.ToTable("RateLimits", (string)null);+ b.ToTable("RateLimits");});modelBuilder.Entity("AliasServerDb.ServerSetting", b =>@@ -811,7 +916,7 @@ namespace AliasServerDb.Migrationsb.HasKey("Key");- b.ToTable("ServerSettings", (string)null);+ b.ToTable("ServerSettings");});modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>@@ -847,7 +952,7 @@ namespace AliasServerDb.Migrationsb.HasKey("Id");- b.ToTable("TaskRunnerJobs", (string)null);+ b.ToTable("TaskRunnerJobs");});modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>@@ -890,7 +995,7 @@ namespace AliasServerDb.Migrations.HasDatabaseName("UX_UserGrantKeys_User_Primary").HasFilter("\"IsPrimary\"");- b.ToTable("UserGrantKeys", (string)null);+ b.ToTable("UserGrantKeys");});modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>@@ -944,7 +1049,7 @@ namespace AliasServerDb.Migrations.IsUnique().HasDatabaseName("UX_UserUnlockKeys_UserId_Type_Label");- b.ToTable("UserUnlockKeys", (string)null);+ b.ToTable("UserUnlockKeys");});modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>@@ -982,7 +1087,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("OwnerUserId", "Category");- b.ToTable("VaultBlobObjects", (string)null);+ b.ToTable("VaultBlobObjects");});modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>@@ -999,7 +1104,7 @@ namespace AliasServerDb.Migrationsb.HasKey("ManifestId", "RevisionNumber", "BlobHash");- b.ToTable("VaultBlobReferences", (string)null);+ b.ToTable("VaultBlobReferences");});modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>@@ -1033,7 +1138,7 @@ namespace AliasServerDb.Migrationsb.HasKey("ManifestId", "Category");- b.ToTable("VaultDataBuckets", (string)null);+ b.ToTable("VaultDataBuckets");});modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>@@ -1067,7 +1172,7 @@ namespace AliasServerDb.Migrationsb.HasKey("ManifestId", "Category", "RevisionNumber");- b.ToTable("VaultDataBucketsHistory", (string)null);+ b.ToTable("VaultDataBucketsHistory");});modelBuilder.Entity("AliasServerDb.VaultManifest", b =>@@ -1145,7 +1250,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("OwnerGroupId");- b.ToTable("VaultManifests", (string)null);+ b.ToTable("VaultManifests");});modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>@@ -1208,7 +1313,7 @@ namespace AliasServerDb.Migrations.IsUnique().HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest_Version");- b.ToTable("VaultManifestAccessKeys", (string)null);+ b.ToTable("VaultManifestAccessKeys");});modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>@@ -1243,7 +1348,7 @@ namespace AliasServerDb.Migrationsb.HasIndex("VaultManifestId", "IsPrimary");- b.ToTable("VaultManifestDeliveryKeys", (string)null);+ b.ToTable("VaultManifestDeliveryKeys");});modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>@@ -1342,7 +1447,7 @@ namespace AliasServerDb.Migrationsb.HasKey("Id");- b.ToTable("WorkerServiceStatuses", (string)null);+ b.ToTable("WorkerServiceStatuses");});modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>@@ -1361,7 +1466,7 @@ namespace AliasServerDb.Migrationsb.HasKey("Id");- b.ToTable("DataProtectionKeys", (string)null);+ b.ToTable("DataProtectionKeys");});modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>@@ -1427,6 +1532,23 @@ namespace AliasServerDb.Migrationsb.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")@@ -1468,9 +1590,9 @@ namespace AliasServerDb.Migrationsb.HasOne("AliasServerDb.VaultManifestDeliveryKey", "VaultManifestDeliveryKey").WithMany("DecryptionKeys").HasForeignKey("VaultManifestDeliveryKeyId")- .HasConstraintName("FK_EmailDecryptionKeys_VaultManifestDeliveryKeys_DeliveryKeyId").OnDelete(DeleteBehavior.Cascade)- .IsRequired();+ .IsRequired()+ .HasConstraintName("FK_EmailDecryptionKeys_VaultManifestDeliveryKeys_DeliveryKeyId");b.Navigation("Email");@@ -1488,6 +1610,40 @@ namespace AliasServerDb.Migrationsb.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")@@ -1653,9 +1809,9 @@ namespace AliasServerDb.Migrations{b.Navigation("Attachments");- b.Navigation("Parts");-b.Navigation("DecryptionKeys");++ b.Navigation("Parts");});modelBuilder.Entity("AliasServerDb.EmailClaim", b =>diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/CreateGroupInvitationRequest.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/CreateGroupInvitationRequest.csnew file mode 100644index 000000000..29d544074--- /dev/null+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/CreateGroupInvitationRequest.cs@@ -0,0 +1,26 @@+//-----------------------------------------------------------------------+// <copyright file="CreateGroupInvitationRequest.cs" company="aliasvault">+// Copyright (c) aliasvault. All rights reserved.+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasVault.Shared.Models.WebApi.V2.Groups;++using AliasVault.Shared.Models.WebApi.V2.Sharing;++/// <summary>+/// Request for POST /v2/Groups/{groupId}/invitations: invite an account to join the group, handing it the group's+/// vault key sealed for that account in the same call.+/// </summary>+public class CreateGroupInvitationRequest+{+ /// <summary>Gets or sets the account to invite, as resolved by the recipient lookup.</summary>+ public required string UserId { get; set; }++ /// <summary>Gets or sets the group's vault key, encrypted for the invitee's public key.</summary>+ public required ManifestGrant Grant { get; set; }++ /// <summary>Gets or sets the algorithm the grant is encrypted with.</summary>+ public required string Algorithm { get; set; }+}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/CreateGroupInvitationResponse.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/CreateGroupInvitationResponse.csnew file mode 100644index 000000000..bacd9a286--- /dev/null+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/CreateGroupInvitationResponse.cs@@ -0,0 +1,17 @@+//-----------------------------------------------------------------------+// <copyright file="CreateGroupInvitationResponse.cs" company="aliasvault">+// Copyright (c) aliasvault. All rights reserved.+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasVault.Shared.Models.WebApi.V2.Groups;++/// <summary>+/// Response for POST /v2/Groups/{groupId}/invitations.+/// </summary>+public class CreateGroupInvitationResponse+{+ /// <summary>Gets or sets the id of the created invitation.</summary>+ public required Guid InvitationId { get; set; }+}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupInfo.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupInfo.csnew file mode 100644index 000000000..ff4af9d7a--- /dev/null+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupInfo.cs@@ -0,0 +1,44 @@+//-----------------------------------------------------------------------+// <copyright file="GroupInfo.cs" company="aliasvault">+// Copyright (c) aliasvault. All rights reserved.+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasVault.Shared.Models.WebApi.V2.Groups;++/// <summary>+/// One shared group the caller belongs to.+/// </summary>+public class GroupInfo+{+ /// <summary>+ /// Gets or sets the group id.+ /// </summary>+ public required Guid GroupId { get; set; }++ /// <summary>+ /// Gets or sets the group's display name.+ /// </summary>+ public required string Name { get; set; }++ /// <summary>+ /// Gets or sets the caller's own role in it.+ /// </summary>+ public required string Role { get; set; }++ /// <summary>+ /// Gets or sets the group's shared vault if it exists.+ /// </summary>+ public Guid? ManifestId { get; set; }++ /// <summary>+ /// Gets or sets the group's members.+ /// </summary>+ public List<GroupMemberInfo> Members { get; set; } = [];++ /// <summary>+ /// Gets or sets the invitations sent from this group that are still awaiting an answer (only filled if caller has sufficient permissions).+ /// </summary>+ public List<SentGroupInvitation> PendingInvitations { get; set; } = [];+}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupInvitationRecipientRequest.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupInvitationRecipientRequest.csnew file mode 100644index 000000000..75f0936d4--- /dev/null+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupInvitationRecipientRequest.cs@@ -0,0 +1,17 @@+//-----------------------------------------------------------------------+// <copyright file="GroupInvitationRecipientRequest.cs" company="aliasvault">+// Copyright (c) aliasvault. All rights reserved.+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasVault.Shared.Models.WebApi.V2.Groups;++/// <summary>+/// Request for POST /v2/Groups/{groupId}/invitations/recipient: who the caller means to invite.+/// </summary>+public class GroupInvitationRecipientRequest+{+ /// <summary>Gets or sets the username typed by the inviting admin.</summary>+ public required string Username { get; set; }+}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupInvitationRecipientResponse.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupInvitationRecipientResponse.csnew file mode 100644index 000000000..b0222bd1f--- /dev/null+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupInvitationRecipientResponse.cs@@ -0,0 +1,20 @@+//-----------------------------------------------------------------------+// <copyright file="GroupInvitationRecipientResponse.cs" company="aliasvault">+// Copyright (c) aliasvault. All rights reserved.+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasVault.Shared.Models.WebApi.V2.Groups;++using AliasVault.Shared.Models.WebApi.V2.Sharing;++/// <summary>+/// Response for POST /v2/Groups/{groupId}/invitations/recipient: the account behind a username together with the+/// public key an invitation to it has to be sealed for.+/// </summary>+public class GroupInvitationRecipientResponse+{+ /// <summary>Gets or sets the resolved account and the key to seal the group's vault key for.</summary>+ public required GrantRecipient Recipient { 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.csnew file mode 100644index 000000000..7eada2535--- /dev/null+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupMemberInfo.cs@@ -0,0 +1,23 @@+//-----------------------------------------------------------------------+// <copyright file="GroupMemberInfo.cs" company="aliasvault">+// Copyright (c) aliasvault. All rights reserved.+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasVault.Shared.Models.WebApi.V2.Groups;++/// <summary>+/// One member of a shared group.+/// </summary>+public class GroupMemberInfo+{+ /// <summary>Gets or sets the member's user id.</summary>+ public required string UserId { get; set; }++ /// <summary>Gets or sets the member's username, the only thing the other members identify them by.</summary>+ public required string Username { get; set; }++ /// <summary>Gets or sets their role in the group.</summary>+ public required string Role { get; set; }+}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupOverviewResponse.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupOverviewResponse.csnew file mode 100644index 000000000..7f2b93712--- /dev/null+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/GroupOverviewResponse.cs@@ -0,0 +1,24 @@+//-----------------------------------------------------------------------+// <copyright file="GroupOverviewResponse.cs" company="aliasvault">+// Copyright (c) aliasvault. All rights reserved.+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasVault.Shared.Models.WebApi.V2.Groups;++/// <summary>+/// Response for GET /v2/Groups.+/// </summary>+public class GroupOverviewResponse+{+ /// <summary>+ /// Gets or sets the shared groups the caller belongs to, with each groups metadata.+ /// </summary>+ public List<GroupInfo> Groups { get; set; } = [];++ /// <summary>+ /// Gets or sets the open invitations addressed to the caller, awaiting their accept or decline.+ /// </summary>+ public List<ReceivedGroupInvitation> ReceivedInvitations { get; set; } = [];+}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/ReceivedGroupInvitation.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/ReceivedGroupInvitation.csnew file mode 100644index 000000000..52a2b90b5--- /dev/null+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/ReceivedGroupInvitation.cs@@ -0,0 +1,29 @@+//-----------------------------------------------------------------------+// <copyright file="ReceivedGroupInvitation.cs" company="aliasvault">+// Copyright (c) aliasvault. All rights reserved.+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasVault.Shared.Models.WebApi.V2.Groups;++/// <summary>+/// An open invitation addressed to the caller: an offer to join somebody else's group.+/// </summary>+public class ReceivedGroupInvitation+{+ /// <summary>Gets or sets the invitation id, used to accept or decline it.</summary>+ public required Guid Id { get; set; }++ /// <summary>Gets or sets the group being joined.</summary>+ public required Guid GroupId { get; set; }++ /// <summary>Gets or sets the group's display name.</summary>+ public required string GroupName { get; set; }++ /// <summary>Gets or sets the username of the member who sent it.</summary>+ public required string InviterUsername { get; set; }++ /// <summary>Gets or sets when it was sent.</summary>+ public required DateTime CreatedAt { get; set; }+}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SentGroupInvitation.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SentGroupInvitation.csnew file mode 100644index 000000000..955495655--- /dev/null+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SentGroupInvitation.cs@@ -0,0 +1,23 @@+//-----------------------------------------------------------------------+// <copyright file="SentGroupInvitation.cs" company="aliasvault">+// Copyright (c) aliasvault. All rights reserved.+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasVault.Shared.Models.WebApi.V2.Groups;++/// <summary>+/// An invitation sent from a group that is still awaiting the invitee's answer.+/// </summary>+public class SentGroupInvitation+{+ /// <summary>Gets or sets the invitation id, used to withdraw it.</summary>+ public required Guid Id { get; set; }++ /// <summary>Gets or sets the username it was sent to.</summary>+ public required string InviteeUsername { get; set; }++ /// <summary>Gets or sets when it was sent.</summary>+ public required DateTime CreatedAt { get; set; }+}diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Sharing/CreateSharedManifestRequest.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Sharing/CreateSharedManifestRequest.csindex b345be2ba..a5c5cb330 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Sharing/CreateSharedManifestRequest.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Sharing/CreateSharedManifestRequest.cs@@ -32,13 +32,11 @@ public class CreateSharedManifestRequest/// <summary>Gets or sets the manifest VEK encrypted with the caller's own public key (base64), decryptable only by the caller.</summary>public required string SelfEncryptedVek { get; set; }- /// <summary>Gets or sets the id of the caller's own account public key used to encrypt (from GET /v2/Sharing/recipient for their own username).</summary>- public required Guid SelfPublicKeyId { get; set; }+ /// <summary>+ /// Gets or sets the caller's own account public key (JWK) the <see cref="SelfEncryptedVek"/> was encrypted with.+ /// </summary>+ public required string SelfPublicKey { get; set; }- /// <summary>Gets or sets the asymmetric algorithm used, both for the caller's own grant and for <see cref="Grants"/>.</summary>+ /// <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 grants handed to fellow group members, applied in the same transaction as the- /// manifest itself (optional).</summary>- public List<ManifestGrant> Grants { get; set; } = [];}