Path 2: JWS with claims (JavaScript)
ProofPack Path 2 — verifying JWS or JWT with claims in JavaScript
import { AttestedMerkleExchangeReader } from '@zipwire/proofpack';
const reader = new AttestedMerkleExchangeReader();
const result = await reader.readAsync(
jws, // From Authorization: Bearer <JWS>
verificationContext
);
if (result.isValid) {
const claims = result.document.merkleTree.leaves;
// Use verified claims
if (claims.nationality === 'UK' && claims.age >= 18) {
// Process the request
const agent = {
wallet: result.agentWallet,
human: result.humanWallet,
authorizedAt: result.delegationDate,
claims: claims
};
await processRequest(agent);
}
}Last updated