A JavaScript library for working with the OpenID 4 Verifiable Credential Issuance (OID4VCI) protocol, offering functionality for requesting Verifiable Credentials.
This library is a JavaScript (Node.js and browser) implementation of the OID4VCI v11 Protocol.
It allows you to perform the following operations:
- Request a credential to be issued given a OID4VCI credential offer.
- Request multiple credentials to be issued given a OID4VCI credential offer.
- Authenticate using a DID if the offer requires it.
npm install @digitalbazaar/oid4-client
import { OID4Client } from "@digitalbazaar/oid4-client";
const clientFromOffer = await OID4Client.fromCredentialOffer({
offer: "YOUR_CREDENTIAL_OFFER",
});
You can also instantiate the OID4Client
directly using the following parameters:
accessToken
(Optional)issuerConfig
metadata
offer
Example:
const client = new OID4Client({
accessToken: "YOUR_ACCESS_TOKEN",
issuerConfig: "YOUR_ISSUER_CONFIG",
metadata: "YOUR_METADATA",
offer: "YOUR_OFFER",
});
To request a single credential using the credential offer:
const credential = await client.requestCredential({
did: "YOUR_DID",
didProofSigner: "YOUR_DID_PROOF_SIGNER",
});
To request multiple credentials using the credential offer:
const credentials = await client.requestCredentials({
did: "YOUR_DID",
didProofSigner: "YOUR_DID_PROOF_SIGNER",
});
To request a single credential using a specific credential definition:
const credential = await client.requestCredential({
credentialDefinition: "YOUR_CREDENTIAL_DEFINITION",
did: "YOUR_DID",
didProofSigner: "YOUR_DID_PROOF_SIGNER",
});
To request multiple credentials using credential definition requests:
const credentials = await client.requestCredentials({
requests: "YOUR_REQUESTS",
did: "YOUR_DID",
didProofSigner: "YOUR_DID_PROOF_SIGNER",
});
To run tests:
npm run test
See the contribute file!
PRs accepted.
Note: If editing the Readme, please conform to the standard-readme specification.
Commercial support for this library is available upon request from Digital Bazaar: [email protected]
New BSD License (3-clause) © Digital Bazaar