switch the encryption secret from localStorage to IndexedDB (because localStorage gets lost so often)
This commit is contained in:
@@ -115,7 +115,7 @@ self.addEventListener("push", function (event) {
|
||||
self.addEventListener("message", (event) => {
|
||||
logConsoleAndDb("Service worker got a message...", event);
|
||||
if (event.data && event.data.type === "SEND_LOCAL_DATA") {
|
||||
self.secret = event.data.data;
|
||||
self.secret = event.data.data; // used in safari-notifications.js to decrypt the account identity
|
||||
event.ports[0].postMessage({ success: true });
|
||||
}
|
||||
logConsoleAndDb("Service worker posted a message.");
|
||||
|
||||
@@ -515,6 +515,7 @@ async function getNotificationCount() {
|
||||
|
||||
const identity = activeAccount && activeAccount["identity"];
|
||||
if (identity && "secret" in self) {
|
||||
// get the "secret" pulled in additional-scripts.js to decrypt the "identity" inside the IndexedDB; see account.ts
|
||||
const secret = self.secret;
|
||||
const secretUint8Array = self.decodeBase64(secret);
|
||||
const messageWithNonceAsUint8Array = self.decodeBase64(identity);
|
||||
|
||||
Reference in New Issue
Block a user