Skip to content

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

Update unlock scaffolding logic (#2469)

Leendert de Borst1281544ce0af
diff --git a/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx b/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx
index 74425ee10..5d94600f7 100644
--- a/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/security/delete-account.tsx
@@ -1,5 +1,3 @@
-import { Buffer } from 'buffer';
-
import { SrpAuthService } from '@aliasvault/client/auth/SrpAuthService';
import { router } from 'expo-router';
import { useState } from 'react';
@@ -162,8 +160,8 @@ export default function DeleteAccountScreen(): React.ReactNode {
const srpIdentity = data.srpIdentity ?? username;
setLoadingStatus(t('settings.securitySettings.deleteAccount.verifyingWithServer'));
- // Convert base64 string to hex string
- const currentPasswordHashString = Buffer.from(currentPasswordHashBase64, 'base64').toString('hex').toUpperCase();
+ // The SRP password hash the account's encryption type makes from the unlock key.
+ const currentPasswordHashString = await SrpAuthService.srpPasswordHash(currentPasswordHashBase64, data.encryptionType);
// Derive the SRP client proof to authenticate the deletion with the server.
const clientProof = await SrpAuthService.deriveClientProof(
diff --git a/apps/mobile-app/ios/VaultStoreKit/Services/VaultSync.swift b/apps/mobile-app/ios/VaultStoreKit/Services/VaultSync.swift
index 25daec475..d29cc5218 100644
--- a/apps/mobile-app/ios/VaultStoreKit/Services/VaultSync.swift
+++ b/apps/mobile-app/ios/VaultStoreKit/Services/VaultSync.swift
@@ -73,9 +73,10 @@ internal final class VaultSync {
return VaultVersionCheckResult(isNewVersionAvailable: result["hasNewerVault"] as? Bool ?? false, syncState: vaultStore.getSyncState())
}
- /// Resolve the vault key right after login: the account's key chain is opened with the password-derived key (KEK)
- /// and cached as-is. The session then opens from that chain like every later unlock, and the keychain keeps the
- /// KEK; a legacy account has no chain and its KEK is the vault key. Returns the vault key (base64).
+ /// Resolve the vault key right after login: the account's key chain is opened with the unlock key (the password's
+ /// Argon2id output) and cached as-is. The session then opens from that chain like every later unlock, and keeps
+ /// the Account Key; an account not yet upgraded has no chain and its unlock key is the vault key. Returns the vault
+ /// key (base64).
func resolveVaultKey(using webApiService: WebApiService, derivedKeyBase64: String) async throws -> String {
let result = try await run("resolveVaultKey", using: webApiService, encryptionKey: derivedKeyBase64)
guard result["success"] as? Bool == true else {