Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Refactor and squash unreleased migrations

Leendert de Borstd8c4deb3fd5d
diff --git a/apps/server/AliasVault.Admin/Main/Pages/Users/View/Index.razor b/apps/server/AliasVault.Admin/Main/Pages/Users/View/Index.razor
index bd1c49337..1ab0bdfa8 100644
--- a/apps/server/AliasVault.Admin/Main/Pages/Users/View/Index.razor
+++ b/apps/server/AliasVault.Admin/Main/Pages/Users/View/Index.razor
@@ -587,7 +587,7 @@ Do you want to proceed with the restoration?")) {
{
return await dbContext.VaultManifestAccessKeys.AnyAsync(x => x.UserId == userId && x.Type == ManifestKeyType.GrantKey)
|| await dbContext.GroupMembers.AnyAsync(x => x.UserId == userId && x.Group.Type != GroupType.Personal)
- || await dbContext.GroupInvitations.AnyAsync(x => x.InviteeUserId == userId);
+ || await dbContext.VaultManifestInvitations.AnyAsync(x => x.InviteeUserId == userId);
}
/// <summary>
diff --git a/apps/server/AliasVault.Api/Controllers/V2/GroupsController.cs b/apps/server/AliasVault.Api/Controllers/V2/GroupsController.cs
index a790bb445..c646533b7 100644
--- a/apps/server/AliasVault.Api/Controllers/V2/GroupsController.cs
+++ b/apps/server/AliasVault.Api/Controllers/V2/GroupsController.cs
@@ -366,8 +366,8 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
}
/// <summary>
- /// Offer a member of the group access to one of its shared manifests, handing over the manifest key encrypted for them in
- /// the same call. The offer becomes a grant once they accept it.
+ /// Offer a certified account access to the group's shared manifest, handing over the manifest key encrypted for them in
+ /// the same call. The offer becomes a grant, and the account a member of the group, once they accept it.
/// </summary>
/// <param name="groupId">The group ID.</param>
/// <param name="manifestId">The shared manifest to give access to.</param>
@@ -404,23 +404,16 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
return ApiError.Result(ApiErrorCode.SHARED_MANIFEST_NOT_FOUND, 404);
}
- /*
- * Handing out a key is only meaningful for somebody who holds it: with several manifests per group, being an
- * admin of the group no longer implies access to each one of them, and an admin who was left out of a manifest
- * cannot pass on what they cannot open.
- */
+ // Only somebody who holds the manifest key can hand it out.
if (!await ManifestAccessHelper.HoldsGrantAsync(context, me.Id, manifestId))
{
return ApiError.Result(ApiErrorCode.SHARED_MANIFEST_NOT_FOUND, 404);
}
- /*
- * Access goes to a member of the group, or to an account the caller certified with its account fingerprint: accepting
- * such an offer also makes them a member. Without the certification nobody can be invited by a bare user id.
- */
- if (!await GroupHelper.IsSharedGroupMemberAsync(context, groupId, model.UserId) && !await HasCertifiedAsync(context, me.Id, model.UserId, await GrantHelper.GetPrimarySigningKeyAsync(context, model.UserId)))
+ // Access only goes to an account whose current signing key the caller certified with its account fingerprint.
+ if (!await HasCertifiedAsync(context, me.Id, model.UserId, await GrantHelper.GetPrimarySigningKeyAsync(context, model.UserId)))
{
- return ApiError.Result(ApiErrorCode.NOT_GROUP_MEMBER, 400);
+ return ApiError.Result(ApiErrorCode.MEMBER_NOT_VERIFIED, 400);
}
// The encrypted key and the offer have to be about the same person.
@@ -458,19 +451,19 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
await CloseStaleInvitationsAsync(context, manifestId, manifestKeyVersion.Value);
await CloseExpiredInvitationsAsync(context, manifestId);
- if (await context.GroupInvitations.AnyAsync(i => i.VaultManifestId == manifestId && i.InviteeUserId == model.UserId && i.State == GroupInvitationState.Pending))
+ if (await context.VaultManifestInvitations.AnyAsync(i => i.VaultManifestId == manifestId && i.InviteeUserId == model.UserId && i.State == VaultManifestInvitationState.Pending))
{
return ApiError.Result(ApiErrorCode.INVITATION_ALREADY_EXISTS, 400);
}
- var invitation = new GroupInvitation
+ var invitation = new VaultManifestInvitation
{
Id = Guid.NewGuid(),
GroupId = groupId,
InviterUserId = me.Id,
InviteeUserId = model.UserId,
Role = GroupRole.Member,
- State = GroupInvitationState.Pending,
+ State = VaultManifestInvitationState.Pending,
VaultManifestId = manifestId,
EncryptedVek = model.Grant.EncryptedVek,
EncryptedName = model.Grant.EncryptedName,
@@ -483,7 +476,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
CreatedAt = timeProvider.GetUtcNow().UtcDateTime,
UpdatedAt = timeProvider.GetUtcNow().UtcDateTime,
};
- context.GroupInvitations.Add(invitation);
+ context.VaultManifestInvitations.Add(invitation);
try
{
@@ -780,7 +773,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
await LockGroupMembersAsync(context, groupId);
var cutoff = InvitationCutoff();
- if (await context.GroupMembers.AnyAsync(m => m.GroupId == groupId && m.UserId != me.Id) || await context.GroupInvitations.AnyAsync(i => i.GroupId == groupId && i.State == GroupInvitationState.Pending && i.CreatedAt >= cutoff))
+ if (await context.GroupMembers.AnyAsync(m => m.GroupId == groupId && m.UserId != me.Id) || await context.VaultManifestInvitations.AnyAsync(i => i.GroupId == groupId && i.State == VaultManifestInvitationState.Pending && i.CreatedAt >= cutoff))
{
return ApiError.Result(ApiErrorCode.SHARED_MANIFEST_IN_USE, 400);
}
@@ -810,8 +803,8 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
}
// Read the offer's group and manifest only to know which locks to take; the offer itself is read again under the locks.
- var offer = await context.GroupInvitations
- .Where(i => i.Id == invitationId && i.InviteeUserId == me.Id && i.State == GroupInvitationState.Pending)
+ var offer = await context.VaultManifestInvitations
+ .Where(i => i.Id == invitationId && i.InviteeUserId == me.Id && i.State == VaultManifestInvitationState.Pending)
.Select(i => new { i.GroupId, i.VaultManifestId })
.FirstOrDefaultAsync();
@@ -820,10 +813,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
return ApiError.Result(ApiErrorCode.INVITATION_NOT_FOUND, 404);
}
- if (offer.VaultManifestId is not Guid offeredManifestId)
- {
- return ApiError.Result(ApiErrorCode.INVITATION_NOT_FOUND, 404);
- }
+ var offeredManifestId = offer.VaultManifestId;
/*
* Under the group's member lock (accepting can add the invitee to the group, and a removal or deletion either lands
@@ -837,7 +827,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
await LockGroupMembersAsync(context, offer.GroupId);
await LockManifestGrantsAsync(context, offeredManifestId);
- var invitation = await context.GroupInvitations.FirstOrDefaultAsync(i => i.Id == invitationId && i.InviteeUserId == me.Id && i.State == GroupInvitationState.Pending);
+ var invitation = await context.VaultManifestInvitations.FirstOrDefaultAsync(i => i.Id == invitationId && i.InviteeUserId == me.Id && i.State == VaultManifestInvitationState.Pending);
if (invitation is null)
{
return ApiError.Result(ApiErrorCode.INVITATION_NOT_FOUND, 404);
@@ -846,8 +836,8 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
// Accepting makes the invitee a member of the shared manifest's group.
var isMember = await GroupHelper.IsSharedGroupMemberAsync(context, invitation.GroupId, me.Id);
- var manifestKeyVersion = invitation.VaultManifestId is null ? null : await context.VaultManifests
- .Where(m => m.ManifestId == invitation.VaultManifestId.Value && m.OwnerGroupId == invitation.GroupId)
+ var manifestKeyVersion = await context.VaultManifests
+ .Where(m => m.ManifestId == invitation.VaultManifestId && m.OwnerGroupId == invitation.GroupId)
.Select(m => (int?)m.KeyVersion)
.FirstOrDefaultAsync();
@@ -859,18 +849,18 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
// If the current manifest key version is different from the one the invitation was encrypted under, it is no longer valid.
if (manifestKeyVersion.Value != invitation.VaultKeyVersion)
{
- return await CloseAndCommitAsync(context, transaction, invitation, GroupInvitationState.Stale, ApiErrorCode.INVITATION_KEY_OUTDATED, 400);
+ return await CloseAndCommitAsync(context, transaction, invitation, VaultManifestInvitationState.Stale, ApiErrorCode.INVITATION_KEY_OUTDATED, 400);
}
if (invitation.CreatedAt < InvitationCutoff())
{
- return await CloseAndCommitAsync(context, transaction, invitation, GroupInvitationState.Expired, ApiErrorCode.INVITATION_NOT_FOUND, 404);
+ return await CloseAndCommitAsync(context, transaction, invitation, VaultManifestInvitationState.Expired, ApiErrorCode.INVITATION_NOT_FOUND, 404);
}
// The offer is only as good as the inviter's right to make it, checked again now and not only when it was sent.
if (!await InviterMayStillGrantAsync(context, invitation))
{
- return await CloseAndCommitAsync(context, transaction, invitation, GroupInvitationState.Revoked, ApiErrorCode.INVITATION_NOT_FOUND, 404);
+ return await CloseAndCommitAsync(context, transaction, invitation, VaultManifestInvitationState.Revoked, ApiErrorCode.INVITATION_NOT_FOUND, 404);
}
// The invitee has certified the key the offer is signed with (their client did, with the inviter's account fingerprint).
@@ -904,7 +894,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
context.GroupMembers.Add(new GroupMember { Id = Guid.NewGuid(), GroupId = invitation.GroupId, UserId = me.Id, Role = GroupRole.Member, CreatedAt = joinedAt, UpdatedAt = joinedAt });
}
- invitation.State = GroupInvitationState.Accepted;
+ invitation.State = VaultManifestInvitationState.Accepted;
invitation.RespondedAt = timeProvider.GetUtcNow().UtcDateTime;
invitation.UpdatedAt = timeProvider.GetUtcNow().UtcDateTime;
@@ -937,13 +927,13 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
return ApiError.Result(ApiErrorCode.NOT_AUTHENTICATED, 401);
}
- var invitation = await context.GroupInvitations.FirstOrDefaultAsync(i => i.Id == invitationId && i.InviteeUserId == me.Id && i.State == GroupInvitationState.Pending);
+ var invitation = await context.VaultManifestInvitations.FirstOrDefaultAsync(i => i.Id == invitationId && i.InviteeUserId == me.Id && i.State == VaultManifestInvitationState.Pending);
if (invitation is null)
{
return ApiError.Result(ApiErrorCode.INVITATION_NOT_FOUND, 404);
}
- CloseInvitation(invitation, GroupInvitationState.Declined);
+ CloseInvitation(invitation, VaultManifestInvitationState.Declined);
await context.SaveChangesAsync();
return Ok();
@@ -964,13 +954,13 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
return ApiError.Result(ApiErrorCode.NOT_AUTHENTICATED, 401);
}
- var invitation = await context.GroupInvitations.FirstOrDefaultAsync(i => i.Id == invitationId && i.State == GroupInvitationState.Pending);
+ var invitation = await context.VaultManifestInvitations.FirstOrDefaultAsync(i => i.Id == invitationId && i.State == VaultManifestInvitationState.Pending);
if (invitation is null || !await GroupHelper.IsGroupAdminAsync(context, invitation.GroupId, me.Id))
{
return ApiError.Result(ApiErrorCode.INVITATION_NOT_FOUND, 404);
}
- CloseInvitation(invitation, GroupInvitationState.Revoked);
+ CloseInvitation(invitation, VaultManifestInvitationState.Revoked);
await context.SaveChangesAsync();
return Ok();
@@ -985,11 +975,11 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
/// <returns>Manifest id to its open offers.</returns>
private static async Task<Dictionary<Guid, List<SentManifestInvitation>>> GetOpenInvitationsByManifestAsync(AliasServerDbContext context, List<Guid> groupIds, DateTime createdAfter)
{
- return (await context.GroupInvitations
- .Where(i => groupIds.Contains(i.GroupId) && i.State == GroupInvitationState.Pending && i.VaultManifestId != null && i.CreatedAt >= createdAfter)
+ return (await context.VaultManifestInvitations
+ .Where(i => groupIds.Contains(i.GroupId) && i.State == VaultManifestInvitationState.Pending && i.CreatedAt >= createdAfter)
.Select(i => new
{
- ManifestId = i.VaultManifestId!.Value,
+ ManifestId = i.VaultManifestId,
Invitation = new SentManifestInvitation { Id = i.Id, InviteeUserId = i.InviteeUserId, InviteeUsername = i.Invitee.UserName ?? string.Empty, CreatedAt = i.CreatedAt },
})
.ToListAsync())
@@ -1050,8 +1040,8 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
private static async Task<List<ReceivedManifestInvitation>> GetReceivedInvitationsAsync(AliasServerDbContext context, string userId, DateTime createdAfter)
{
// Offers the recipient could no longer accept (expired, or the inviter lost the right to make them) are left out.
- var invitations = await context.GroupInvitations
- .Where(i => i.InviteeUserId == userId && i.State == GroupInvitationState.Pending && i.Group.Type == GroupType.Shared && i.VaultManifestId != null && i.CreatedAt >= createdAfter)
+ var invitations = await context.VaultManifestInvitations
+ .Where(i => i.InviteeUserId == userId && i.State == VaultManifestInvitationState.Pending && i.Group.Type == GroupType.Shared && i.CreatedAt >= createdAfter)
.Where(i => context.GroupMembers.Any(m => m.GroupId == i.GroupId && m.UserId == i.InviterUserId && (m.Role == GroupRole.Owner || m.Role == GroupRole.Admin)))
.Where(i => context.VaultManifestAccessKeys.Any(k => k.UserId == i.InviterUserId && k.Type == ManifestKeyType.GrantKey && k.VaultManifestId == i.VaultManifestId))
.OrderBy(i => i.CreatedAt)
@@ -1059,7 +1049,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
{
i.Id,
i.GroupId,
- ManifestId = i.VaultManifestId!.Value,
+ ManifestId = i.VaultManifestId,
InviterUsername = i.Inviter.UserName ?? string.Empty,
i.InviterUserId,
i.CreatedAt,
@@ -1114,11 +1104,9 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
/// <param name="context">The database context.</param>
/// <param name="invitation">The invitation.</param>
/// <returns>True when the inviter may still hand out this manifest's key.</returns>
- private static async Task<bool> InviterMayStillGrantAsync(AliasServerDbContext context, GroupInvitation invitation)
+ private static async Task<bool> InviterMayStillGrantAsync(AliasServerDbContext context, VaultManifestInvitation invitation)
{
- return invitation.VaultManifestId is Guid manifestId
- && await GroupHelper.IsSharedGroupAdminAsync(context, invitation.GroupId, invitation.InviterUserId)
- && await ManifestAccessHelper.HoldsGrantAsync(context, invitation.InviterUserId, manifestId);
+ return await GroupHelper.IsSharedGroupAdminAsync(context, invitation.GroupId, invitation.InviterUserId) && await ManifestAccessHelper.HoldsGrantAsync(context, invitation.InviterUserId, invitation.VaultManifestId);
}
/// <summary>
@@ -1236,7 +1224,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
return true;
}
- if (await context.GroupInvitations.AnyAsync(i => i.InviterUserId == subjectUserId && i.InviteeUserId == certifierUserId && i.State == GroupInvitationState.Pending))
+ if (await context.VaultManifestInvitations.AnyAsync(i => i.InviterUserId == subjectUserId && i.InviteeUserId == certifierUserId && i.State == VaultManifestInvitationState.Pending))
{
return true;
}
@@ -1256,9 +1244,9 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
var manifestId = manifest.ManifestId;
// Close any open invite.
- foreach (var invitation in await context.GroupInvitations.Where(i => i.VaultManifestId == manifestId && i.State == GroupInvitationState.Pending).ToListAsync())
+ foreach (var invitation in await context.VaultManifestInvitations.Where(i => i.VaultManifestId == manifestId && i.State == VaultManifestInvitationState.Pending).ToListAsync())
{
- CloseInvitation(invitation, GroupInvitationState.Revoked);
+ CloseInvitation(invitation, VaultManifestInvitationState.Revoked);
}
// Delete any active grant.
@@ -1292,7 +1280,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
/// </summary>
/// <param name="invitation">The invitation to close.</param>
/// <param name="state">The state it ends in.</param>
- private void CloseInvitation(GroupInvitation invitation, GroupInvitationState state)
+ private void CloseInvitation(VaultManifestInvitation invitation, VaultManifestInvitationState state)
{
invitation.State = state;
invitation.EncryptedVek = null;
@@ -1315,14 +1303,14 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
/// <param name="grantSignature">The accepting user's signature over the grant, already verified.</param>
/// <param name="signerPublicKey">The accepting user's signing public key the signature verifies under.</param>
/// <returns>Whether the accepting user ends up holding a grant on the manifest.</returns>
- private async Task<bool> PromoteInvitationGrantAsync(AliasServerDbContext context, GroupInvitation invitation, string userId, int keyVersion, string grantSignature, string signerPublicKey)
+ private async Task<bool> PromoteInvitationGrantAsync(AliasServerDbContext context, VaultManifestInvitation invitation, string userId, int keyVersion, string grantSignature, string signerPublicKey)
{
- if (invitation.EncryptedVek is null || invitation.UserGrantKeyId is null || invitation.VaultManifestId is null)
+ if (invitation.EncryptedVek is null || invitation.UserGrantKeyId is null)
{
return false;
}
- var manifestId = invitation.VaultManifestId.Value;
+ var manifestId = invitation.VaultManifestId;
if (await ManifestAccessHelper.HoldsGrantAsync(context, userId, manifestId))
{
return true;
@@ -1392,9 +1380,9 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
return ApiError.Result(ApiErrorCode.LAST_MANIFEST_GRANT_HOLDER, 400);
}
- foreach (var invitation in await context.GroupInvitations.Where(i => i.VaultManifestId == manifestId && i.InviteeUserId == userId && i.State == GroupInvitationState.Pending).ToListAsync())
+ foreach (var invitation in await context.VaultManifestInvitations.Where(i => i.VaultManifestId == manifestId && i.InviteeUserId == userId && i.State == VaultManifestInvitationState.Pending).ToListAsync())
{
- CloseInvitation(invitation, GroupInvitationState.Revoked);
+ CloseInvitation(invitation, VaultManifestInvitationState.Revoked);
}
if (await GrantHelper.RevokeAccessAsync(context, manifestId, userId))
@@ -1426,7 +1414,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
/// <param name="errorCode">The error to answer with.</param>
/// <param name="statusCode">The HTTP status to answer with.</param>
/// <returns>The error result.</returns>
- private async Task<IActionResult> CloseAndCommitAsync(AliasServerDbContext context, IDbContextTransaction transaction, GroupInvitation invitation, GroupInvitationState state, ApiErrorCode errorCode, int statusCode)
+ private async Task<IActionResult> CloseAndCommitAsync(AliasServerDbContext context, IDbContextTransaction transaction, VaultManifestInvitation invitation, VaultManifestInvitationState state, ApiErrorCode errorCode, int statusCode)
{
CloseInvitation(invitation, state);
await context.SaveChangesAsync();
@@ -1452,13 +1440,13 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
private async Task CloseExpiredInvitationsAsync(AliasServerDbContext context, Guid manifestId)
{
var cutoff = InvitationCutoff();
- var expired = await context.GroupInvitations
- .Where(i => i.VaultManifestId == manifestId && i.State == GroupInvitationState.Pending && i.CreatedAt < cutoff)
+ var expired = await context.VaultManifestInvitations
+ .Where(i => i.VaultManifestId == manifestId && i.State == VaultManifestInvitationState.Pending && i.CreatedAt < cutoff)
.ToListAsync();
foreach (var invitation in expired)
{
- CloseInvitation(invitation, GroupInvitationState.Expired);
+ CloseInvitation(invitation, VaultManifestInvitationState.Expired);
}
}
@@ -1472,13 +1460,13 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use
/// <returns>A task.</returns>
private async Task CloseStaleInvitationsAsync(AliasServerDbContext context, Guid manifestId, int keyVersion)
{
- var stale = await context.GroupInvitations
- .Where(i => i.VaultManifestId == manifestId && i.State == GroupInvitationState.Pending && i.VaultKeyVersion != keyVersion)
+ var stale = await context.VaultManifestInvitations
+ .Where(i => i.VaultManifestId == manifestId && i.State == VaultManifestInvitationState.Pending && i.VaultKeyVersion != keyVersion)
.ToListAsync();
foreach (var invitation in stale)
{
- CloseInvitation(invitation, GroupInvitationState.Stale);
+ CloseInvitation(invitation, VaultManifestInvitationState.Stale);
}
}
}
diff --git a/apps/server/AliasVault.Api/Controllers/V2/KeyRotationController.cs b/apps/server/AliasVault.Api/Controllers/V2/KeyRotationController.cs
index d5c222d07..01f01d11d 100644
--- a/apps/server/AliasVault.Api/Controllers/V2/KeyRotationController.cs
+++ b/apps/server/AliasVault.Api/Controllers/V2/KeyRotationController.cs
@@ -317,10 +317,10 @@ public class KeyRotationController(ILogger<KeyRotationController> logger, IAlias
await writeContext.VaultBlobObjects.Where(b => b.ManifestId == manifest.ManifestId && !referencedHashes.Contains(b.Hash)).ExecuteDeleteAsync();
// 7) Invitations addressed to this account are encrypted for the old public key and cannot be opened anymore.
- var staleInvitations = await writeContext.GroupInvitations.Where(i => i.InviteeUserId == user.Id && i.State == GroupInvitationState.Pending).ToListAsync();
+ var staleInvitations = await writeContext.VaultManifestInvitations.Where(i => i.InviteeUserId == user.Id && i.State == VaultManifestInvitationState.Pending).ToListAsync();
foreach (var invitation in staleInvitations)
{
- invitation.State = GroupInvitationState.Stale;
+ invitation.State = VaultManifestInvitationState.Stale;
invitation.EncryptedVek = null;
invitation.EncryptedName = null;
invitation.EncryptedNameSignature = null;
diff --git a/apps/server/AliasVault.Api/Helpers/GroupHelper.cs b/apps/server/AliasVault.Api/Helpers/GroupHelper.cs
index 8a9af40c5..75180594e 100644
--- a/apps/server/AliasVault.Api/Helpers/GroupHelper.cs
+++ b/apps/server/AliasVault.Api/Helpers/GroupHelper.cs
@@ -31,8 +31,8 @@ public static class GroupHelper
/// <returns>The number of open offers.</returns>
public static async Task<int> CountOpenInvitationsAsync(AliasServerDbContext context, string userId, DateTime createdAfter)
{
- return await context.GroupInvitations
- .Where(i => i.InviteeUserId == userId && i.State == GroupInvitationState.Pending && i.Group.Type == GroupType.Shared && i.VaultManifestId != null && i.CreatedAt >= createdAfter)
+ return await context.VaultManifestInvitations
+ .Where(i => i.InviteeUserId == userId && i.State == VaultManifestInvitationState.Pending && i.Group.Type == GroupType.Shared && i.CreatedAt >= createdAfter)
.Where(i => context.GroupMembers.Any(m => m.GroupId == i.GroupId && m.UserId == i.InviterUserId && (m.Role == GroupRole.Owner || m.Role == GroupRole.Admin)))
.Where(i => context.VaultManifestAccessKeys.Any(k => k.UserId == i.InviterUserId && k.Type == ManifestKeyType.GrantKey && k.VaultManifestId == i.VaultManifestId))
.CountAsync();
diff --git a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs b/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs
index 8f134162c..614c36acc 100644
--- a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs
+++ b/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs
@@ -117,9 +117,9 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyCon
public DbSet<GroupMember> GroupMembers { get; set; }
/// <summary>
- /// Gets or sets the GroupInvitations DbSet.
+ /// Gets or sets the VaultManifestInvitations DbSet.
/// </summary>
- public DbSet<GroupInvitation> GroupInvitations { get; set; }
+ public DbSet<VaultManifestInvitation> VaultManifestInvitations { get; set; }
/// <summary>
/// Gets or sets the ClientActions DbSet.
@@ -365,8 +365,8 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyCon
builder.Property(e => e.Role).HasConversion<string>().HasMaxLength(20);
});
- // Configure GroupInvitation, an offer to join a group.
- modelBuilder.Entity<GroupInvitation>(builder =>
+ // Configure VaultManifestInvitation, an offer of access to a shared manifest.
+ modelBuilder.Entity<VaultManifestInvitation>(builder =>
{
builder.HasOne(e => e.Group)
.WithMany()
@@ -383,10 +383,8 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyCon
.HasForeignKey(e => e.InviteeUserId)
.OnDelete(DeleteBehavior.Cascade);
- builder.HasIndex(e => new { e.VaultManifestId, e.InviteeUserId }).IsUnique().HasFilter("\"State\" = 'Pending'").HasDatabaseName("UX_GroupInvitations_Manifest_Invitee_Pending");
+ builder.HasIndex(e => new { e.VaultManifestId, e.InviteeUserId }).IsUnique().HasFilter("\"State\" = 'Pending'").HasDatabaseName("UX_VaultManifestInvitations_Manifest_Invitee_Pending");
- // An invitation without a manifest is an invitation to join the group; one open per invitee and group.
- builder.HasIndex(e => new { e.GroupId, e.InviteeUserId }).IsUnique().HasFilter("\"State\" = 'Pending' AND \"VaultManifestId\" IS NULL").HasDatabaseName("UX_GroupInvitations_Group_Invitee_Pending_Join");
builder.Property(e => e.State).HasConversion<string>().HasMaxLength(20);
builder.Property(e => e.Role).HasConversion<string>().HasMaxLength(20);
builder.Property(e => e.Algorithm).HasConversion(v => VaultKeyAlgorithms.ToToken(v), v => VaultKeyAlgorithms.Parse(v));
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20261016094025_RenameUnlockKeysToUnlockMethods.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20261016094025_RenameUnlockKeysToUnlockMethods.Designer.cs
deleted file mode 100644
index 3a0d69df7..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20261016094025_RenameUnlockKeysToUnlockMethods.Designer.cs
+++ /dev/null
@@ -1,2208 +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("20261016094025_RenameUnlockKeysToUnlockMethods")]
- partial class RenameUnlockKeysToUnlockMethods
- {
- /// <inheritdoc />
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "10.0.12")
- .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("NormalizedUserName")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_NormalizedUserName");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.HasIndex("SrpIdentity")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_SrpIdentity");
-
- 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>("PreviousTokenHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("TokenHash")
- .IsRequired()
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.CapabilityRule", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("CapabilityKey")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("ClientName")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("Kind")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Tier")
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("Tier");
-
- b.HasIndex("UserId");
-
- b.HasIndex("CapabilityKey", "Enabled");
-
- b.ToTable("CapabilityRules");
- });
-
- modelBuilder.Entity("AliasServerDb.ClientAction", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Payload")
- .HasColumnType("jsonb");
-
- b.Property<Guid?>("TargetGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("TargetUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Type")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("TargetGroupId");
-
- b.HasIndex("TargetUserId");
-
- b.ToTable("ClientActions");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<int>("AttachmentCount")
- .HasColumnType("integer");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .HasColumnType("text");
-
- b.Property<byte[]>("MessageSourceBytes")
- .HasColumnType("bytea");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("AnonymizedSenderCounted")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("State")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "State");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailDecryptionKey", b =>
- {
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<Guid>("VaultManifestDeliveryKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("EmailId", "VaultManifestDeliveryKeyId");
-
- b.HasIndex("VaultManifestDeliveryKeyId", "EmailId");
-
- b.ToTable("EmailDecryptionKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailPart", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<int>("PartIndex")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId", "PartIndex")
- .IsUnique();
-
- b.ToTable("EmailParts");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.PrimitiveCollection<int[]>("AnonymizedEmailAliasSenderCounts")
- .IsRequired()
- .ValueGeneratedOnAdd()
- .HasColumnType("integer[]")
- .HasDefaultValueSql("array_fill(0, ARRAY[64])");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Type")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupInvitation", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedName")
- .HasColumnType("text");
-
- b.Property<string>("EncryptedNameSignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("EncryptedVek")
- .HasColumnType("text");
-
- b.Property<string>("GrantSignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("GrantSignerPublicKey")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("InviteeUserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("InviterUserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("RespondedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Role")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<string>("State")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<int>("VaultKeyVersion")
- .HasColumnType("integer");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("InviterUserId");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("InviteeUserId", "State");
-
- b.HasIndex("VaultManifestId", "InviteeUserId")
- .IsUnique()
- .HasDatabaseName("UX_GroupInvitations_Manifest_Invitee_Pending")
- .HasFilter("\"State\" = 'Pending'");
-
- b.ToTable("GroupInvitations");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("Role")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientBrowser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientName")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("ClientOperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("DeclinedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("PollSecretHash")
- .IsRequired()
- .HasMaxLength(44)
- .HasColumnType("character varying(44)");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("Tier");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.RegistrationInvite", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Code")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("ExpiresAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("MaxUses")
- .HasColumnType("integer");
-
- b.Property<string>("Note")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("UseCount")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Code" }, "IX_RegistrationInvite_Code")
- .IsUnique();
-
- b.ToTable("RegistrationInvites");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccountKeyVersion")
- .HasColumnType("integer");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(8000)
- .HasColumnType("character varying(8000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<string>("PublicKeySignature")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserGrantKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserGrantKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserSigningKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccountKeyVersion")
- .HasColumnType("integer");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserSigningKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserSigningKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockMethod", 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_UserUnlockMethods_UserId_Type_Label");
-
- b.ToTable("UserUnlockMethods");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockMethodsHistory", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccountKeyVersion")
- .HasColumnType("integer");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("ArchivedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ArchivedByClient")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Label")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<string>("Type")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<Guid>("UnlockMethodId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("ArchivedAt")
- .HasDatabaseName("IX_UserUnlockMethodsHistory_ArchivedAt");
-
- b.HasIndex("UserId", "Type", "ArchivedAt")
- .HasDatabaseName("IX_UserUnlockMethodsHistory_UserId_Type_ArchivedAt");
-
- b.ToTable("UserUnlockMethodsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedBlobKey")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("ManifestId", "Hash");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("ManifestId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("ManifestId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<byte[]>("ManifestBlob")
- .HasColumnType("bytea");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UpdatedByUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId");
-
- b.HasIndex("UpdatedByUserId");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AccountKeyVersion")
- .HasColumnType("integer");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("GrantSignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("GrantSignerPublicKey")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("GrantSignerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<string>("Type")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId", "KeyVersion")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest_Version");
-
- b.ToTable("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("VaultManifestDeliveryKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestShareDetails", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedName")
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("ManifestId");
-
- b.ToTable("VaultManifestShareDetails");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<byte[]>("ManifestBlob")
- .HasColumnType("bytea");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UpdatedByUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.HasIndex("UpdatedByUserId");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.CapabilityRule", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.ClientAction", b =>
- {
- b.HasOne("AliasServerDb.Group", "TargetGroup")
- .WithMany()
- .HasForeignKey("TargetGroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "TargetUser")
- .WithMany()
- .HasForeignKey("TargetUserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("TargetGroup");
-
- b.Navigation("TargetUser");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailDecryptionKey", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("DecryptionKeys")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "VaultManifestDeliveryKey")
- .WithMany("DecryptionKeys")
- .HasForeignKey("VaultManifestDeliveryKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("FK_EmailDecryptionKeys_VaultManifestDeliveryKeys_DeliveryKeyId");
-
- b.Navigation("Email");
-
- b.Navigation("VaultManifestDeliveryKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailPart", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Parts")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupInvitation", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "Invitee")
- .WithMany()
- .HasForeignKey("InviteeUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "Inviter")
- .WithMany()
- .HasForeignKey("InviterUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("Group");
-
- b.Navigation("Invitee");
-
- b.Navigation("Inviter");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("Group");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserSigningKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockMethod", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockMethodsHistory", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("ManifestId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
- .WithMany()
- .HasForeignKey("UpdatedByUserId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("OwnerGroup");
-
- b.Navigation("UpdatedByUser");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifestAccessKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestShareDetails", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithOne()
- .HasForeignKey("AliasServerDb.VaultManifestShareDetails", "ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
- .WithMany()
- .HasForeignKey("UpdatedByUserId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("Manifest");
-
- b.Navigation("UpdatedByUser");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
-
- b.Navigation("DecryptionKeys");
-
- b.Navigation("Parts");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Navigation("DecryptionKeys");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20261016094025_RenameUnlockKeysToUnlockMethods.cs b/apps/server/Databases/AliasServerDb/Migrations/20261016094025_RenameUnlockKeysToUnlockMethods.cs
deleted file mode 100644
index 29fa5c6ee..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20261016094025_RenameUnlockKeysToUnlockMethods.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <summary>
- /// Renames UserUnlockKeys to UserUnlockMethods (and its history table and retention setting) in place; rows are kept as-is.
- /// </summary>
- public partial class RenameUnlockKeysToUnlockMethods : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.Sql("""
- ALTER TABLE "UserUnlockKeys" RENAME CONSTRAINT "PK_UserUnlockKeys" TO "PK_UserUnlockMethods";
- ALTER TABLE "UserUnlockKeys" RENAME CONSTRAINT "FK_UserUnlockKeys_AliasVaultUsers_UserId" TO "FK_UserUnlockMethods_AliasVaultUsers_UserId";
- ALTER TABLE "UserUnlockKeysHistory" RENAME CONSTRAINT "PK_UserUnlockKeysHistory" TO "PK_UserUnlockMethodsHistory";
- ALTER TABLE "UserUnlockKeysHistory" RENAME CONSTRAINT "FK_UserUnlockKeysHistory_AliasVaultUsers_UserId" TO "FK_UserUnlockMethodsHistory_AliasVaultUsers_UserId";
- """);
- migrationBuilder.RenameTable(name: "UserUnlockKeys", newName: "UserUnlockMethods");
- migrationBuilder.RenameTable(name: "UserUnlockKeysHistory", newName: "UserUnlockMethodsHistory");
- migrationBuilder.RenameIndex(name: "UX_UserUnlockKeys_UserId_Type_Label", table: "UserUnlockMethods", newName: "UX_UserUnlockMethods_UserId_Type_Label");
- migrationBuilder.RenameIndex(name: "IX_UserUnlockKeysHistory_ArchivedAt", table: "UserUnlockMethodsHistory", newName: "IX_UserUnlockMethodsHistory_ArchivedAt");
- migrationBuilder.RenameIndex(name: "IX_UserUnlockKeysHistory_UserId_Type_ArchivedAt", table: "UserUnlockMethodsHistory", newName: "IX_UserUnlockMethodsHistory_UserId_Type_ArchivedAt");
- migrationBuilder.RenameColumn(name: "UnlockKeyId", table: "UserUnlockMethodsHistory", newName: "UnlockMethodId");
- migrationBuilder.Sql("""UPDATE "ServerSettings" SET "Key" = 'UnlockMethodHistoryRetentionDays' WHERE "Key" = 'UnlockKeyHistoryRetentionDays';""");
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.Sql("""UPDATE "ServerSettings" SET "Key" = 'UnlockKeyHistoryRetentionDays' WHERE "Key" = 'UnlockMethodHistoryRetentionDays';""");
- migrationBuilder.RenameColumn(name: "UnlockMethodId", table: "UserUnlockMethodsHistory", newName: "UnlockKeyId");
- migrationBuilder.RenameIndex(name: "IX_UserUnlockMethodsHistory_UserId_Type_ArchivedAt", table: "UserUnlockMethodsHistory", newName: "IX_UserUnlockKeysHistory_UserId_Type_ArchivedAt");
- migrationBuilder.RenameIndex(name: "IX_UserUnlockMethodsHistory_ArchivedAt", table: "UserUnlockMethodsHistory", newName: "IX_UserUnlockKeysHistory_ArchivedAt");
- migrationBuilder.RenameIndex(name: "UX_UserUnlockMethods_UserId_Type_Label", table: "UserUnlockMethods", newName: "UX_UserUnlockKeys_UserId_Type_Label");
- migrationBuilder.RenameTable(name: "UserUnlockMethodsHistory", newName: "UserUnlockKeysHistory");
- migrationBuilder.RenameTable(name: "UserUnlockMethods", newName: "UserUnlockKeys");
- migrationBuilder.Sql("""
- ALTER TABLE "UserUnlockKeys" RENAME CONSTRAINT "PK_UserUnlockMethods" TO "PK_UserUnlockKeys";
- ALTER TABLE "UserUnlockKeys" RENAME CONSTRAINT "FK_UserUnlockMethods_AliasVaultUsers_UserId" TO "FK_UserUnlockKeys_AliasVaultUsers_UserId";
- ALTER TABLE "UserUnlockKeysHistory" RENAME CONSTRAINT "PK_UserUnlockMethodsHistory" TO "PK_UserUnlockKeysHistory";
- ALTER TABLE "UserUnlockKeysHistory" RENAME CONSTRAINT "FK_UserUnlockMethodsHistory_AliasVaultUsers_UserId" TO "FK_UserUnlockKeysHistory_AliasVaultUsers_UserId";
- """);
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20261018160722_KeyRotation.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20261018160722_KeyRotation.Designer.cs
deleted file mode 100644
index 07b0ff73e..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20261018160722_KeyRotation.Designer.cs
+++ /dev/null
@@ -1,2212 +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("20261018160722_KeyRotation")]
- partial class KeyRotation
- {
- /// <inheritdoc />
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "10.0.12")
- .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("NormalizedUserName")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_NormalizedUserName");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.HasIndex("SrpIdentity")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_SrpIdentity");
-
- 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>("PreviousTokenHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("TokenHash")
- .IsRequired()
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.CapabilityRule", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("CapabilityKey")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("ClientName")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("Kind")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Tier")
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("Tier");
-
- b.HasIndex("UserId");
-
- b.HasIndex("CapabilityKey", "Enabled");
-
- b.ToTable("CapabilityRules");
- });
-
- modelBuilder.Entity("AliasServerDb.ClientAction", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Payload")
- .HasColumnType("jsonb");
-
- b.Property<Guid?>("TargetGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("TargetUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Type")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("TargetGroupId");
-
- b.HasIndex("TargetUserId");
-
- b.ToTable("ClientActions");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<int>("AttachmentCount")
- .HasColumnType("integer");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .HasColumnType("text");
-
- b.Property<byte[]>("MessageSourceBytes")
- .HasColumnType("bytea");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("AnonymizedSenderCounted")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("State")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "State");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailDecryptionKey", b =>
- {
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<Guid>("VaultManifestDeliveryKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("EmailId", "VaultManifestDeliveryKeyId");
-
- b.HasIndex("VaultManifestDeliveryKeyId", "EmailId");
-
- b.ToTable("EmailDecryptionKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailPart", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<int>("PartIndex")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId", "PartIndex")
- .IsUnique();
-
- b.ToTable("EmailParts");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.PrimitiveCollection<int[]>("AnonymizedEmailAliasSenderCounts")
- .IsRequired()
- .ValueGeneratedOnAdd()
- .HasColumnType("integer[]")
- .HasDefaultValueSql("array_fill(0, ARRAY[64])");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Type")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupInvitation", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedName")
- .HasColumnType("text");
-
- b.Property<string>("EncryptedNameSignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("EncryptedVek")
- .HasColumnType("text");
-
- b.Property<string>("GrantSignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("GrantSignerPublicKey")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("InviteeUserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("InviterUserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("RespondedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Role")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<string>("State")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<int>("VaultKeyVersion")
- .HasColumnType("integer");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("InviterUserId");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("InviteeUserId", "State");
-
- b.HasIndex("VaultManifestId", "InviteeUserId")
- .IsUnique()
- .HasDatabaseName("UX_GroupInvitations_Manifest_Invitee_Pending")
- .HasFilter("\"State\" = 'Pending'");
-
- b.ToTable("GroupInvitations");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("Role")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientBrowser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientName")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("ClientOperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("DeclinedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("PollSecretHash")
- .IsRequired()
- .HasMaxLength(44)
- .HasColumnType("character varying(44)");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("Tier");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.RegistrationInvite", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Code")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("ExpiresAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("MaxUses")
- .HasColumnType("integer");
-
- b.Property<string>("Note")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("UseCount")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Code" }, "IX_RegistrationInvite_Code")
- .IsUnique();
-
- b.ToTable("RegistrationInvites");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccountKeyVersion")
- .HasColumnType("integer");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(8000)
- .HasColumnType("character varying(8000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<string>("PublicKeySignature")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserGrantKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserGrantKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserSigningKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccountKeyVersion")
- .HasColumnType("integer");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PreviousKeySignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserSigningKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserSigningKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockMethod", 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_UserUnlockMethods_UserId_Type_Label");
-
- b.ToTable("UserUnlockMethods");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockMethodsHistory", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int>("AccountKeyVersion")
- .HasColumnType("integer");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("ArchivedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ArchivedByClient")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Label")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<string>("Type")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<Guid>("UnlockMethodId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("ArchivedAt")
- .HasDatabaseName("IX_UserUnlockMethodsHistory_ArchivedAt");
-
- b.HasIndex("UserId", "Type", "ArchivedAt")
- .HasDatabaseName("IX_UserUnlockMethodsHistory_UserId_Type_ArchivedAt");
-
- b.ToTable("UserUnlockMethodsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedBlobKey")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("ManifestId", "Hash");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("ManifestId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("ManifestId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<byte[]>("ManifestBlob")
- .HasColumnType("bytea");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UpdatedByUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId");
-
- b.HasIndex("UpdatedByUserId");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AccountKeyVersion")
- .HasColumnType("integer");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("GrantSignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("GrantSignerPublicKey")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("GrantSignerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<string>("Type")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId", "KeyVersion")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest_Version");
-
- b.ToTable("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("VaultManifestDeliveryKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestShareDetails", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedName")
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("ManifestId");
-
- b.ToTable("VaultManifestShareDetails");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<int>("KeyVersion")
- .HasColumnType("integer");
-
- b.Property<byte[]>("ManifestBlob")
- .HasColumnType("bytea");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UpdatedByUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.HasIndex("UpdatedByUserId");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.CapabilityRule", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.ClientAction", b =>
- {
- b.HasOne("AliasServerDb.Group", "TargetGroup")
- .WithMany()
- .HasForeignKey("TargetGroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "TargetUser")
- .WithMany()
- .HasForeignKey("TargetUserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("TargetGroup");
-
- b.Navigation("TargetUser");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailDecryptionKey", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("DecryptionKeys")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "VaultManifestDeliveryKey")
- .WithMany("DecryptionKeys")
- .HasForeignKey("VaultManifestDeliveryKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("FK_EmailDecryptionKeys_VaultManifestDeliveryKeys_DeliveryKeyId");
-
- b.Navigation("Email");
-
- b.Navigation("VaultManifestDeliveryKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailPart", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Parts")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupInvitation", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "Invitee")
- .WithMany()
- .HasForeignKey("InviteeUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "Inviter")
- .WithMany()
- .HasForeignKey("InviterUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("Group");
-
- b.Navigation("Invitee");
-
- b.Navigation("Inviter");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("Group");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserSigningKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockMethod", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockMethodsHistory", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("ManifestId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
- .WithMany()
- .HasForeignKey("UpdatedByUserId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("OwnerGroup");
-
- b.Navigation("UpdatedByUser");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifestAccessKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestShareDetails", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithOne()
- .HasForeignKey("AliasServerDb.VaultManifestShareDetails", "ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
- .WithMany()
- .HasForeignKey("UpdatedByUserId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("Manifest");
-
- b.Navigation("UpdatedByUser");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
-
- b.Navigation("DecryptionKeys");
-
- b.Navigation("Parts");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Navigation("DecryptionKeys");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20261018160722_KeyRotation.cs b/apps/server/Databases/AliasServerDb/Migrations/20261018160722_KeyRotation.cs
deleted file mode 100644
index 57a695526..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20261018160722_KeyRotation.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class KeyRotation : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<string>(
- name: "PreviousKeySignature",
- table: "UserSigningKeys",
- type: "character varying(255)",
- maxLength: 255,
- nullable: true);
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "PreviousKeySignature",
- table: "UserSigningKeys");
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20261019200112_FamilyInviteCodes.cs b/apps/server/Databases/AliasServerDb/Migrations/20261019200112_FamilyInviteCodes.cs
deleted file mode 100644
index 1ebdf2e28..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20261019200112_FamilyInviteCodes.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class FamilyInviteCodes : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_GroupInvitations_GroupId",
- table: "GroupInvitations");
-
- migrationBuilder.AddColumn<string>(
- name: "Fingerprint",
- table: "UserSigningKeys",
- type: "character varying(20)",
- maxLength: 20,
- nullable: true);
-
- // Backfill the fingerprint as Signing.Fingerprint computes it: SHA-256 over the length-prefixed label and key bytes,
- // the first 16 bytes as an unsigned big-endian integer (two 64-bit halves), modulo 10^20. Checked against the known-answer key.
- migrationBuilder.Sql("""
- UPDATE "UserSigningKeys" SET "Fingerprint" = lpad(mod(
- (v.hi::numeric + CASE WHEN v.hi < 0 THEN 18446744073709551616 ELSE 0 END) * 18446744073709551616
- + (v.lo::numeric + CASE WHEN v.lo < 0 THEN 18446744073709551616 ELSE 0 END), 100000000000000000000)::text, 20, '0')
- FROM (
- SELECT d."Id", ('x' || encode(substring(d.h from 1 for 8), 'hex'))::bit(64)::bigint AS hi, ('x' || encode(substring(d.h from 9 for 8), 'hex'))::bit(64)::bigint AS lo
- FROM (
- SELECT "Id", sha256(int4send(37) || convert_to('aliasvault/v1/signing-key-fingerprint', 'UTF8') || int4send(32) || decode("PublicKey", 'base64')) AS h
- FROM "UserSigningKeys"
- ) AS d
- ) AS v
- WHERE v."Id" = "UserSigningKeys"."Id";
- """);
-
- // A grant opens on a client only when signed by its holder. Grants signed by the inviter predate that rule and would
- // fail every sync of their holder, so they are deleted; the admin invites those members again.
- migrationBuilder.Sql("""
- DELETE FROM "VaultManifestAccessKeys" WHERE "Type" = 'grant-key' AND "GrantSignerUserId" IS NOT NULL AND "GrantSignerUserId" <> "UserId";
- """);
-
- migrationBuilder.CreateTable(
- name: "UserKeyCertifications",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- CertifierUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- SubjectUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- SubjectSigningPublicKey = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
- Signature = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserKeyCertifications", x => x.Id);
- table.ForeignKey(
- name: "FK_UserKeyCertifications_AliasVaultUsers_CertifierUserId",
- column: x => x.CertifierUserId,
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_UserKeyCertifications_AliasVaultUsers_SubjectUserId",
- column: x => x.SubjectUserId,
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_UserSigningKeys_Fingerprint",
- table: "UserSigningKeys",
- column: "Fingerprint");
-
- migrationBuilder.CreateIndex(
- name: "UX_GroupInvitations_Group_Invitee_Pending_Join",
- table: "GroupInvitations",
- columns: new[] { "GroupId", "InviteeUserId" },
- unique: true,
- filter: "\"State\" = 'Pending' AND \"VaultManifestId\" IS NULL");
-
- migrationBuilder.CreateIndex(
- name: "IX_UserKeyCertifications_SubjectUserId",
- table: "UserKeyCertifications",
- column: "SubjectUserId");
-
- migrationBuilder.CreateIndex(
- name: "UX_UserKeyCertifications_Certifier_Subject",
- table: "UserKeyCertifications",
- columns: new[] { "CertifierUserId", "SubjectUserId" },
- unique: true);
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "UserKeyCertifications");
-
- migrationBuilder.DropIndex(
- name: "IX_UserSigningKeys_Fingerprint",
- table: "UserSigningKeys");
-
- migrationBuilder.DropIndex(
- name: "UX_GroupInvitations_Group_Invitee_Pending_Join",
- table: "GroupInvitations");
-
- migrationBuilder.DropColumn(
- name: "Fingerprint",
- table: "UserSigningKeys");
-
- migrationBuilder.CreateIndex(
- name: "IX_GroupInvitations_GroupId",
- table: "GroupInvitations",
- column: "GroupId");
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20261019200112_FamilyInviteCodes.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20261022102104_RenameGroupInvitationsToVaultManifestInvitations.Designer.cs
similarity index 99%
rename from apps/server/Databases/AliasServerDb/Migrations/20261019200112_FamilyInviteCodes.Designer.cs
rename to apps/server/Databases/AliasServerDb/Migrations/20261022102104_RenameGroupInvitationsToVaultManifestInvitations.Designer.cs
index 4686ebba0..34bb3c068 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/20261019200112_FamilyInviteCodes.Designer.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/20261022102104_RenameGroupInvitationsToVaultManifestInvitations.Designer.cs
@@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AliasServerDb.Migrations
{
[DbContext(typeof(AliasServerDbContext))]
- [Migration("20261019200112_FamilyInviteCodes")]
- partial class FamilyInviteCodes
+ [Migration("20261022102104_RenameGroupInvitationsToVaultManifestInvitations")]
+ partial class RenameGroupInvitationsToVaultManifestInvitations
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -711,97 +711,6 @@ namespace AliasServerDb.Migrations
b.ToTable("Groups");
});
- modelBuilder.Entity("AliasServerDb.GroupInvitation", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedName")
- .HasColumnType("text");
-
- b.Property<string>("EncryptedNameSignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("EncryptedVek")
- .HasColumnType("text");
-
- b.Property<string>("GrantSignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("GrantSignerPublicKey")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("InviteeUserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("InviterUserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("RespondedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Role")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<string>("State")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<int>("VaultKeyVersion")
- .HasColumnType("integer");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("InviterUserId");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("GroupId", "InviteeUserId")
- .IsUnique()
- .HasDatabaseName("UX_GroupInvitations_Group_Invitee_Pending_Join")
- .HasFilter("\"State\" = 'Pending' AND \"VaultManifestId\" IS NULL");
-
- b.HasIndex("InviteeUserId", "State");
-
- b.HasIndex("VaultManifestId", "InviteeUserId")
- .IsUnique()
- .HasDatabaseName("UX_GroupInvitations_Manifest_Invitee_Pending")
- .HasFilter("\"State\" = 'Pending'");
-
- b.ToTable("GroupInvitations");
- });
-
modelBuilder.Entity("AliasServerDb.GroupMember", b =>
{
b.Property<Guid>("Id")
@@ -1711,6 +1620,94 @@ namespace AliasServerDb.Migrations
b.ToTable("VaultManifestDeliveryKeys");
});
+ modelBuilder.Entity("AliasServerDb.VaultManifestInvitation", b =>
+ {
+ b.Property<Guid>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property<string>("Algorithm")
+ .IsRequired()
+ .HasMaxLength(30)
+ .HasColumnType("character varying(30)");
+
+ b.Property<DateTime>("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<string>("EncryptedName")
+ .HasColumnType("text");
+
+ b.Property<string>("EncryptedNameSignature")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property<string>("EncryptedVek")
+ .HasColumnType("text");
+
+ b.Property<string>("GrantSignature")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property<string>("GrantSignerPublicKey")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property<Guid>("GroupId")
+ .HasColumnType("uuid");
+
+ b.Property<string>("InviteeUserId")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property<string>("InviterUserId")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property<DateTime?>("RespondedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<string>("Role")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("character varying(20)");
+
+ b.Property<string>("State")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("character varying(20)");
+
+ b.Property<DateTime>("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<Guid?>("UserGrantKeyId")
+ .HasColumnType("uuid");
+
+ b.Property<int>("VaultKeyVersion")
+ .HasColumnType("integer");
+
+ b.Property<Guid>("VaultManifestId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GroupId");
+
+ b.HasIndex("InviterUserId");
+
+ b.HasIndex("UserGrantKeyId");
+
+ b.HasIndex("InviteeUserId", "State");
+
+ b.HasIndex("VaultManifestId", "InviteeUserId")
+ .IsUnique()
+ .HasDatabaseName("UX_VaultManifestInvitations_Manifest_Invitee_Pending")
+ .HasFilter("\"State\" = 'Pending'");
+
+ b.ToTable("VaultManifestInvitations");
+ });
+
modelBuilder.Entity("AliasServerDb.VaultManifestShareDetails", b =>
{
b.Property<Guid>("ManifestId")
@@ -1999,40 +1996,6 @@ namespace AliasServerDb.Migrations
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")
@@ -2226,6 +2189,40 @@ namespace AliasServerDb.Migrations
b.Navigation("VaultManifest");
});
+ modelBuilder.Entity("AliasServerDb.VaultManifestInvitation", 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.VaultManifestShareDetails", b =>
{
b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20261022102104_RenameGroupInvitationsToVaultManifestInvitations.cs b/apps/server/Databases/AliasServerDb/Migrations/20261022102104_RenameGroupInvitationsToVaultManifestInvitations.cs
new file mode 100644
index 000000000..3f2d711fb
--- /dev/null
+++ b/apps/server/Databases/AliasServerDb/Migrations/20261022102104_RenameGroupInvitationsToVaultManifestInvitations.cs
@@ -0,0 +1,155 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace AliasServerDb.Migrations
+{
+ /// <summary>
+ /// Every server schema change after 0.31.1 in one migration: renames UserUnlockKeys to UserUnlockMethods and GroupInvitations to
+ /// VaultManifestInvitations in place, adds the signing key fingerprint and previous-key signature, and adds UserKeyCertifications.
+ /// </summary>
+ public partial class RenameGroupInvitationsToVaultManifestInvitations : Migration
+ {
+ /// <inheritdoc />
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ // Unlock keys are unlock methods; rows are kept as-is.
+ migrationBuilder.Sql("""
+ ALTER TABLE "UserUnlockKeys" RENAME CONSTRAINT "PK_UserUnlockKeys" TO "PK_UserUnlockMethods";
+ ALTER TABLE "UserUnlockKeys" RENAME CONSTRAINT "FK_UserUnlockKeys_AliasVaultUsers_UserId" TO "FK_UserUnlockMethods_AliasVaultUsers_UserId";
+ ALTER TABLE "UserUnlockKeysHistory" RENAME CONSTRAINT "PK_UserUnlockKeysHistory" TO "PK_UserUnlockMethodsHistory";
+ ALTER TABLE "UserUnlockKeysHistory" RENAME CONSTRAINT "FK_UserUnlockKeysHistory_AliasVaultUsers_UserId" TO "FK_UserUnlockMethodsHistory_AliasVaultUsers_UserId";
+ """);
+ migrationBuilder.RenameTable(name: "UserUnlockKeys", newName: "UserUnlockMethods");
+ migrationBuilder.RenameTable(name: "UserUnlockKeysHistory", newName: "UserUnlockMethodsHistory");
+ migrationBuilder.RenameIndex(name: "UX_UserUnlockKeys_UserId_Type_Label", table: "UserUnlockMethods", newName: "UX_UserUnlockMethods_UserId_Type_Label");
+ migrationBuilder.RenameIndex(name: "IX_UserUnlockKeysHistory_ArchivedAt", table: "UserUnlockMethodsHistory", newName: "IX_UserUnlockMethodsHistory_ArchivedAt");
+ migrationBuilder.RenameIndex(name: "IX_UserUnlockKeysHistory_UserId_Type_ArchivedAt", table: "UserUnlockMethodsHistory", newName: "IX_UserUnlockMethodsHistory_UserId_Type_ArchivedAt");
+ migrationBuilder.RenameColumn(name: "UnlockKeyId", table: "UserUnlockMethodsHistory", newName: "UnlockMethodId");
+ migrationBuilder.Sql("""UPDATE "ServerSettings" SET "Key" = 'UnlockMethodHistoryRetentionDays' WHERE "Key" = 'UnlockKeyHistoryRetentionDays';""");
+
+ migrationBuilder.AddColumn<string>(name: "PreviousKeySignature", table: "UserSigningKeys", type: "character varying(255)", maxLength: 255, nullable: true);
+ migrationBuilder.AddColumn<string>(name: "Fingerprint", table: "UserSigningKeys", type: "character varying(20)", maxLength: 20, nullable: true);
+
+ // Backfill the fingerprint as Signing.Fingerprint computes it: SHA-256 over the length-prefixed label and key bytes,
+ // the first 16 bytes as an unsigned big-endian integer (two 64-bit halves), modulo 10^20. Checked against the known-answer key.
+ migrationBuilder.Sql("""
+ UPDATE "UserSigningKeys" SET "Fingerprint" = lpad(mod(
+ (v.hi::numeric + CASE WHEN v.hi < 0 THEN 18446744073709551616 ELSE 0 END) * 18446744073709551616
+ + (v.lo::numeric + CASE WHEN v.lo < 0 THEN 18446744073709551616 ELSE 0 END), 100000000000000000000)::text, 20, '0')
+ FROM (
+ SELECT d."Id", ('x' || encode(substring(d.h from 1 for 8), 'hex'))::bit(64)::bigint AS hi, ('x' || encode(substring(d.h from 9 for 8), 'hex'))::bit(64)::bigint AS lo
+ FROM (
+ SELECT "Id", sha256(int4send(37) || convert_to('aliasvault/v1/signing-key-fingerprint', 'UTF8') || int4send(32) || decode("PublicKey", 'base64')) AS h
+ FROM "UserSigningKeys"
+ ) AS d
+ ) AS v
+ WHERE v."Id" = "UserSigningKeys"."Id";
+ """);
+
+ migrationBuilder.CreateIndex(name: "IX_UserSigningKeys_Fingerprint", table: "UserSigningKeys", column: "Fingerprint");
+
+ // A grant opens on a client only when signed by its holder. Grants signed by the inviter predate that rule and would
+ // fail every sync of their holder, so they are deleted; the admin invites those members again.
+ migrationBuilder.Sql("""
+ DELETE FROM "VaultManifestAccessKeys" WHERE "Type" = 'grant-key' AND "GrantSignerUserId" IS NOT NULL AND "GrantSignerUserId" <> "UserId";
+ """);
+
+ migrationBuilder.CreateTable(
+ name: "UserKeyCertifications",
+ columns: table => new
+ {
+ Id = table.Column<Guid>(type: "uuid", nullable: false),
+ CertifierUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
+ SubjectUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
+ SubjectSigningPublicKey = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
+ Signature = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_UserKeyCertifications", x => x.Id);
+ table.ForeignKey(
+ name: "FK_UserKeyCertifications_AliasVaultUsers_CertifierUserId",
+ column: x => x.CertifierUserId,
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_UserKeyCertifications_AliasVaultUsers_SubjectUserId",
+ column: x => x.SubjectUserId,
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_UserKeyCertifications_SubjectUserId",
+ table: "UserKeyCertifications",
+ column: "SubjectUserId");
+
+ migrationBuilder.CreateIndex(
+ name: "UX_UserKeyCertifications_Certifier_Subject",
+ table: "UserKeyCertifications",
+ columns: new[] { "CertifierUserId", "SubjectUserId" },
+ unique: true);
+
+ // Every invitation is an invitation to a shared manifest; group-only invitations can no longer be created or accepted.
+ migrationBuilder.Sql("""DELETE FROM "GroupInvitations" WHERE "VaultManifestId" IS NULL;""");
+ migrationBuilder.Sql("""
+ ALTER TABLE "GroupInvitations" RENAME CONSTRAINT "PK_GroupInvitations" TO "PK_VaultManifestInvitations";
+ ALTER TABLE "GroupInvitations" RENAME CONSTRAINT "FK_GroupInvitations_AliasVaultUsers_InviteeUserId" TO "FK_VaultManifestInvitations_AliasVaultUsers_InviteeUserId";
+ ALTER TABLE "GroupInvitations" RENAME CONSTRAINT "FK_GroupInvitations_AliasVaultUsers_InviterUserId" TO "FK_VaultManifestInvitations_AliasVaultUsers_InviterUserId";
+ ALTER TABLE "GroupInvitations" RENAME CONSTRAINT "FK_GroupInvitations_Groups_GroupId" TO "FK_VaultManifestInvitations_Groups_GroupId";
+ ALTER TABLE "GroupInvitations" RENAME CONSTRAINT "FK_GroupInvitations_UserGrantKeys_UserGrantKeyId" TO "FK_VaultManifestInvitations_UserGrantKeys_UserGrantKeyId";
+ """);
+ migrationBuilder.RenameTable(name: "GroupInvitations", newName: "VaultManifestInvitations");
+ migrationBuilder.RenameIndex(name: "IX_GroupInvitations_GroupId", table: "VaultManifestInvitations", newName: "IX_VaultManifestInvitations_GroupId");
+ migrationBuilder.RenameIndex(name: "IX_GroupInvitations_InviteeUserId_State", table: "VaultManifestInvitations", newName: "IX_VaultManifestInvitations_InviteeUserId_State");
+ migrationBuilder.RenameIndex(name: "IX_GroupInvitations_InviterUserId", table: "VaultManifestInvitations", newName: "IX_VaultManifestInvitations_InviterUserId");
+ migrationBuilder.RenameIndex(name: "IX_GroupInvitations_UserGrantKeyId", table: "VaultManifestInvitations", newName: "IX_VaultManifestInvitations_UserGrantKeyId");
+ migrationBuilder.RenameIndex(name: "UX_GroupInvitations_Manifest_Invitee_Pending", table: "VaultManifestInvitations", newName: "UX_VaultManifestInvitations_Manifest_Invitee_Pending");
+ migrationBuilder.AlterColumn<Guid>(name: "VaultManifestId", table: "VaultManifestInvitations", type: "uuid", nullable: false, oldClrType: typeof(Guid), oldType: "uuid", oldNullable: true);
+ }
+
+ /// <inheritdoc />
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterColumn<Guid>(name: "VaultManifestId", table: "VaultManifestInvitations", type: "uuid", nullable: true, oldClrType: typeof(Guid), oldType: "uuid");
+ migrationBuilder.RenameIndex(name: "UX_VaultManifestInvitations_Manifest_Invitee_Pending", table: "VaultManifestInvitations", newName: "UX_GroupInvitations_Manifest_Invitee_Pending");
+ migrationBuilder.RenameIndex(name: "IX_VaultManifestInvitations_UserGrantKeyId", table: "VaultManifestInvitations", newName: "IX_GroupInvitations_UserGrantKeyId");
+ migrationBuilder.RenameIndex(name: "IX_VaultManifestInvitations_InviterUserId", table: "VaultManifestInvitations", newName: "IX_GroupInvitations_InviterUserId");
+ migrationBuilder.RenameIndex(name: "IX_VaultManifestInvitations_InviteeUserId_State", table: "VaultManifestInvitations", newName: "IX_GroupInvitations_InviteeUserId_State");
+ migrationBuilder.RenameIndex(name: "IX_VaultManifestInvitations_GroupId", table: "VaultManifestInvitations", newName: "IX_GroupInvitations_GroupId");
+ migrationBuilder.RenameTable(name: "VaultManifestInvitations", newName: "GroupInvitations");
+ migrationBuilder.Sql("""
+ ALTER TABLE "GroupInvitations" RENAME CONSTRAINT "PK_VaultManifestInvitations" TO "PK_GroupInvitations";
+ ALTER TABLE "GroupInvitations" RENAME CONSTRAINT "FK_VaultManifestInvitations_AliasVaultUsers_InviteeUserId" TO "FK_GroupInvitations_AliasVaultUsers_InviteeUserId";
+ ALTER TABLE "GroupInvitations" RENAME CONSTRAINT "FK_VaultManifestInvitations_AliasVaultUsers_InviterUserId" TO "FK_GroupInvitations_AliasVaultUsers_InviterUserId";
+ ALTER TABLE "GroupInvitations" RENAME CONSTRAINT "FK_VaultManifestInvitations_Groups_GroupId" TO "FK_GroupInvitations_Groups_GroupId";
+ ALTER TABLE "GroupInvitations" RENAME CONSTRAINT "FK_VaultManifestInvitations_UserGrantKeys_UserGrantKeyId" TO "FK_GroupInvitations_UserGrantKeys_UserGrantKeyId";
+ """);
+
+ migrationBuilder.DropTable(name: "UserKeyCertifications");
+ migrationBuilder.DropIndex(name: "IX_UserSigningKeys_Fingerprint", table: "UserSigningKeys");
+ migrationBuilder.DropColumn(name: "Fingerprint", table: "UserSigningKeys");
+ migrationBuilder.DropColumn(name: "PreviousKeySignature", table: "UserSigningKeys");
+
+ migrationBuilder.Sql("""UPDATE "ServerSettings" SET "Key" = 'UnlockKeyHistoryRetentionDays' WHERE "Key" = 'UnlockMethodHistoryRetentionDays';""");
+ migrationBuilder.RenameColumn(name: "UnlockMethodId", table: "UserUnlockMethodsHistory", newName: "UnlockKeyId");
+ migrationBuilder.RenameIndex(name: "IX_UserUnlockMethodsHistory_UserId_Type_ArchivedAt", table: "UserUnlockMethodsHistory", newName: "IX_UserUnlockKeysHistory_UserId_Type_ArchivedAt");
+ migrationBuilder.RenameIndex(name: "IX_UserUnlockMethodsHistory_ArchivedAt", table: "UserUnlockMethodsHistory", newName: "IX_UserUnlockKeysHistory_ArchivedAt");
+ migrationBuilder.RenameIndex(name: "UX_UserUnlockMethods_UserId_Type_Label", table: "UserUnlockMethods", newName: "UX_UserUnlockKeys_UserId_Type_Label");
+ migrationBuilder.RenameTable(name: "UserUnlockMethodsHistory", newName: "UserUnlockKeysHistory");
+ migrationBuilder.RenameTable(name: "UserUnlockMethods", newName: "UserUnlockKeys");
+ migrationBuilder.Sql("""
+ ALTER TABLE "UserUnlockKeys" RENAME CONSTRAINT "PK_UserUnlockMethods" TO "PK_UserUnlockKeys";
+ ALTER TABLE "UserUnlockKeys" RENAME CONSTRAINT "FK_UserUnlockMethods_AliasVaultUsers_UserId" TO "FK_UserUnlockKeys_AliasVaultUsers_UserId";
+ ALTER TABLE "UserUnlockKeysHistory" RENAME CONSTRAINT "PK_UserUnlockMethodsHistory" TO "PK_UserUnlockKeysHistory";
+ ALTER TABLE "UserUnlockKeysHistory" RENAME CONSTRAINT "FK_UserUnlockMethodsHistory_AliasVaultUsers_UserId" TO "FK_UserUnlockKeysHistory_AliasVaultUsers_UserId";
+ """);
+ }
+ }
+}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs
index b7d3c65fc..701a33d65 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs
@@ -708,97 +708,6 @@ namespace AliasServerDb.Migrations
b.ToTable("Groups");
});
- modelBuilder.Entity("AliasServerDb.GroupInvitation", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedName")
- .HasColumnType("text");
-
- b.Property<string>("EncryptedNameSignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("EncryptedVek")
- .HasColumnType("text");
-
- b.Property<string>("GrantSignature")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("GrantSignerPublicKey")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("InviteeUserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("InviterUserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("RespondedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Role")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<string>("State")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<int>("VaultKeyVersion")
- .HasColumnType("integer");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("InviterUserId");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("GroupId", "InviteeUserId")
- .IsUnique()
- .HasDatabaseName("UX_GroupInvitations_Group_Invitee_Pending_Join")
- .HasFilter("\"State\" = 'Pending' AND \"VaultManifestId\" IS NULL");
-
- b.HasIndex("InviteeUserId", "State");
-
- b.HasIndex("VaultManifestId", "InviteeUserId")
- .IsUnique()
- .HasDatabaseName("UX_GroupInvitations_Manifest_Invitee_Pending")
- .HasFilter("\"State\" = 'Pending'");
-
- b.ToTable("GroupInvitations");
- });
-
modelBuilder.Entity("AliasServerDb.GroupMember", b =>
{
b.Property<Guid>("Id")
@@ -1708,6 +1617,94 @@ namespace AliasServerDb.Migrations
b.ToTable("VaultManifestDeliveryKeys");
});
+ modelBuilder.Entity("AliasServerDb.VaultManifestInvitation", b =>
+ {
+ b.Property<Guid>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property<string>("Algorithm")
+ .IsRequired()
+ .HasMaxLength(30)
+ .HasColumnType("character varying(30)");
+
+ b.Property<DateTime>("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<string>("EncryptedName")
+ .HasColumnType("text");
+
+ b.Property<string>("EncryptedNameSignature")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property<string>("EncryptedVek")
+ .HasColumnType("text");
+
+ b.Property<string>("GrantSignature")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property<string>("GrantSignerPublicKey")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property<Guid>("GroupId")
+ .HasColumnType("uuid");
+
+ b.Property<string>("InviteeUserId")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property<string>("InviterUserId")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property<DateTime?>("RespondedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<string>("Role")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("character varying(20)");
+
+ b.Property<string>("State")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("character varying(20)");
+
+ b.Property<DateTime>("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property<Guid?>("UserGrantKeyId")
+ .HasColumnType("uuid");
+
+ b.Property<int>("VaultKeyVersion")
+ .HasColumnType("integer");
+
+ b.Property<Guid>("VaultManifestId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GroupId");
+
+ b.HasIndex("InviterUserId");
+
+ b.HasIndex("UserGrantKeyId");
+
+ b.HasIndex("InviteeUserId", "State");
+
+ b.HasIndex("VaultManifestId", "InviteeUserId")
+ .IsUnique()
+ .HasDatabaseName("UX_VaultManifestInvitations_Manifest_Invitee_Pending")
+ .HasFilter("\"State\" = 'Pending'");
+
+ b.ToTable("VaultManifestInvitations");
+ });
+
modelBuilder.Entity("AliasServerDb.VaultManifestShareDetails", b =>
{
b.Property<Guid>("ManifestId")
@@ -1996,40 +1993,6 @@ namespace AliasServerDb.Migrations
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")
@@ -2223,6 +2186,40 @@ namespace AliasServerDb.Migrations
b.Navigation("VaultManifest");
});
+ modelBuilder.Entity("AliasServerDb.VaultManifestInvitation", 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.VaultManifestShareDetails", b =>
{
b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
diff --git a/apps/server/Databases/AliasServerDb/GroupInvitation.cs b/apps/server/Databases/AliasServerDb/VaultManifestInvitation.cs
similarity index 89%
rename from apps/server/Databases/AliasServerDb/GroupInvitation.cs
rename to apps/server/Databases/AliasServerDb/VaultManifestInvitation.cs
index 044b80c4f..ba39656b6 100644
--- a/apps/server/Databases/AliasServerDb/GroupInvitation.cs
+++ b/apps/server/Databases/AliasServerDb/VaultManifestInvitation.cs
@@ -1,5 +1,5 @@
//-----------------------------------------------------------------------
-// <copyright file="GroupInvitation.cs" company="aliasvault">
+// <copyright file="VaultManifestInvitation.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>
@@ -13,10 +13,10 @@ 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.
+/// An offer of access to a shared manifest, made by an admin of its group to an existing account. Accepting it also makes the invitee a member of the group.
/// </summary>
[Index(nameof(InviteeUserId), nameof(State))]
-public class GroupInvitation
+public class VaultManifestInvitation
{
/// <summary>
/// Gets or sets the primary key.
@@ -25,7 +25,7 @@ public class GroupInvitation
public Guid Id { get; set; }
/// <summary>
- /// Gets or sets the group being joined.
+ /// Gets or sets the group that owns the manifest, which the invitee joins on accepting.
/// </summary>
public Guid GroupId { get; set; }
@@ -67,7 +67,7 @@ public class GroupInvitation
/// <summary>
/// Gets or sets the manifest the <see cref="EncryptedVek"/> unlocks.
/// </summary>
- public Guid? VaultManifestId { get; set; }
+ public Guid VaultManifestId { get; set; }
/// <summary>
/// Gets or sets the shared manifest's VEK, encrypted for the invitee's public key.
@@ -122,7 +122,7 @@ public class GroupInvitation
/// <summary>
/// Gets or sets where the invitation stands.
/// </summary>
- public GroupInvitationState State { get; set; } = GroupInvitationState.Pending;
+ public VaultManifestInvitationState State { get; set; } = VaultManifestInvitationState.Pending;
/// <summary>
/// Gets or sets created timestamp.
diff --git a/apps/server/Databases/AliasServerDb/GroupInvitationState.cs b/apps/server/Databases/AliasServerDb/VaultManifestInvitationState.cs
similarity index 83%
rename from apps/server/Databases/AliasServerDb/GroupInvitationState.cs
rename to apps/server/Databases/AliasServerDb/VaultManifestInvitationState.cs
index 3939de5c1..324a07dea 100644
--- a/apps/server/Databases/AliasServerDb/GroupInvitationState.cs
+++ b/apps/server/Databases/AliasServerDb/VaultManifestInvitationState.cs
@@ -1,5 +1,5 @@
//-----------------------------------------------------------------------
-// <copyright file="GroupInvitationState.cs" company="aliasvault">
+// <copyright file="VaultManifestInvitationState.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>
@@ -8,9 +8,9 @@
namespace AliasServerDb;
/// <summary>
-/// Where an invitation to join a <see cref="GroupType.Shared"/> group stands.
+/// Where an invitation to a shared manifest stands.
/// </summary>
-public enum GroupInvitationState
+public enum VaultManifestInvitationState
{
/// <summary>
/// Sent and awaiting the invitee's answer. The only state in which an invitation can be accepted or declined.
@@ -18,7 +18,7 @@ public enum GroupInvitationState
Pending = 0,
/// <summary>
- /// The invitee accepted, which created their <see cref="GroupMember"/> row.
+ /// The invitee accepted, which created their grant and their <see cref="GroupMember"/> row.
/// </summary>
Accepted = 1,
diff --git a/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs b/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs
index fdbc0dff9..98f399ee0 100644
--- a/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs
+++ b/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs
@@ -207,12 +207,6 @@ public enum ApiErrorCode
/// </summary>
INVITATION_ALREADY_EXISTS,
- /// <summary>
- /// The account access was offered to is not on the group's membership roster. Who belongs to a group is decided
- /// outside the client, so this cannot be resolved by the caller.
- /// </summary>
- NOT_GROUP_MEMBER,
-
/// <summary>
/// The member already holds access to this shared manifest.
/// </summary>