Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: dispatch vaultUnlocked event when password is updated.

Ammar Ahmed412631bf6774
diff --git a/packages/core/src/api/vault.ts b/packages/core/src/api/vault.ts
index bfe5920cb..363806bcc 100644
--- a/packages/core/src/api/vault.ts
+++ b/packages/core/src/api/vault.ts
@@ -40,14 +40,17 @@ export default class Vault {
}
private set password(value) {
- this.vaultPassword = value;
+ if (this.vaultPassword !== value) {
+ this.vaultPassword = value;
+ if (value) this.db.eventManager.publish(EVENTS.vaultUnlocked);
+ }
+
if (value) {
this.startEraser();
}
}
private startEraser() {
- this.db.eventManager.publish(EVENTS.vaultUnlocked);
clearTimeout(this.erasureTimeout);
const lockAfter = this.db.settings.getVaultLockAfter();