1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +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() { 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, { 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) { if (obj == null) {
return null; return null;
} }
return Object.assign(new AccountKeys(), { return Object.assign(new AccountKeys(), {
userKey: SymmetricCryptoKey.fromJSON(obj?.userKey), userKey: SymmetricCryptoKey.fromJSON(obj?.userKey),
masterKey: SymmetricCryptoKey.fromJSON(obj?.masterKey), masterKey: SymmetricCryptoKey.fromJSON(obj?.masterKey),