forked from jsnbuchanan/crowd-funder-for-time-pwa
NACL integrated
This commit is contained in:
@@ -6,7 +6,7 @@ importScripts(
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
console.log("Install event fired.");
|
||||
importScripts("safari-notifications.js");
|
||||
importScripts("safari-notifications.js", "nacl.js");
|
||||
console.log("scripts imported", event);
|
||||
});
|
||||
|
||||
|
||||
@@ -101,11 +101,13 @@ async function getNotificationCount() {
|
||||
if (did == activeDid) {
|
||||
let publicKeyHex = account["publicKeyHex"];
|
||||
let identity = account["identity"];
|
||||
result = publicKeyHex;
|
||||
const messageWithNonceAsUint8Array = self.decodeBase64(identity);
|
||||
const nonce = messageWithNonceAsUint8Array.slice(0, 24);
|
||||
const message = messageWithNonceAsUint8Array.slice(24, identity.length);
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
const decrypted = self.secretbox.open(message, nonce, secretUint8Array);
|
||||
|
||||
result = decrypted;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user