Skip to content

Commit c4ebe87

Browse files
authored
Merge pull request #733 from Authenticator-Extension/encrypt-unencrypted
Encrypt any unencrypted secrets on unlock
2 parents 3fe1582 + 9a42a54 commit c4ebe87

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/store/Accounts.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,21 @@ export class Accounts implements Module {
296296
state.state.encryption.updateEncryptionPassword(key);
297297
await state.dispatch("updateEntries");
298298

299+
// Encrypt any unencrypted entries.
300+
// Browser sync can cause unencrypted entries to show up.
301+
let needUpdateStorage = false;
302+
for (const entry of state.state.entries) {
303+
if (!entry.encSecret) {
304+
await entry.changeEncryption(state.state.encryption);
305+
needUpdateStorage = true;
306+
}
307+
}
308+
309+
if (needUpdateStorage) {
310+
await EntryStorage.set(state.state.entries);
311+
await state.dispatch("updateEntries");
312+
}
313+
299314
if (!state.getters.currentlyEncrypted) {
300315
chrome.runtime.sendMessage({
301316
action: "cachePassphrase",

0 commit comments

Comments
 (0)