Skip to content

Commit

Permalink
Merge branch 'openwallet-foundation:main' into feat/serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
cre8 authored Nov 12, 2024
2 parents 797fd32 + a1474fd commit 3a8def6
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 44 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ Hopae, a founding member of OpenWallet Foundation, is building wallet module in

Currently compliant with:

- **[draft-ietf-oauth-selective-disclosure-jwt-08](https://datatracker.ietf.org/doc/draft-ietf-oauth-selective-disclosure-jwt/)**
- **[draft-ietf-oauth-sd-jwt-vc-03](https://datatracker.ietf.org/doc/draft-ietf-oauth-sd-jwt-vc/)**
- **[draft-ietf-oauth-selective-disclosure-jwt-13](https://datatracker.ietf.org/doc/draft-ietf-oauth-selective-disclosure-jwt/)**
- **[draft-ietf-oauth-sd-jwt-vc-05](https://datatracker.ietf.org/doc/draft-ietf-oauth-sd-jwt-vc/)**
- **[draft-ietf-oauth-status-list-05](https://datatracker.ietf.org/doc/draft-ietf-oauth-status-list/)**

## **Background**

Expand Down Expand Up @@ -53,6 +54,7 @@ By adhering to these design principles, "Selective Disclosure for JWT" aims to s
- **[@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
- **[@sd-jwt/jwt-status-list](./packages/jwt-status-list/README.md)**: Token Status List

## Online Debugging Tool

Expand Down
5 changes: 3 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ <h2 class="text-2xl font-bold mb-4">What is SD-JWT VC?</h2>
<h2 class="text-2xl font-bold mb-4">Specification Compliance</h2>
<div class="mb-4">
<ul class="list-disc pl-5 space-y-2">
<li>SD-JWT: <a href="https://datatracker.ietf.org/doc/draft-ietf-oauth-selective-disclosure-jwt" target="_blank"><b>draft-ietf-oauth-selective-disclosure-jwt-08</b></a></li>
<li>SD-JWT VC: <a href="https://datatracker.ietf.org/doc/draft-ietf-oauth-sd-jwt-vc/" target="_blank"><b>draft-ietf-oauth-sd-jwt-vc-03</b></a></li>
<li>SD-JWT: <a href="https://datatracker.ietf.org/doc/draft-ietf-oauth-selective-disclosure-jwt" target="_blank"><b>draft-ietf-oauth-selective-disclosure-jwt-13</b></a></li>
<li>SD-JWT VC: <a href="https://datatracker.ietf.org/doc/draft-ietf-oauth-sd-jwt-vc/" target="_blank"><b>draft-ietf-oauth-sd-jwt-vc-05</b></a></li>
<li>Token Status List: <a href="https://datatracker.ietf.org/doc/draft-ietf-oauth-status-list/" target="_blank"><b>draft-ietf-oauth-status-list-05</b></a></li>
</ul>
</div>
<h2 class="text-2xl font-bold mb-4">Installation</h2>
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-example/all.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, generateSalt, ES256 } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down Expand Up @@ -103,6 +103,6 @@ import { createSignerVerifier, digest, generateSalt } from './utils';

// Verify the presentation using the public key and the required claims
// return a boolean result
const verified = await sdjwt.verify(credential, requiredClaims);
const verified = await sdjwt.verify(presentation, requiredClaims);
console.log('verified:', verified);
})();
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/basic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/custom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/custom_header.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/decode.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { SDJwtInstance } from '@sd-jwt/core';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/decoy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-example/kb.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
kbSigner: signer,
kbSignAlg: 'EdDSA',
kbSignAlg: ES256.alg,
kbVerifier: verifier,
});
const claims = {
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-example/sdjwtobject.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
kbSigner: signer,
kbSignAlg: 'EdDSA',
kbSignAlg: ES256.alg,
kbVerifier: verifier,
});
// Issuer Define the claims object with the user's information
Expand Down
2 changes: 1 addition & 1 deletion examples/sd-jwt-example/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ES256, digest, generateSalt } from '@sd-jwt/crypto-nodejs';
export { digest, generateSalt };
export { digest, generateSalt, ES256 };

export const createSignerVerifier = async () => {
const { privateKey, publicKey } = await ES256.generateKeyPair();
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-vc-example/all.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtVcInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-vc-example/basic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtVcInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-vc-example/custom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtVcInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-vc-example/custom_header.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtVcInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-vc-example/decode.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtVcInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
kbSigner: signer,
kbSignAlg: 'EdDSA',
kbSignAlg: ES256.alg,
kbVerifier: verifier,
});

Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-vc-example/decoy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtVcInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-vc-example/kb.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtVcInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
kbSigner: signer,
kbSignAlg: 'EdDSA',
kbSignAlg: ES256.alg,
kbVerifier: verifier,
});
const claims = {
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-vc-example/sdjwtobject.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtVcInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
kbSigner: signer,
kbSignAlg: 'EdDSA',
kbSignAlg: ES256.alg,
kbVerifier: verifier,
});
// Issuer Define the claims object with the user's information
Expand Down
2 changes: 1 addition & 1 deletion examples/sd-jwt-vc-example/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ES256, digest, generateSalt } from '@sd-jwt/crypto-nodejs';
export { digest, generateSalt };
export { digest, generateSalt, ES256 };

export const createSignerVerifier = async () => {
const { privateKey, publicKey } = await ES256.generateKeyPair();
Expand Down

0 comments on commit 3a8def6

Please sign in to comment.