Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Refactor (#2159)
Leendert de Borst65a1bc2dd009
diff --git a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.tsindex 75b34d7bd..fb354d0d7 100644--- a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts+++ b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts@@ -44,7 +44,7 @@ import type { StringResponse as stringResponse } from '@/utils/types/messaging/Simport type { VaultResponse as messageVaultResponse } from '@/utils/types/messaging/VaultResponse';import type { VaultUploadResponse as messageVaultUploadResponse } from '@/utils/types/messaging/VaultUploadResponse';import { type VaultMutationScope, DEFAULT_VAULT_MUTATION_SCOPE, hasUserVisibleScope, isManifestScope } from '@/utils/types/VaultMutationScope';-import { VaultCodec } from '@/utils/VaultCodec';+import { manifestIdKey, VaultCodec } from '@/utils/VaultCodec';import { clearDirtyScopes, getDirtyScopes } from '@/utils/VaultDirtyState';import { VaultKeyService } from '@/utils/VaultKeyService';import { vaultRequiresManifestMigration, VaultMigrationKind, type VaultMigrationStatus } from '@/utils/VaultManifestMigration';@@ -108,6 +108,16 @@ let hasPendingSync = false;/** The shared manifests a pull was already forced for over a missing key record, so one the server stopped serving does not pull on every sync. */const manifestsPulledForSharedKeys = new Set<string>();+/**+ * How many times one chain of syncs may restart itself over a push the server called outdated. A pull settles a+ * genuine conflict on the first retry; a chain that keeps going is one where the pull cannot repair what makes the+ * push refuse itself, and repeating it forever would pull and merge the whole vault on every turn.+ */+const MAX_OUTDATED_RESYNCS = 3;++/** How many times the running chain of syncs has already restarted over an outdated push. */+let outdatedResyncCount = 0;+/*** Check if the user is logged in and if the vault is locked, and also check for both kinds of pending vault.*/@@ -264,6 +274,7 @@ async function pushVaultToServer(sqliteClient: SqliteClient, options: { forceFul* Migration succeeded: from now on the session key is the VEK, not the password-derived key.* TODO: this can be removed once all users have migrated to the manifest-v1 storage model.*/+ await resealSharedManifestRecords(result.newEncryptionKey);await handleStoreEncryptionKey(result.newEncryptionKey);}@@ -1297,6 +1308,24 @@ export async function handleGetSyncState(): Promise<VaultSyncState> {};}+/**+ * Re-seal the shared-manifest key records under a new session key.+ *+ * The records are stored encrypted with the session key, so a key swap (adopting another device's VEK, or minting+ * one in the migration push) leaves them unreadable and this session silently without any shared manifest, which+ * only a pull would repair. Must run while the old key is still the session key, since that is what reads them.+ * @param newEncryptionKey - the key that is about to become the session key+ */+async function resealSharedManifestRecords(newEncryptionKey: string): Promise<void> {+ const records = await SharingService.getSharedManifestRecords();+ if (Object.keys(records).length === 0) {+ return;+ }++ await SharingService.setSharedManifestRecords(records, newEncryptionKey);+ devLog(`[Sharing] Re-sealed ${Object.keys(records).length} shared-manifest key record(s) under the new vault key.`);+}+/*** Adopt a server-side vault key this device does not know about yet.*@@ -1349,6 +1378,7 @@ async function adoptRemoteVaultKeyIfNeeded(): Promise<boolean> {await storage.setItem(StorageKeys.ENCRYPTED_VAULT, await EncryptionUtility.symmetricEncrypt(decrypted, vek));}+ await resealSharedManifestRecords(vek);await VaultKeyService.cacheVaultKeyBlobs(fetchResult.vaultKey);await handleStoreEncryptionKey(vek);cachedSqliteClient = null;@@ -1467,7 +1497,8 @@ async function handleFullVaultSyncInternal(options?: FullVaultSyncOptions): Promreturn preflight.result;}- const { statusResponse, syncState, needsPull } = preflight;+ const { statusResponse, syncState } = preflight;+ let needsPull = preflight.needsPull;await announceSyncPhase(needsPull, syncState.isDirty);@@ -1479,6 +1510,15 @@ async function handleFullVaultSyncInternal(options?: FullVaultSyncOptions): Prom// Chcek for any client pending actions as directed by the server (e.g. shared group invitations, shared group memberships, etc.)const grantSyncChangedVault = await applyServerDirectedChanges(webApi, statusResponse, syncState, encryptionKey, needsPull);+ /*+ * The rows just reconciled turned a clean vault dirty after the preflight had already decided, so the+ * write-side check runs again here instead of letting this sync push into a refusal and re-sync afterwards.+ */+ if (!needsPull && syncState.isDirty && await vaultHoldsUnwritableManifests()) {+ needsPull = true;+ broadcastSyncPhase('pull');+ }+if (needsPull) {return await pullAndMaterializeServerVault(syncState, encryptionKey, grantSyncChangedVault);}@@ -1508,13 +1548,35 @@ async function handleFullVaultSyncInternal(options?: FullVaultSyncOptions): PromhandleFullVaultSync().catch(err => {console.error('[VaultSync] Follow-up sync failed:', err);});+ } else {+ // Nothing chained onto this sync, so the next outdated push starts counting from zero again.+ outdatedResyncCount = 0;}}}+/**+ * Re-sync after the server refused a push as outdated, at most {@link MAX_OUTDATED_RESYNCS} times per chain.+ *+ * The pull that follows is what normally makes the next push succeed. When it does not (the vault holds rows of a+ * manifest no pull can restore access to, say), the chain would otherwise re-pull and re-merge the whole vault+ * forever, so it is cut off and the failure is reported instead.+ * @param what - what could not be written, named for the log+ */+async function resyncAfterOutdatedPush(what: string): Promise<FullVaultSyncResult> {+ if (outdatedResyncCount >= MAX_OUTDATED_RESYNCS) {+ devError(`[VaultSync] The server still refuses ${what} after ${MAX_OUTDATED_RESYNCS} re-syncs; giving up on this chain, the next sync starts over.`);+ outdatedResyncCount = 0;+ return syncResult({ success: false, error: await t('common.errors.syncConflictMaxRetries') });+ }++ outdatedResyncCount++;+ return handleFullVaultSync();+}+/** What a caller may ask of a full sync beyond what the revisions decide. */type FullVaultSyncOptions = {- /** Pull even when the revisions say the vault is current, for state only a pull re-records (the shared-vault key records). */+ /** Pull even when the revisions say the vault is current, for state only a pull re-records (the shared-manifest key records). */forcePull?: boolean;};@@ -1598,7 +1660,11 @@ async function runSyncPreflight(webApi: WebApiService, options?: FullVaultSyncOpsyncState.isDirty = false;}- // Check if we are missing any manifest related information that we do have write access for.+ /*+ * Two states the revisions cannot see, both repaired by a pull: rows of a manifest this session cannot write+ * (which the push would silently leave out, so it refuses instead), and rows of a shared manifest this session+ * holds no key record for at all. The first only matters for a write, the second also for reading the manifest.+ */if (syncState.isDirty && !needsPull && await vaultHoldsUnwritableManifests()) {needsPull = true;}@@ -1634,14 +1700,15 @@ async function vaultHoldsUnwritableManifests(): Promise<boolean> {*/async function vaultHoldsUnrecordedSharedManifests(): Promise<boolean> {try {- const recorded = new Set(Object.values(await SharingService.getSharedManifestRecords()).map(record => record.manifestId.toLowerCase()));+ const recorded = new Set(Object.values(await SharingService.getSharedManifestRecords()).map(record => manifestIdKey(record.manifestId)));for (const manifestId of recorded) {manifestsPulledForSharedKeys.delete(manifestId);}- const personalManifestId = (await getPersonalManifestId())?.toLowerCase() ?? null;+ const personalId = await getPersonalManifestId();+ const personalManifestId = personalId ? manifestIdKey(personalId) : null;const unrecorded = [...VaultCodec.manifestIdsInVault(await createVaultSqliteClient())]- .map(manifestId => manifestId.toLowerCase())+ .map(manifestIdKey).filter(manifestId => manifestId !== personalManifestId && !recorded.has(manifestId) && !manifestsPulledForSharedKeys.has(manifestId));if (unrecorded.length === 0) {return false;@@ -1767,6 +1834,7 @@ async function pullAndMaterializeServerVault(syncState: VaultSyncState, encryptitry {if (syncState.isDirty) {+ await pruneRowsOfLostManifests(encryptionKey);const mergedResult = await mergeAndPushLocalChanges(vaultResponseJson, syncState, encryptionKey, grantSyncChangedVault);if (mergedResult) {return mergedResult;@@ -1802,6 +1870,32 @@ async function pullAndMaterializeServerVault(syncState: VaultSyncState, encrypti}}+/**+ * Drop the rows of every manifest the snapshot just pulled no longer serves this account, so they do not survive+ * the merge that follows.+ *+ * A pull of a clean vault drops them by replacing the whole database; the merge path has to be told, because a+ * merge keeps local-only rows. Left in place they can never be written again, which makes every following push+ * refuse itself. What the snapshot served is the authority here, not what opened out of it: a manifest that fails+ * to decrypt once is still this account's.+ * @param encryptionKey - the key the stored vault is sealed with+ */+async function pruneRowsOfLostManifests(encryptionKey: string): Promise<void> {+ try {+ const sqliteClient = await createVaultSqliteClient();+ const dropped = vaultSyncService.dropRowsOfLostManifests(sqliteClient, vaultSyncService.manifestIdsServedByLastSnapshot());+ if (dropped.length === 0) {+ return;+ }++ // Not a local change of the user's making, so it is stored without touching the dirty state or its sequence.+ await handleStoreEncryptedVault({ vaultBlob: await EncryptionUtility.symmetricEncrypt(sqliteClient.exportToBase64(), encryptionKey) });+ invalidateCanonicalizeCache();+ } catch (error) {+ devWarn('[VaultSync] Could not drop the rows of manifests this account no longer holds; the merge runs on the vault as it is.', error);+ }+}+/*** Merge the local vault onto the server's latest vault and upload the result.*@@ -1865,8 +1959,8 @@ async function mergeAndPushLocalChanges(if (uploadResponse.success && uploadResponse.status === 0) {await handleMarkVaultClean({ mutationSeqAtStart: uploadResponse.mutationSeqAtStart! });} else if (uploadResponse.status === 2) {- // Outdated: another device uploaded first. Re-sync.- return handleFullVaultSync();+ // Outdated: another device uploaded first, or the merged vault is not one this session may write whole.+ return resyncAfterOutdatedPush('the merged vault');} else {console.error('Failed to upload merged vault:', uploadResponse.error);return syncResult({ success: false, error: uploadResponse.error });@@ -1890,7 +1984,7 @@ async function pushOverLegacyServerVault(grantSyncChangedVault: boolean): Promis}if (uploadResponse.status === 2) {- return handleFullVaultSync();+ return resyncAfterOutdatedPush('the vault pushed over the legacy server vault');}return syncResult({ success: false, error: uploadResponse.error });@@ -1916,8 +2010,8 @@ async function pushPendingLocalChanges(grantSyncChangedVault: boolean): Promise<}if (uploadResponse.status === 2) {- // Outdated: another device uploaded first. Re-sync.- return handleFullVaultSync();+ // Outdated: another device uploaded first, or this vault is not one this session may write whole.+ return resyncAfterOutdatedPush('the pending local changes');}console.error('Failed to upload pending vault:', uploadResponse.error);@@ -2654,10 +2748,10 @@ export async function handleGroupCreateVault(message: { groupId: string; name: s}/**- * Invite a member of a family to one of its shared manifests, handing them the vault's key sealed for them.+ * Invite a member of a family to one of its shared manifests, handing them the manifest's key sealed for them.** The recipient is picked off the family's own roster, so this never names an account outside the family.- * @param message - the family, the vault, and the member being invited.+ * @param message - the family, the manifest, and the member being invited.*/export async function handleGroupInviteMember(message: { groupId: string; manifestId: string; userId: string }): Promise<{ success: boolean; error?: string; apiErrorCode?: string }> {const encryptionKey = await handleGetEncryptionKey();diff --git a/apps/browser-extension/src/utils/PendingActionProcessor.ts b/apps/browser-extension/src/utils/PendingActionProcessor.tsindex e11309a35..d49e8865b 100644--- a/apps/browser-extension/src/utils/PendingActionProcessor.ts+++ b/apps/browser-extension/src/utils/PendingActionProcessor.ts@@ -92,7 +92,7 @@ export class PendingActionProcessor {const record = Object.values(await SharingService.getSharedManifestRecords()).find(candidate => idsEqual(candidate.manifestId, action.manifestId));if (!record?.canAdminister) {- devLog(`[PendingActions] Vault ${action.manifestId} is not open to this session as an administrator; leaving its delivery key rotation for another sync.`);+ devLog(`[PendingActions] Manifest ${action.manifestId} is not open to this session as an administrator; leaving its delivery key rotation for another sync.`);return { vaultChanged: false, completed: false };}diff --git a/apps/browser-extension/src/utils/SharingService.ts b/apps/browser-extension/src/utils/SharingService.tsindex ca6fbb543..344d142d2 100644--- a/apps/browser-extension/src/utils/SharingService.ts+++ b/apps/browser-extension/src/utils/SharingService.ts@@ -283,20 +283,20 @@ export class SharingService {*/public static async openSharedManifestVek(sqliteClient: SqliteClient, record: SharedManifestRecord): Promise<string | null> {if (record.algorithm !== VaultKeyAlgorithm.RsaOaepSha256) {- devWarn(`[Sharing] Vault ${record.manifestId} grants its key under an unsupported algorithm "${record.algorithm}" (newer server?); leaving it closed.`);+ devWarn(`[Sharing] Manifest ${record.manifestId} grants its key under an unsupported algorithm "${record.algorithm}" (newer server?); leaving it closed.`);return null;}const privateKey = await this.resolveGrantPrivateKey(sqliteClient, record.encryptionPublicKey);if (!privateKey) {- devWarn(`[Sharing] No account key in this vault opens the grant on vault ${record.manifestId}; leaving it closed.`);+ devWarn(`[Sharing] No account key in this vault opens the grant on manifest ${record.manifestId}; leaving it closed.`);return null;}try {return await this.decryptManifestVek(record.encryptedVek, privateKey);} catch (error) {- devWarn(`[Sharing] Failed to unwrap the key of vault ${record.manifestId}; leaving it closed.`, error);+ devWarn(`[Sharing] Failed to unwrap the key of manifest ${record.manifestId}; leaving it closed.`, error);return null;}}diff --git a/apps/browser-extension/src/utils/VaultCodec.ts b/apps/browser-extension/src/utils/VaultCodec.tsindex f6d5b1620..21699b966 100644--- a/apps/browser-extension/src/utils/VaultCodec.ts+++ b/apps/browser-extension/src/utils/VaultCodec.ts@@ -37,6 +37,27 @@ type BlobRef = {__blobKind?: string;};+/**+ * The stamp a row carries while it belongs to no manifest yet.+ */+export const UNSTAMPED_MANIFEST_ID = '00000000-0000-0000-0000-000000000000';++/**+ * Whether a stamp names no manifest, so it must never be mistaken for one the vault holds rows for.+ * @param manifestId - the stamp as the row carries it+ */+export function isUnstampedScope(manifestId: string | null | undefined): boolean {+ return !manifestId || manifestId.toLowerCase() === UNSTAMPED_MANIFEST_ID;+}++/**+ * The comparison key of a manifest id, force it to lowercase to ensure cross-platform compatibility.+ * @param manifestId - the manifest id in any casing+ */+export function manifestIdKey(manifestId: string): string {+ return manifestId.toLowerCase();+}+/*** VaultCodec — sql.js read/insert methods.*/@@ -242,18 +263,24 @@ export class VaultCodec {}/**- * Every manifest id this vault holds a row for.+ * The tables carrying a manifest stamp.* @param sqliteClient - client wrapping the open SQLite DB*/- public static manifestIdsInVault(sqliteClient: SqliteClient): Set<string> {- const stampedTables = this.listUserTables(sqliteClient).filter(+ public static stampedTables(sqliteClient: SqliteClient): string[] {+ return this.listUserTables(sqliteClient).filter(name => sqliteClient.executeQuery<{ name: string }>(`SELECT name FROM pragma_table_info("${name}") WHERE name = 'ManifestId'`).length > 0);+ }+ /**+ * Every manifest id this vault holds a row for.+ * @param sqliteClient - client wrapping the open SQLite DB+ */+ public static manifestIdsInVault(sqliteClient: SqliteClient): Set<string> {const ids = new Set<string>();- for (const name of stampedTables) {+ for (const name of this.stampedTables(sqliteClient)) {for (const row of sqliteClient.executeQuery<{ ManifestId: string | null }>(`SELECT DISTINCT ManifestId FROM "${name}" WHERE ManifestId IS NOT NULL AND ManifestId != ''`)) {- if (row.ManifestId) {+ if (row.ManifestId && !isUnstampedScope(row.ManifestId)) {ids.add(row.ManifestId);}}diff --git a/apps/browser-extension/src/utils/VaultSyncService.ts b/apps/browser-extension/src/utils/VaultSyncService.tsindex 6b95c1693..c58084fc4 100644--- a/apps/browser-extension/src/utils/VaultSyncService.ts+++ b/apps/browser-extension/src/utils/VaultSyncService.ts@@ -21,7 +21,7 @@ import { SharingService, type ManifestVekGrant, type SharedManifestRecord } fromimport { SqliteClient } from '@/utils/SqliteClient';import { getStorageItem } from '@/utils/StorageUtility';import { VaultProcessingError } from '@/utils/types/errors/VaultProcessingError';-import { type VaultManifest, type VaultDataBucket, VaultCodec } from '@/utils/VaultCodec';+import { type VaultManifest, type VaultDataBucket, VaultCodec, manifestIdKey } from '@/utils/VaultCodec';import { VaultKeyService } from '@/utils/VaultKeyService';import { WebApiService } from '@/utils/WebApiService';@@ -299,6 +299,9 @@ export function invalidateCanonicalizeCache(): void {* Service entry point.*/export class VaultSyncService {+ /** The manifest ids the last snapshot carried, recorded before any of them is opened. */+ private lastServedManifestIds: string[] = [];+/*** Retrieve the latest vault from the server as a normalized {@link VaultResponse} (encrypted SQLite blob +* email routing + revision).@@ -315,6 +318,7 @@ export class VaultSyncService {*/devLog('[V2Pull] Step 1/4: fetching vault snapshot (GET /v2/Vault)...');const snapshot = await this.fetchSnapshot();+ this.lastServedManifestIds = (snapshot.manifests ?? []).map(m => m.manifestId);const personalManifest = selectPersonalManifest(snapshot);devLog(`[V2Pull] Step 1/4 done: storageFormat=${snapshot.storageFormat}, manifests=${snapshot.manifests?.length ?? 0}, personalRevision=${personalManifest?.revision}, manifestBlob=${personalManifest?.blob?.length ?? 0} chars, buckets=${snapshot.buckets?.length ?? 0}, blobRefs=${personalManifest?.blobReferences?.length ?? 0}`);@@ -1331,14 +1335,57 @@ export class VaultSyncService {* @returns The manifest ids the vault holds but this session cannot write, empty when the two agree*/public async findUnwritableManifests(sqliteClient: SqliteClient): Promise<string[]> {- const writable = new Set<string>((await SharingService.openSharedManifestVeks(sqliteClient)).keys());+ const writable = new Set<string>([...(await SharingService.openSharedManifestVeks(sqliteClient)).keys()].map(manifestIdKey));const personalManifestId = await getPersonalManifestId();if (personalManifestId) {- writable.add(personalManifestId);+ writable.add(manifestIdKey(personalManifestId));+ }++ return [...VaultCodec.manifestIdsInVault(sqliteClient)].filter(manifestId => !writable.has(manifestIdKey(manifestId)));+ }++ /**+ * The manifests the last snapshot served this account, in the spelling the server used. This is what the account+ * may still open, as opposed to what actually opened: a manifest whose blob fails to decrypt once is still one of+ * this account's, so it must never be mistaken for one that was taken away.+ * @returns The served manifest ids, empty when nothing has been pulled in this session+ */+ public manifestIdsServedByLastSnapshot(): string[] {+ return [...this.lastServedManifestIds];+ }++ /**+ * Drop the rows of every manifest the server no longer serves this account.+ *+ * A manifest that is absent from the snapshot is one this account lost (access revoked, or the manifest deleted+ * for everybody). Its rows cannot be written any more, and a merge keeps local-only rows, so without this they+ * would survive every pull and make every following push refuse itself ({@link findUnwritableManifests}) with no+ * way out. Dropping them is what a pull of a clean vault already does implicitly, by replacing the whole database.+ * @param sqliteClient - the open local vault, mutated in place+ * @param grantedManifestIds - the manifests the snapshot just served, the personal one included+ * @returns The manifest ids whose rows were dropped, empty when there was nothing to drop+ */+ public dropRowsOfLostManifests(sqliteClient: SqliteClient, grantedManifestIds: Iterable<string>): string[] {+ const granted = new Set([...grantedManifestIds].map(manifestIdKey));+ if (granted.size === 0) {+ // Nothing is known about what this account may open, and guessing with the user's data is worse than keeping it.+ return [];+ }++ const lost = [...VaultCodec.manifestIdsInVault(sqliteClient)].filter(manifestId => !granted.has(manifestIdKey(manifestId)));+ if (lost.length === 0) {+ return [];+ }++ for (const table of VaultCodec.stampedTables(sqliteClient)) {+ for (const manifestId of lost) {+ sqliteClient.executeUpdate(`DELETE FROM "${table}" WHERE lower(ManifestId) = ?`, [manifestIdKey(manifestId)]);+ }}- return [...VaultCodec.manifestIdsInVault(sqliteClient)].filter(manifestId => !writable.has(manifestId));+ devWarn(`[VaultSync] Dropped the rows of manifest(s) this account no longer holds (${lost.join(', ')}); they are gone from the server for this account.`);+ return lost;}/**@@ -1361,11 +1408,11 @@ export class VaultSyncService {canAdminister: false,}];- const stampedManifestIds = VaultCodec.manifestIdsInVault(sqliteClient);+ const stampedManifestIds = new Set([...VaultCodec.manifestIdsInVault(sqliteClient)].map(manifestIdKey));const sharedVeks = await SharingService.openSharedManifestVeks(sqliteClient);const manifestNames = multiManifestRendering.displayNames(sqliteClient);for (const record of Object.values(await SharingService.getSharedManifestRecords())) {- if (!stampedManifestIds.has(record.manifestId)) {+ if (!stampedManifestIds.has(manifestIdKey(record.manifestId))) {devLog(`[V2Push] Shared manifest ${record.manifestId} has no rows in this vault; leaving it out of the write rather than emptying it server-side.`);continue;}diff --git a/apps/browser-extension/src/utils/constants/storageKeys.ts b/apps/browser-extension/src/utils/constants/storageKeys.tsindex b09aa9724..660a16791 100644--- a/apps/browser-extension/src/utils/constants/storageKeys.ts+++ b/apps/browser-extension/src/utils/constants/storageKeys.ts@@ -83,7 +83,7 @@ export const StorageKeys = {VAULT_BLOB_CIPHER_CACHE: 'local:vaultBlobCipherCache',/** Blob hashes the server has stored (refreshed on every pull/push). */VAULT_SERVER_BLOB_HASHES: 'local:vaultServerBlobHashes',- /** Shared-vault key records (wrapped VEK grants). */+ /** Shared-manifest key records (wrapped VEK grants). */SHARED_MANIFESTS: 'local:sharedManifests',/*diff --git a/apps/browser-extension/src/utils/dist/core/models/webapi/index.d.ts b/apps/browser-extension/src/utils/dist/core/models/webapi/index.d.tsindex a0255b367..bc4a7203d 100644--- a/apps/browser-extension/src/utils/dist/core/models/webapi/index.d.ts+++ b/apps/browser-extension/src/utils/dist/core/models/webapi/index.d.ts@@ -604,7 +604,7 @@ type CreateSharedManifestRequest = {algorithm: VaultKeyAlgorithmValue;};/**- * The created vault, as served by POST /v2/Groups/{groupId}/manifests.+ * The created manifest, as served by POST /v2/Groups/{groupId}/manifests.*/type CreateSharedManifestResponse = {manifestId: string;diff --git a/apps/mobile-app/utils/dist/core/models/webapi/index.d.ts b/apps/mobile-app/utils/dist/core/models/webapi/index.d.tsindex a0255b367..bc4a7203d 100644--- a/apps/mobile-app/utils/dist/core/models/webapi/index.d.ts+++ b/apps/mobile-app/utils/dist/core/models/webapi/index.d.ts@@ -604,7 +604,7 @@ type CreateSharedManifestRequest = {algorithm: VaultKeyAlgorithmValue;};/**- * The created vault, as served by POST /v2/Groups/{groupId}/manifests.+ * The created manifest, as served by POST /v2/Groups/{groupId}/manifests.*/type CreateSharedManifestResponse = {manifestId: string;diff --git a/apps/server/AliasVault.Api/Controllers/V2/GroupsController.cs b/apps/server/AliasVault.Api/Controllers/V2/GroupsController.csindex 8c3335166..dd40d212d 100644--- a/apps/server/AliasVault.Api/Controllers/V2/GroupsController.cs+++ b/apps/server/AliasVault.Api/Controllers/V2/GroupsController.cs@@ -89,7 +89,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use.Where(u => allMemberIds.Contains(u.Id)).ToDictionaryAsync(u => u.Id, u => u.UserName ?? string.Empty);- // Only an admin can hand a vault key to somebody, so only an admin is served the keys to seal one with.+ // Only an admin can hand a manifest key to somebody, so only an admin is served the keys to seal one with.var administeredMemberIds = allMembers.Where(m => administeredGroupIds.Contains(m.GroupId)).Select(m => m.UserId);var publicKeys = administeredGroupIds.Count > 0 ? await GrantHelper.GetPrimaryKeysAsync(context, administeredMemberIds) : [];@@ -173,7 +173,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Usereturn NotFound(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.RECIPIENT_KEY_NOT_FOUND, 404));}- // A family holds a handful of vaults, enough to keep e.g. streaming and banking apart without growing without bound.+ // A family holds a handful of manifests, enough to keep e.g. streaming and banking apart without growing without bound.if (await context.VaultManifests.CountAsync(x => x.OwnerGroupId == groupId) >= MaxSharedVaults){return BadRequest(ApiErrorCodeHelper.CreateValidationErrorResponse(ApiErrorCode.GROUP_MANIFEST_LIMIT_REACHED, 400));@@ -210,7 +210,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use}/// <summary>- /// Offer a member of the group access to one of its shared manifests, handing over the vault key sealed for them in+ /// Offer a member of the group access to one of its shared manifests, handing over the manifest key sealed for them in/// the same call. The offer becomes a grant once they accept it./// </summary>/// <param name="groupId">The group ID.</param>@@ -249,8 +249,8 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use}/*- * Handing out a key is only meaningful for somebody who holds it: with several vaults 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 vault+ * 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.*/if (!await context.VaultManifestAccessKeys.AnyAsync(k => k.VaultManifestId == manifestId && k.UserId == me.Id && k.Type == ManifestKeyType.GrantKey))@@ -669,7 +669,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use.Select(m => m.ManifestId).ToListAsync()).ToHashSet();- // An offer whose vault is gone is not something the recipient can act on, so it is left out rather than shown.+ // An offer whose manifest is gone is not something the recipient can act on, so it is left out rather than shown.return [.. invitations.Where(i => existingManifestIds.Contains(i.ManifestId)).Select(i => new ReceivedManifestInvitation{Id = i.Id,@@ -683,7 +683,7 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use}/// <summary>- /// Close an offer of access, dropping the vault key sealed inside it.+ /// Close an offer of access, dropping the manifest key sealed inside it./// </summary>/// <param name="invitation">The invitation to close.</param>/// <param name="state">The state it ends in.</param>@@ -698,13 +698,13 @@ public class GroupsController(IAliasServerDbContextFactory dbContextFactory, Use}/// <summary>- /// Turn the vault key sealed into an offer of access into the accepting member's grant on that vault.+ /// Turn the manifest key sealed into an offer of access into the accepting member's grant on that manifest./// </summary>/// <param name="context">The database context.</param>/// <param name="invitation">The invitation being accepted.</param>/// <param name="userId">The accepting user.</param>/// <param name="keyVersion">The manifest's current VEK version, already checked against the offer's.</param>- /// <returns>Whether the accepting user ends up holding a grant on the vault.</returns>+ /// <returns>Whether the accepting user ends up holding a grant on the manifest.</returns>private async Task<bool> PromoteSealedGrantAsync(AliasServerDbContext context, GroupInvitation invitation, string userId, int keyVersion){if (invitation.EncryptedVek is null || invitation.UserGrantKeyId is null || invitation.VaultManifestId is null)diff --git a/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs b/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.csindex 66a8b8778..47b687ece 100644--- a/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs@@ -227,7 +227,7 @@ public enum ApiErrorCode/// <summary>/// The member is the last one who can open one of the group's shared manifests, so taking their access away would- /// leave that vault unopenable. Somebody else has to be given access to it first.+ /// leave that manifest unopenable. Somebody else has to be given access to it first./// </summary>LAST_MANIFEST_GRANT_HOLDER,@@ -239,7 +239,7 @@ public enum ApiErrorCode/// <summary>/// The shared manifest's key was rotated after the offer of access was made, so the key sealed into the offer no- /// longer opens the vault. The offer is closed and the inviter has to make a fresh one.+ /// longer opens the manifest. The offer is closed and the inviter has to make a fresh one./// </summary>INVITATION_KEY_OUTDATED,diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SharedManifestInfo.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SharedManifestInfo.csindex 05ae67336..39dcd4de0 100644--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SharedManifestInfo.cs+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Groups/SharedManifestInfo.cs@@ -16,9 +16,9 @@ public class SharedManifestInfo/// <summary>Gets or sets the manifest id.</summary>public required Guid ManifestId { get; set; }- /// <summary>Gets or sets the members holding a grant on this vault, i.e. the ones who can open it.</summary>+ /// <summary>Gets or sets the members holding a grant on this manifest, i.e. the ones who can open it.</summary>public List<string> MemberUserIds { get; set; } = [];- /// <summary>Gets or sets the offers of access to this vault still awaiting an answer (filled for admins only).</summary>+ /// <summary>Gets or sets the offers of access to this manifest still awaiting an answer (filled for admins only).</summary>public List<SentManifestInvitation> PendingInvitations { get; set; } = [];}diff --git a/core/models/src/webapi/Groups.ts b/core/models/src/webapi/Groups.tsindex fb72fd3c2..2561e57fa 100644--- a/core/models/src/webapi/Groups.ts+++ b/core/models/src/webapi/Groups.ts@@ -81,7 +81,7 @@ export type CreateSharedManifestRequest = {}/**- * The created vault, as served by POST /v2/Groups/{groupId}/manifests.+ * The created manifest, as served by POST /v2/Groups/{groupId}/manifests.*/export type CreateSharedManifestResponse = {manifestId: string;