mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
core: fix vault key not getting synced
This commit is contained in:
committed by
Abdullah Atta
parent
4a557c67b7
commit
7b08b5c035
@@ -263,12 +263,14 @@ class Sync {
|
||||
lastSynced
|
||||
);
|
||||
|
||||
if (serverResponse.vaultKey) {
|
||||
await this.merger.mergeItem(
|
||||
"vaultKey",
|
||||
serverResponse.vaultKey,
|
||||
serverResponse.lastSynced
|
||||
);
|
||||
if (
|
||||
serverResponse.vaultKey &&
|
||||
serverResponse.vaultKey.cipher !== null &&
|
||||
serverResponse.vaultKey.iv !== null &&
|
||||
serverResponse.vaultKey.salt !== null &&
|
||||
serverResponse.vaultKey.length > 0
|
||||
) {
|
||||
await this.db.vault._setKey(serverResponse.vaultKey);
|
||||
}
|
||||
|
||||
this.connection.off("SendItems");
|
||||
|
||||
@@ -179,6 +179,8 @@ export default class Vault {
|
||||
const note = this._db.notes.note(noteId);
|
||||
if (!note) return;
|
||||
await this._unlockNote(note.data, password, true);
|
||||
|
||||
if (!this.exists()) await this.create(password);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,6 +194,7 @@ export default class Vault {
|
||||
|
||||
const unlockedNote = await this._unlockNote(note.data, password, false);
|
||||
this._password = password;
|
||||
if (!this.exists()) await this.create(this._password);
|
||||
return unlockedNote;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user