diff --git a/additional-scripts.js b/additional-scripts.js index 9ce0ea75..5d1d8fed 100644 --- a/additional-scripts.js +++ b/additional-scripts.js @@ -1,7 +1,4 @@ -importScripts("https://cdn.jsdelivr.net/npm/tweetnacl-util@0.15.1/nacl-util.min.js"); -importScripts("https://cdnjs.cloudflare.com/ajax/libs/tweetnacl/1.0.2/nacl.min.js"); -importScripts("https://cdn.jsdelivr.net/npm/@sphereon/did-jwt/build/index.min.js"); self.addEventListener("push", function (event) { let payload; @@ -22,64 +19,6 @@ self.addEventListener("push", function (event) { self.addEventListener('message', function(event) { const data = event.data; - - const secret = await page.evaluate(() => { - const secret = localStorage.getItem('secret'); - return secret; - }); - - const secretUint8Array = util.decodeBase64(secret); - - const dbNames = await page.evaluate(() => { - return new Promise((resolve, reject) => { - let db = indexedDB.open('TimeSafari'); - db.onsuccess = async (event) => { - this.db = event.target.result; - const transaction = this.db.transaction('settings', 'readonly'); - const objectStore = transaction.objectStore('settings'); - const request = objectStore.get(1); - request.onsuccess = () => { - const row = request.result; - resolve(row); - } - }; - }); - }, {timeout: 10000}); - - const dbAccounts = await page.evaluate(() => { - return new Promise((resolve, reject) => { - let db = indexedDB.open('TimeSafariAccounts'); - db.onsuccess = async (event) => { - this.db = event.target.result; - const transaction = this.db.transaction('accounts', 'readonly'); - const objectStore = transaction.objectStore('accounts'); - const request = objectStore.getAll(); - request.onsuccess = () => { - const rows = request.result; - resolve(rows); - } - }; - }); - }, {timeout: 10000}); - - for (var i = 0; i < dbAccounts.length; i++) { - let account = dbAccounts[i]; - let did = account['did']; - let publicKeyHex = account['publicKeyHex']; - let identity = account['identity']; - - const messageWithNonceAsUint8Array = util.decodeBase64(identity); - const nonce = messageWithNonceAsUint8Array.slice(0, 24); - const message = messageWithNonceAsUint8Array.slice(24, identity.length); - - const decrypted = nacl.secretbox.open(message, nonce, secretUint8Array); - - const decoder = new TextDecoder('utf-8'); - const string = decoder.decode(decrypted); - const indentifier = JSON.parse(string); - - - } switch (data.command) { case 'account':