Skip to content

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

Update status response (#2159)

Leendert de Borstdbdaacee8541
diff --git a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
index bce9b67aa..08502342c 100644
--- a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
+++ b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
@@ -851,6 +851,7 @@ async function uploadDirtyBucketsOnly(sqliteClient: SqliteClient, scopes: VaultM
* Which tables make up each bucket category is owned by the Rust layer.
*/
const layout = await vaultCodecBucketLayout();
+ const username = (await storage.getItem('local:username')) as string;
for (const category of new Set(scopes)) {
const spec = layout.find(entry => entry.category === category);
@@ -865,7 +866,7 @@ async function uploadDirtyBucketsOnly(sqliteClient: SqliteClient, scopes: VaultM
*/
const tables = VaultCodec.readNamedTables(sqliteClient, [...spec.tables, await vaultCodecOverflowTable()]);
const bucket = await vaultCodecExtractBucket(category, tables);
- const result = await vaultSyncService.pushDataBucketOnly(bucket, encryptionKey);
+ const result = await vaultSyncService.pushDataBucketOnly(bucket, encryptionKey, username);
if (result.status !== 'ok') {
// Conflict persisted even after the rebase-retry, let the caller run a full re-sync (status 2).
return { status: 2, newRevisionNumber: (await storage.getItem('local:serverRevision')) as number | null ?? 0 };
@@ -1290,7 +1291,7 @@ export async function handleGetServerRevision(): Promise<number> {
/**
* Catch this device up when ANOTHER device performed the KEK/VEK migration.
*
- * After another device migrates, the server reports hasVaultKey=true but this device may still be holding the old
+ * After another device migrates, the server reports isMigrated=true but this device may still be holding the old
* password-derived key (the KEK) as its session key, with no cached wrapped VEK. Rather than force a re-login, this
* fetches the wrapped VEK, unwraps it with the session key (= the KEK), re-encrypts the locally persisted vault
* under the VEK, swaps the session key to the VEK, and caches the wrapped VEK. A no-op when there is nothing to
@@ -1298,10 +1299,10 @@ export async function handleGetServerRevision(): Promise<number> {
*
* TODO: this method can be removed once all users have migrated to the KEK/VEK model.
*
- * @param statusResponse - the status response from the server (hasVaultKey signals another device migrated)
+ * @param statusResponse - the status response from the server (isMigrated=true signals another device migrated)
*/
async function catchUpAfterRemoteVaultKeyMigration(statusResponse: StatusResponseV2): Promise<boolean> {
- if (statusResponse.hasVaultKey !== true) {
+ if (!statusResponse.isMigrated) {
return true;
}
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.ts
index b41b69145..177bf375d 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
@@ -77,15 +77,15 @@ type ManifestRevision = {
revision: number;
};
/**
- * Status response type (v2). Returned by GET /v2/Auth/status.
+ * Status response type (v2).
*/
type StatusResponseV2 = {
clientVersionSupported: boolean;
serverVersion: string;
manifestRevisions: ManifestRevision[];
srpSalt: string;
- /** Whether the user has a vault key (KEK/VEK model). Optional: absent on older servers. */
- hasVaultKey?: boolean;
+ /** Whether the user has migrated to the manifest-v1 storage format (and the KEK/VEK key model). */
+ isMigrated: boolean;
};
/**
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.ts
index b41b69145..177bf375d 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
@@ -77,15 +77,15 @@ type ManifestRevision = {
revision: number;
};
/**
- * Status response type (v2). Returned by GET /v2/Auth/status.
+ * Status response type (v2).
*/
type StatusResponseV2 = {
clientVersionSupported: boolean;
serverVersion: string;
manifestRevisions: ManifestRevision[];
srpSalt: string;
- /** Whether the user has a vault key (KEK/VEK model). Optional: absent on older servers. */
- hasVaultKey?: boolean;
+ /** Whether the user has migrated to the manifest-v1 storage format (and the KEK/VEK key model). */
+ isMigrated: boolean;
};
/**
diff --git a/apps/server/AliasVault.Api/Controllers/V2/StatusController.cs b/apps/server/AliasVault.Api/Controllers/V2/StatusController.cs
index 42a1fa789..58f413d96 100644
--- a/apps/server/AliasVault.Api/Controllers/V2/StatusController.cs
+++ b/apps/server/AliasVault.Api/Controllers/V2/StatusController.cs
@@ -64,7 +64,6 @@ public class StatusController(IAliasServerDbContextFactory dbContextFactory, Use
// Current SRP salt: lives on the password VaultKey for v2 migrated users, on the root manifest for legacy users.
var encryptionSettings = AuthHelper.GetUserLatestVaultEncryptionSettings(user);
- var hasVaultKey = user.VaultKeys.Any(x => x.KeyType == AuthHelper.VaultKeyTypePassword);
// Check client version compatibility if the header is provided.
var clientSupported = false;
@@ -82,8 +81,7 @@ public class StatusController(IAliasServerDbContextFactory dbContextFactory, Use
ClientVersionSupported = clientSupported,
ServerVersion = AppInfo.GetFullVersion(),
SrpSalt = encryptionSettings.Salt,
- HasVaultKey = hasVaultKey,
- StorageFormat = isMigrated ? StorageFormat.Manifest : StorageFormat.SqliteBlob,
+ IsMigrated = isMigrated,
ManifestRevisions = manifestRevisions,
BucketRevisions = bucketRevisions,
});
diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Status/StatusResponse.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Status/StatusResponse.cs
index 1f72c0660..aee65f285 100644
--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Status/StatusResponse.cs
+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Status/StatusResponse.cs
@@ -35,13 +35,11 @@ public class StatusResponse
public required string SrpSalt { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether the user has a vault key (KEK/VEK model).
- /// TODO: remove once every user has migrated to the KEK/VEK model.
+ /// Gets or sets a value indicating whether the user has migrated to the manifest-v1 storage format (and thus the
+ /// KEK/VEK key model). False while still on the legacy sqlite-blob format.
+ /// TODO: remove once every user has migrated off the legacy sqlite-blob format.
/// </summary>
- public bool HasVaultKey { get; set; }
-
- /// <summary>Gets or sets the storage format the server has recorded for the user's latest vault.</summary>
- public required StorageFormat StorageFormat { get; set; }
+ public required bool IsMigrated { get; set; }
/// <summary>
/// Gets or sets the latest revision for each logical manifest the user has access to.
diff --git a/core/models/src/webapi/StatusResponseV2.ts b/core/models/src/webapi/StatusResponseV2.ts
index a2547351b..f8059e466 100644
--- a/core/models/src/webapi/StatusResponseV2.ts
+++ b/core/models/src/webapi/StatusResponseV2.ts
@@ -15,6 +15,6 @@ export type StatusResponseV2 = {
serverVersion: string;
manifestRevisions: ManifestRevision[];
srpSalt: string;
- /** Whether the user has a vault key (KEK/VEK model). Optional: absent on older servers. */
- hasVaultKey?: boolean;
+ /** Whether the user has migrated to the manifest-v1 storage format (and the KEK/VEK key model). */
+ isMigrated: boolean;
}