Browse Source

adding fetching of claims. WIP: JWT verification

pull/78/head
Matthew Raymer 12 months 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, issuer: did,
signer, signer,
}); });
console.error(jwt);
return jwt; return jwt;
} }
@ -283,8 +284,9 @@ function bufferFromBase64(base64) {
return async function(data) { return async function(data) {
const privateKey = Secp256k1.uint256(privateKeyBytes, 16); const privateKey = Secp256k1.uint256(privateKeyBytes, 16);
const hash = await sha256(data); const hash = await sha256(data);
console.error("sha256", hash);
const digest = Secp256k1.uint256(hash, 16); const digest = Secp256k1.uint256(hash, 16);
console.error(privateKey, digest);
const signature = Secp256k1.ecsign(privateKey, digest); const signature = Secp256k1.ecsign(privateKey, digest);
const sigR = Secp256k1.uint256(signature.r,16); const sigR = Secp256k1.uint256(signature.r,16);
const sigS = Secp256k1.uint256(signature.s,16); const sigS = Secp256k1.uint256(signature.s,16);
@ -447,6 +449,13 @@ async function getNotificationCount() {
headers["Authorization"] = "Bearer " + await accessToken(identifier); 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; result = decrypted;
break; break;

Loading…
Cancel
Save