fix possible null value of public key
This commit is contained in:
parent
87355f18d2
commit
fe842b28e3
|
@ -203,6 +203,10 @@ class Encryption {
|
||||||
// This public key is already encoded using EJSON.stringify in the `persistKeys` method
|
// This public key is already encoded using EJSON.stringify in the `persistKeys` method
|
||||||
const publicKey = UserPreferences.getString(`${server}-${E2E_PUBLIC_KEY}`);
|
const publicKey = UserPreferences.getString(`${server}-${E2E_PUBLIC_KEY}`);
|
||||||
|
|
||||||
|
if (!publicKey) {
|
||||||
|
throw new Error('Public key not found in local storage, password not changed');
|
||||||
|
}
|
||||||
|
|
||||||
// Send the new keys to the server
|
// Send the new keys to the server
|
||||||
await Services.e2eSetUserPublicAndPrivateKeys(publicKey, encodedPrivateKey);
|
await Services.e2eSetUserPublicAndPrivateKeys(publicKey, encodedPrivateKey);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue