11.1.1 • Published 30 days ago

@digitalbazaar/http-signature-zcap-verify v11.1.1

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
30 days ago

http-signature-zcap-verify (@digitalbazaar/http-signature-zcap-verify)

A library for verifying Authorization Capability (ZCAP) invocations via HTTP signatures

Install

  • Browsers and Node.js 14+ are supported.
  • Web Crypto API required. Older browsers and Node.js 14 must use a polyfill.

To install from NPM:

npm install @digitalbazaar/http-signature-zcap-verify

Example "getVerifier" for "verifyCapabilityInvocation"

import {CryptoLD} from 'crypto-ld';
import {Ed25519VerificationKey2020} from
  '@digitalbazaar/ed25519-verification-key-2020';

const cryptoLd = new CryptoLD();
cryptoLd.use(Ed25519VerificationKey2020);

async function getVerifier({keyId, documentLoader}) {
  const key = await cryptoLd.fromKeyId({id: keyId, documentLoader});
  const verificationMethod = await key.export(
    {publicKey: true, includeContext: true});
  const verifier = key.verifier();
  return {verifier, verificationMethod};
}