Browse Source

adding fetching of claims. WIP: JWT verification

home-view-notification-improvements
Matthew Raymer 1 year ago
parent
commit
80b7ab2f82
  1. 11
      sw_scripts/safari-notifications.js

11
sw_scripts/safari-notifications.js

@ -129,6 +129,7 @@ function bufferFromBase64(base64) {
issuer: did,
signer,
});
console.error(jwt);
return jwt;
}
@ -283,8 +284,9 @@ function bufferFromBase64(base64) {
return async function(data) {
const privateKey = Secp256k1.uint256(privateKeyBytes, 16);
const hash = await sha256(data);
console.error("sha256", hash);
const digest = Secp256k1.uint256(hash, 16);
console.error(privateKey, digest);
const signature = Secp256k1.ecsign(privateKey, digest);
const sigR = Secp256k1.uint256(signature.r,16);
const sigS = Secp256k1.uint256(signature.s,16);
@ -447,6 +449,13 @@ async function getNotificationCount() {
headers["Authorization"] = "Bearer " + await accessToken(identifier);
let response = await fetch("https://test-api.endorser.ch/api/v2/report/claims", {
method: 'GET',
headers: headers,
});
console.error(did, response.status);
console.error(await response.json());
result = decrypted;
break;

Loading…
Cancel
Save