# @zedeid-sdk/sd-vc-lib

> Issue, present and verify selectively disclosable credentials

Latest version **2.0.0** (published 2021-12-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install @zedeid-sdk/sd-vc-lib
pnpm add @zedeid-sdk/sd-vc-lib
yarn add @zedeid-sdk/sd-vc-lib
bun add @zedeid-sdk/sd-vc-lib
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-12-28 |
| First published | 2021-12-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 2 MB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | RLT |
| Maintainers | jayampathiadhikari, bashana.rlt, radicalledger |

## Links

- npm: https://www.npmjs.com/package/@zedeid-sdk/sd-vc-lib
- Repository: https://github.com/RadicalLedger/zedeid-vcsd-lib
- Homepage: https://github.com/RadicalLedger/zedeid-vcsd-lib#readme
- Issues: https://github.com/RadicalLedger/zedeid-vcsd-lib/issues
- npm.io page: https://npm.io/package/@zedeid-sdk/sd-vc-lib

## Dependencies (8)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [sha.js](https://npm.io/package/sha.js.md) ^2.4.11
- [hash.js](https://npm.io/package/hash.js.md) ^1.1.7
- [secp256k1](https://npm.io/package/secp256k1.md) ^4.0.2
- [@types/sha.js](https://npm.io/package/@types/sha.js.md) ^2.4.0
- [js-crypto-hmac](https://npm.io/package/js-crypto-hmac.md) ^1.0.0
- [@types/secp256k1](https://npm.io/package/@types/secp256k1.md) ^4.0.1
- [ethereum-public-key-to-address](https://npm.io/package/ethereum-public-key-to-address.md) 0.0.5

## Recent versions

- 2.0.0 (latest) — 2021-12-28
- 1.0.0 — 2021-12-12
- 0.0.9-2 — 2021-12-10
- 0.0.9 — 2021-12-10

## README

# sd-vc-lib

Package to issue, present and verify selectively disclosable verifiable credentials.

## Breaking changes

Credentials and presentations issued with v2.0.0 will no longer be valid with v3.0.0

## Installation

-   Node.js 16.0+ is required.

To install locally (for development):

```bash
git clone https://github.com/RadicalLedger/zedeid-vcsd-lib-core.git
cd zedeid-vcsd-lib-core

yarn install or npm install
yarn dev or npm run dev
```

## Usage

### Create Verifiable Credential

Create selectively disclosure verifiable credential for given claims.

```ts
import { verifiable } from 'sd-vc-lib';

verifiable.credential.create({
    issuerPrivateKey, // issuer's private key in hex.
    issuanceDate, // (optional) issuance date in ISO format YYYY-MM-DDTHH:mm:ss
    holderPublicKey, // holders's public key in hex.
    credential, // credential need to be singed as key value pairs,
    documentLoader, // load the document for the given DID.
    suite // (optional) crypto suit used to create the verifiable credential.
});
```

### Verify verifiable credential

verify the authenticity of a verifiable credential.

```ts
import { verifiable } from 'sd-vc-lib';

verifiable.credential.verify({
    vc, // singed credential need to be verified.
    documentLoader, // load the document for the given DID.
    holderPublicKey, // holders's public key in hex.
    issuerPublicKey, // (optional) issuer's public key in hex.
    suite // (optional) crypto suit used to create the verifiable credential.
});
```

### Create Verifiable presentation

Create a verifiable presentation with a given list of selectively disclosure verifiable credentials.

```ts
import { verifiable } from 'sd-vc-lib';

verifiable.presentation.create({
    holderPrivateKey, // holder's private key in hex.
    verifiableCredential, // array of verifiable credentials.
    mask, // (optional) array of mask credentials for each verifiable credential in key pair format or an empty object.
    issuanceDate, // (optional) issuance date in ISO format YYYY-MM-DDTHH:mm:ss
    documentLoader, // (optional) load the document for the given DID.
    suite, // (optional) crypto suit used to create the verifiable credential.
    challenge, // (optional) random string ( eg: fcc8b78e-ecca-426a-a69f-8e7c927b845f )
    domain // (optional) domain value ( eg: www.example.com )
});
```

### Verify verifiable presentation

verify the authenticity of a verifiable presentation.

```ts
import { verifiable } from 'sd-vc-lib';

verifiable.presentation.verify({
    vp, // singed credential need to be verified.
    documentLoader, // load the document for the given DID.
    issuerPublicKey, // issuer's public key in hex.
    holderPublicKey, // (optional) holders's public key in hex.
    suite, // (optional) crypto suit used to create the verifiable credential.
    challenge, // (optional) random string ( eg: fcc8b78e-ecca-426a-a69f-8e7c927b845f )
    domain // (optional) domain value ( eg: www.example.com )
});
```

---
_Source: https://npm.io/package/@zedeid-sdk/sd-vc-lib · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
