https://github.com/digitalbazaar/oid4-client
An OIDC4VCI client
https://github.com/digitalbazaar/oid4-client
Last synced: 3 months ago
JSON representation
An OIDC4VCI client
- Host: GitHub
- URL: https://github.com/digitalbazaar/oid4-client
- Owner: digitalbazaar
- License: bsd-3-clause
- Created: 2022-10-31T14:55:22.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-30T20:55:51.000Z (3 months ago)
- Last Synced: 2026-03-30T22:23:19.626Z (3 months ago)
- Language: JavaScript
- Size: 253 KB
- Stars: 2
- Watchers: 11
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# OID4Client Library _(@digitalbazaar/oid4-client)_
[](https://npm.im/@digitalbazaar/oid4-client)
A JavaScript library for working with the OpenID 4 Verifiable Credential
Issuance (OID4VCI) protocol, offering functionality for requesting Verifiable
Credentials.
## Table of Contents
- [Background](#background)
- [Install](#install)
- [Usage](#usage)
- [Testing](#testing)
- [Contribute](#contribute)
- [Commercial Support](#commercial-support)
- [License](#license)
## Background
This library is a JavaScript (Node.js and browser) implementation of the
[OID4VCI v11](https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html)
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
```bash
npm install @digitalbazaar/oid4-client
```
## Usage
### Importing the Library
```javascript
import { OID4Client } from "@digitalbazaar/oid4-client";
```
### Creating a Client from a Credential Offer
```javascript
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:
```javascript
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:
```javascript
const credential = await client.requestCredential({
did: "YOUR_DID",
didProofSigner: "YOUR_DID_PROOF_SIGNER",
});
```
To request multiple credentials using the credential offer:
```javascript
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:
```javascript
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:
```javascript
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](https://github.com/digitalbazaar/bedrock/blob/master/CONTRIBUTING.md)!
PRs accepted.
Note: If editing the Readme, please conform to the
[standard-readme](https://github.com/RichardLitt/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)](LICENSE) © Digital Bazaar