1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-21 11:35:34 +01:00

PM-4368 - Resolving issue with incorrect account fingerprint being generated on desktop (an undefined public key was being converted into "" which then was being considered a valid, in memory public key for the handling in the getPublicKey method on the crypto service). Persisting undefined helps the crypto service properly identify that there is not a public key and it will instead derive it properly from the private key. (#6715)

This commit is contained in:
Jared Snider 2023-11-03 12:38:10 -04:00 committed by GitHub
parent 161c1c63ff
commit f5aae4709d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,8 +140,11 @@ export class AccountKeys {
>();
toJSON() {
// If you pass undefined into fromBufferToByteString, you will get an empty string back
// which will cause all sorts of headaches down the line when you try to getPublicKey
// and expect a Uint8Array and get an empty string instead.
return Utils.merge(this, {
publicKey: Utils.fromBufferToByteString(this.publicKey),
publicKey: this.publicKey ? Utils.fromBufferToByteString(this.publicKey) : undefined,
});
}
@ -149,7 +152,6 @@ export class AccountKeys {
if (obj == null) {
return null;
}
return Object.assign(new AccountKeys(), {
userKey: SymmetricCryptoKey.fromJSON(obj?.userKey),
masterKey: SymmetricCryptoKey.fromJSON(obj?.masterKey),