0.7.2 • Published 8 months ago

@sd-jwt/sd-jwt-vc v0.7.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

License NPM Release Stars

SD-JWT Implementation in JavaScript (TypeScript)

SD-JWT-VC

About

SD-JWT-VC format based on the core functions

Check the detail description in our github repo.

Installation

To install this project, run the following command:

# using npm
npm install @sd-jwt/sd-jwt-vc

# using yarn
yarn add @sd-jwt/sd-jwt-vc

# using pnpm
pnpm install @sd-jwt/sd-jwt-vc

Ensure you have Node.js installed as a prerequisite.

Usage

Here's a basic example of how to use this library:

import { DisclosureFrame } from '@sd-jwt/sd-jwt-vc';

// identifier of the issuer
const iss = "University";

// issuance time
const iat = new Date().getTime() / 1000;

//unique identifier of the schema
const vct = "University-Degree";

// Issuer defines the claims object with the user's information
const claims = {
  firstname: 'John',
  lastname: 'Doe',
  ssn: '123-45-6789',
  id: '1234',
};

// Issuer defines the disclosure frame to specify which claims can be disclosed/undisclosed
const disclosureFrame: DisclosureFrame<typeof claims> = {
  _sd: ['firstname', 'lastname', 'ssn'],
};

// Issuer issues a signed JWT credential with the specified claims and disclosure frame
// returns an encoded JWT
const credential = await sdjwt.issue({iss, iat, vct, ...claims}, disclosureFrame);

// Holder may validate the credential from the issuer
const valid = await sdjwt.validate(credential);

// Holder defines the presentation frame to specify which claims should be presented
// The list of presented claims must be a subset of the disclosed claims
const presentationFrame = ['firstname', 'ssn'];

// Holder creates a presentation using the issued credential and the presentation frame
// returns an encoded SD JWT.
const presentation = await sdjwt.present(credential, presentationFrame);

// Verifier can verify the presentation using the Issuer's public key
const verified = await sdjwt.verify(presentation);

Check out more details in our documentation or examples

Dependencies

  • @sd-jwt/core
  • @sd-jwt/types
  • @sd-jwt/utils
0.7.2-next.9

8 months ago

0.7.2-next.8

8 months ago

0.7.2

11 months ago

0.7.2-next.2

11 months ago

0.7.2-next.1

11 months ago

0.7.2-next.7

10 months ago

0.7.2-next.4

11 months ago

0.7.2-next.6

11 months ago

0.7.2-next.5

11 months ago

0.7.1-next.2

1 year ago

0.7.1

1 year ago

0.7.2-next.0

1 year ago

0.7.1-next.1

1 year ago

0.6.2-next.27

1 year ago

0.7.1-next.0

1 year ago

0.7.0

1 year ago

0.6.2-next.26

1 year ago

0.6.2-next.18

1 year ago

0.6.2-next.17

1 year ago

0.6.2-next.19

1 year ago

0.6.2-next.16

1 year ago

0.6.2-next.15

1 year ago

0.6.2-next.14

1 year ago

0.6.2-next.12

1 year ago

0.6.2-next.13

1 year ago

0.6.2-next.10

1 year ago

0.6.2-next.11

1 year ago

0.6.2-next.9

1 year ago

0.6.2-next.8

1 year ago

0.6.2-next.7

1 year ago

0.6.2-next.6

1 year ago

0.6.2-next.5

1 year ago

0.6.2-next.4

1 year ago

0.6.2-next.3

1 year ago

0.6.2-next.2

1 year ago

0.6.2-next.1

1 year ago

0.6.1

1 year ago

0.6.1-next.6

1 year ago

0.6.1-next.7

1 year ago

0.6.1-next.5

1 year ago

0.5.1-next.14

1 year ago

0.5.1-next.12

1 year ago

0.6.0

1 year ago

0.4.1-next.13

1 year ago

0.4.1-next.9

1 year ago

0.4.1-next.8

1 year ago

0.4.1-next.7

1 year ago

0.4.1-next.2

1 year ago

0.5.0

1 year ago

0.4.1-next.12

1 year ago

0.4.1-next.6

1 year ago

0.3.2-next.114

1 year ago

0.4.1-next.5

1 year ago

0.4.1-next.3

1 year ago

0.4.0

1 year ago

0.3.2-next.113

1 year ago

0.3.2-next.111

1 year ago

0.3.2-next.112

1 year ago

0.3.2-next.110

1 year ago

0.3.2-next.108

1 year ago

0.3.2-next.109

1 year ago

0.3.2-next.107

1 year ago

0.3.2-next.105

1 year ago

0.3.2-next.106

1 year ago

0.3.2-next.104

1 year ago

0.3.2-next.103

1 year ago

0.3.2-next.102

1 year ago

0.3.2-next.99

1 year ago

0.3.2-next.100

1 year ago

0.3.2-next.101

1 year ago

0.3.2-next.98

1 year ago

0.3.2-next.97

1 year ago

0.3.2-next.96

1 year ago

0.3.2-next.95

1 year ago

0.3.2-next.94

1 year ago