[PM-1593] send password as null if it is not in state (#5634)

This commit is contained in:
André Bispo 2023-06-23 17:21:48 +01:00 committed by GitHub
parent 61c3176917
commit c31504cab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -304,13 +304,16 @@ export class AuthService implements AuthServiceAbstraction {
).encKey,
pubKey.buffer
);
const encryptedMasterPassword = await this.cryptoService.rsaEncrypt(
Utils.fromUtf8ToArray(await this.stateService.getKeyHash()),
pubKey.buffer
);
let encryptedMasterPassword = null;
if ((await this.stateService.getKeyHash()) != null) {
encryptedMasterPassword = await this.cryptoService.rsaEncrypt(
Utils.fromUtf8ToArray(await this.stateService.getKeyHash()),
pubKey.buffer
);
}
const request = new PasswordlessAuthRequest(
encryptedKey.encryptedString,
encryptedMasterPassword.encryptedString,
encryptedMasterPassword?.encryptedString,
await this.appIdService.getAppId(),
requestApproved
);