4.2.0 • Published 9 months ago

@digitalbazaar/oid4-client v4.2.0

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
9 months ago

OID4Client Library (@digitalbazaar/oid4-client)

NPM Version

A JavaScript library for working with the OpenID 4 Verifiable Credential Issuance (OID4VCI) protocol, offering functionality for requesting Verifiable Credentials.

Table of Contents

Background

This library is a JavaScript (Node.js and browser) implementation of the OID4VCI v11 Protocol.

It allows you to perform the following operations:

  1. Request a credential to be issued given a OID4VCI credential offer.
  2. Request multiple credentials to be issued given a OID4VCI credential offer.
  3. Authenticate using a DID if the offer requires it.

Install

npm install @digitalbazaar/oid4-client

Usage

Importing the Library

import { OID4Client } from "@digitalbazaar/oid4-client";

Creating a Client from a Credential Offer

const clientFromOffer = await OID4Client.fromCredentialOffer({
  offer: "YOUR_CREDENTIAL_OFFER",
});

Constructor

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",
});

Requesting a Credential

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",
});

Requesting a Credential By Definition

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",
});

Testing

To run tests:

npm run test

Contribute

See the contribute file!

PRs accepted.

Note: If editing the Readme, please conform to the standard-readme specification.

Commercial Support

Commercial support for this library is available upon request from Digital Bazaar: support@digitalbazaar.com

License

New BSD License (3-clause) © Digital Bazaar

4.2.0

9 months ago

4.1.0

9 months ago

3.4.0

12 months ago

3.8.0

10 months ago

3.7.0

11 months ago

3.6.0

11 months ago

3.5.0

11 months ago

3.4.1

11 months ago

4.0.0

10 months ago

3.3.0

1 year ago

3.2.0

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.0

2 years ago