Update password change logic to use srpIdentity from server (#1911)

This commit is contained in:
Leendert de Borst
2026-04-15 20:32:43 +02:00
committed by Leendert de Borst
parent 84042eeba0
commit 4a7ed739f2

View File

@@ -185,12 +185,14 @@ export function useVaultMutate() : {
throw new Error(t('common.errors.unknownError'));
}
const privateKey = await NativeVaultManager.srpDerivePrivateKey(currentSalt, username, currentPasswordHashString);
// Use srpIdentity from server response if available, otherwise fall back to username.
const srpIdentity = data.srpIdentity ?? username;
const privateKey = await NativeVaultManager.srpDerivePrivateKey(currentSalt, srpIdentity, currentPasswordHashString);
const newClientSession = await NativeVaultManager.srpDeriveSession(
newClientEphemeral.secret,
currentServerEphemeral,
currentSalt,
username,
srpIdentity,
privateKey
);
@@ -226,7 +228,7 @@ export function useVaultMutate() : {
}
// Generate SRP password change data using native SRP
const newPrivateKey = await NativeVaultManager.srpDerivePrivateKey(newSalt, username, newPasswordHashString);
const newPrivateKey = await NativeVaultManager.srpDerivePrivateKey(newSalt, srpIdentity, newPasswordHashString);
const newVerifier = await NativeVaultManager.srpDeriveVerifier(newPrivateKey);
// Prepare vault for password change