Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Desktop: Check for correct Realm encryption key length #1585

Merged
merged 1 commit into from
May 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/desktop/src/libs/realm.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const ALIAS_REALM = 'realm_enc_key';
*/
export const getEncryptionKey = () => {
return Electron.readKeychain(ALIAS_REALM).then((encryptionKey) => {
if (encryptionKey === null) {
if (encryptionKey === null || encryptionKey.split(',').length !== 64) {
const key = Uint8Array.from(randomBytes(64));

return Electron.setKeychain(ALIAS_REALM, key.toString()).then(() => key);
Expand Down