forked from openwallet-foundation-labs/sd-jwt-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add README.md for each packages (openwallet-foundation-labs#102)
Signed-off-by: Lukas <[email protected]> Signed-off-by: Lukas.J.Han <[email protected]> Signed-off-by: Mirko Mollik <[email protected]>
- Loading branch information
Showing
18 changed files
with
398 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
![Coverage](https://img.shields.io/badge/coverage-93%25-green) | ||
![Coverage](https://img.shields.io/codecov/c/github/openwallet-foundation-labs/sd-jwt-js) | ||
![License](https://img.shields.io/github/license/openwallet-foundation-labs/sd-jwt-js.svg) | ||
![NPM](https://img.shields.io/npm/v/%40hopae%2Fsd-jwt) | ||
![NPM](https://img.shields.io/npm/v/%40sd-jwt%2Fcore) | ||
![Release](https://img.shields.io/github/v/release/openwallet-foundation-labs/sd-jwt-js) | ||
![Stars](https://img.shields.io/github/stars/openwallet-foundation-labs/sd-jwt-js) | ||
|
||
|
@@ -38,63 +38,24 @@ By adhering to these design principles, "Selective Disclosure for JWT" aims to s | |
|
||
# How to use | ||
|
||
## Installation | ||
## Packages | ||
|
||
To install this project, run the following command: | ||
- **[@sd-jwt/core](./packages/core/README.md)**: Core library for selective disclosure JWTs | ||
- **[@sd-jwt/decode](./packages/decode/README.md)**: Decode SD JWT into objects | ||
- **[@sd-jwt/present](./packages/present/README.md)**: Present SD JWT | ||
- **[@sd-jwt/utils](./packages/utils/README.md)**: Utility functions for SD JWT | ||
- **[@sd-jwt/types](./packages/types/README.md)**: Types for SD JWT | ||
- **[@sd-jwt/hash](./packages/hash/README.md)**: SHA-256 support for SD JWT | ||
- **[@sd-jwt/crypto-nodejs](./packages/node-crypto/README.md)**: Nodejs Crypto support for SD JWT | ||
- **[@sd-jwt/crypto-browser](./packages/browser-crypto/README.md)**: Browser Crypto support for SD JWT | ||
|
||
```bash | ||
npm install @hopae/sd-jwt | ||
``` | ||
|
||
Ensure you have Node.js installed as a prerequisite. | ||
|
||
## Usage | ||
|
||
Here's a basic example of how to use this library: | ||
|
||
```jsx | ||
import sdjwt, { DisclosureFrame } from '@hopae/sd-jwt'; | ||
|
||
// 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'], | ||
}; | ||
## Version | ||
|
||
// Issuer issues a signed JWT credential with the specified claims and disclosure frame | ||
// returns an encoded JWT | ||
const credential = await sdjwt.issue(claims, privateKey, disclosureFrame); | ||
We keep all the versions of our packages in sync. | ||
|
||
// Holder may validate the credential from the issuer | ||
const valid = await sdjwt.validate(credential, publicKey); | ||
It means for example, that if you are using `@sd-jwt/[email protected]`, you should use `@sd-jwt/[email protected]`, `@sd-jwt/[email protected]` and so on. | ||
|
||
// 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, publicKey); | ||
``` | ||
|
||
Check out more details in our [documentation](https://github.com/openwallet-foundation-labs/sd-jwt-js/wiki) or [examples](./examples/) | ||
|
||
## Dependencies | ||
|
||
- "@noble/hashes": "1.0.0", | ||
- pure js hash algorithm implementation with security audit (v1.0.0) | ||
- "js-base64": "^3.7.6" | ||
- pure js base64 implementation | ||
# Development | ||
|
||
## Build | ||
|
||
|
@@ -111,15 +72,13 @@ pnpm run build | |
To run the test suite, execute: | ||
|
||
```bash | ||
# Unit tests | ||
pnpm test | ||
|
||
# E2E tests | ||
pnpm test:e2e | ||
``` | ||
|
||
We use [Vitest](https://vitest.dev/) for our testing framework. Ensure you have written tests for all new features. | ||
|
||
We also use [CodeCov](https://app.codecov.io/gh/openwallet-foundation-labs/sd-jwt-js) for our testing coverage. You can check the details of coverage of each package | ||
|
||
## Security | ||
|
||
- [x] [Mandatory Signing of the Issuer-signed JWT](https://www.ietf.org/archive/id/draft-ietf-oauth-selective-disclosure-jwt-06.html#name-mandatory-signing-of-the-is) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
![License](https://img.shields.io/github/license/openwallet-foundation-labs/sd-jwt-js.svg) | ||
![NPM](https://img.shields.io/npm/v/%40sd-jwt%2Fcrypto-browser) | ||
![Release](https://img.shields.io/github/v/release/openwallet-foundation-labs/sd-jwt-js) | ||
![Stars](https://img.shields.io/github/stars/openwallet-foundation-labs/sd-jwt-js) | ||
|
||
# SD-JWT Implementation in JavaScript (TypeScript) | ||
|
||
## SD-JWT Browser Crypto | ||
|
||
### About | ||
|
||
Browser Crypto support for SD JWT | ||
|
||
Check the detail description in our github [repo](https://github.com/openwallet-foundation-labs/sd-jwt-js). | ||
|
||
### Installation | ||
|
||
To install this project, run the following command: | ||
|
||
```bash | ||
# using npm | ||
npm install @sd-jwt/crypto-browser | ||
|
||
# using yarn | ||
yarn add @sd-jwt/crypto-browser | ||
|
||
# using pnpm | ||
pnpm install @sd-jwt/crypto-browser | ||
``` | ||
|
||
Ensure you have Node.js installed as a prerequisite. | ||
|
||
### Usage | ||
|
||
Check out more details in our [documentation](https://github.com/openwallet-foundation-labs/sd-jwt-js/tree/next/docs) or [examples](https://github.com/openwallet-foundation-labs/sd-jwt-js/tree/next/examples) | ||
|
||
### Dependencies | ||
|
||
None |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
![License](https://img.shields.io/github/license/openwallet-foundation-labs/sd-jwt-js.svg) | ||
![NPM](https://img.shields.io/npm/v/%40sd-jwt%2Fcore) | ||
![Release](https://img.shields.io/github/v/release/openwallet-foundation-labs/sd-jwt-js) | ||
![Stars](https://img.shields.io/github/stars/openwallet-foundation-labs/sd-jwt-js) | ||
|
||
# SD-JWT Implementation in JavaScript (TypeScript) | ||
|
||
## SD-JWT Core | ||
|
||
### About | ||
|
||
Core library for selective disclosure JWTs | ||
|
||
Check the detail description in our github [repo](https://github.com/openwallet-foundation-labs/sd-jwt-js). | ||
|
||
### Installation | ||
|
||
To install this project, run the following command: | ||
|
||
```bash | ||
# using npm | ||
npm install @sd-jwt/core | ||
|
||
# using yarn | ||
yarn add @sd-jwt/core | ||
|
||
# using pnpm | ||
pnpm install @sd-jwt/core | ||
``` | ||
|
||
Ensure you have Node.js installed as a prerequisite. | ||
|
||
### Usage | ||
|
||
Here's a basic example of how to use this library: | ||
|
||
```jsx | ||
import { DisclosureFrame } from '@sd-jwt/core'; | ||
|
||
// 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(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](https://github.com/openwallet-foundation-labs/sd-jwt-js/tree/next/docs) or [examples](https://github.com/openwallet-foundation-labs/sd-jwt-js/tree/next/examples) | ||
|
||
### Dependencies | ||
|
||
- @sd-jwt/decode | ||
- @sd-jwt/types | ||
- @sd-jwt/utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
![License](https://img.shields.io/github/license/openwallet-foundation-labs/sd-jwt-js.svg) | ||
![NPM](https://img.shields.io/npm/v/%40sd-jwt%2Fdecode) | ||
![Release](https://img.shields.io/github/v/release/openwallet-foundation-labs/sd-jwt-js) | ||
![Stars](https://img.shields.io/github/stars/openwallet-foundation-labs/sd-jwt-js) | ||
|
||
# SD-JWT Implementation in JavaScript (TypeScript) | ||
|
||
## SD-JWT Decode | ||
|
||
### About | ||
|
||
Decode SD JWT into objects | ||
|
||
Check the detail description in our github [repo](https://github.com/openwallet-foundation-labs/sd-jwt-js). | ||
|
||
### Installation | ||
|
||
To install this project, run the following command: | ||
|
||
```bash | ||
# using npm | ||
npm install @sd-jwt/decode | ||
|
||
# using yarn | ||
yarn add @sd-jwt/decode | ||
|
||
# using pnpm | ||
pnpm install @sd-jwt/decode | ||
``` | ||
|
||
Ensure you have Node.js installed as a prerequisite. | ||
|
||
### Usage | ||
|
||
Check out more details in our [documentation](https://github.com/openwallet-foundation-labs/sd-jwt-js/tree/next/docs) or [examples](https://github.com/openwallet-foundation-labs/sd-jwt-js/tree/next/examples) | ||
|
||
### Dependencies | ||
|
||
- @sd-jwt/types | ||
- @sd-jwt/utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
![License](https://img.shields.io/github/license/openwallet-foundation-labs/sd-jwt-js.svg) | ||
![NPM](https://img.shields.io/npm/v/%40sd-jwt%2Fhash) | ||
![Release](https://img.shields.io/github/v/release/openwallet-foundation-labs/sd-jwt-js) | ||
![Stars](https://img.shields.io/github/stars/openwallet-foundation-labs/sd-jwt-js) | ||
|
||
# SD-JWT Implementation in JavaScript (TypeScript) | ||
|
||
## SD-JWT Hash | ||
|
||
### About | ||
|
||
SHA-256 support for SD JWT | ||
|
||
Check the detail description in our github [repo](https://github.com/openwallet-foundation-labs/sd-jwt-js). | ||
|
||
### Installation | ||
|
||
To install this project, run the following command: | ||
|
||
```bash | ||
# using npm | ||
npm install @sd-jwt/hash | ||
|
||
# using yarn | ||
yarn add @sd-jwt/hash | ||
|
||
# using pnpm | ||
pnpm install @sd-jwt/hash | ||
``` | ||
|
||
Ensure you have Node.js installed as a prerequisite. | ||
|
||
### Usage | ||
|
||
Check out more details in our [documentation](https://github.com/openwallet-foundation-labs/sd-jwt-js/tree/next/docs) or [examples](https://github.com/openwallet-foundation-labs/sd-jwt-js/tree/next/examples) | ||
|
||
### Dependencies | ||
|
||
- "@noble/hashes": "1.0.0", | ||
- pure js hash algorithm implementation with security audit (v1.0.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
![License](https://img.shields.io/github/license/openwallet-foundation-labs/sd-jwt-js.svg) | ||
![NPM](https://img.shields.io/npm/v/%40sd-jwt%2Fcrypto-nodejs) | ||
![Release](https://img.shields.io/github/v/release/openwallet-foundation-labs/sd-jwt-js) | ||
![Stars](https://img.shields.io/github/stars/openwallet-foundation-labs/sd-jwt-js) | ||
|
||
# SD-JWT Implementation in JavaScript (TypeScript) | ||
|
||
## SD-JWT Nodejs Crypto | ||
|
||
### About | ||
|
||
Nodejs Crypto support for SD JWT | ||
|
||
Check the detail description in our github [repo](https://github.com/openwallet-foundation-labs/sd-jwt-js). | ||
|
||
### Installation | ||
|
||
To install this project, run the following command: | ||
|
||
```bash | ||
# using npm | ||
npm install @sd-jwt/crypto-nodejs | ||
|
||
# using yarn | ||
yarn add @sd-jwt/crypto-nodejs | ||
|
||
# using pnpm | ||
pnpm install @sd-jwt/crypto-nodejs | ||
``` | ||
|
||
Ensure you have Node.js installed as a prerequisite. | ||
|
||
### Usage | ||
|
||
Check out more details in our [documentation](https://github.com/openwallet-foundation-labs/sd-jwt-js/tree/next/docs) or [examples](https://github.com/openwallet-foundation-labs/sd-jwt-js/tree/next/examples) | ||
|
||
### Dependencies | ||
|
||
None |
Oops, something went wrong.