Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W3C VCDM CR 1 #5

Merged
merged 58 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
0a46102
wip
OR13 Feb 2, 2024
64f8a03
wip
OR13 Feb 2, 2024
a506c0d
cleaning
OR13 Feb 2, 2024
02d8263
cleaning
OR13 Feb 2, 2024
23e0f31
wip
OR13 Feb 2, 2024
492a1e1
wip
OR13 Feb 3, 2024
9612f32
wip
OR13 Feb 3, 2024
bb9c6e8
wip
OR13 Feb 3, 2024
ca00fcb
factoring
OR13 Feb 3, 2024
6eff122
factoring
OR13 Feb 3, 2024
05dd673
cleaning
OR13 Feb 3, 2024
4a32eea
prep
OR13 Feb 3, 2024
55fcfc7
factoring
OR13 Feb 3, 2024
3f23c4a
wip
OR13 Feb 3, 2024
bec580c
wip
OR13 Feb 3, 2024
8c0dfc5
factoring
OR13 Feb 3, 2024
5585d6d
add sanity
OR13 Feb 3, 2024
a96e2eb
tweaks
OR13 Feb 3, 2024
657296e
tests
OR13 Feb 3, 2024
4ba6ac3
tests
OR13 Feb 3, 2024
35f6a4a
wip
OR13 Feb 3, 2024
98f61d7
prep for multiple disclosure presentations
OR13 Feb 3, 2024
8885129
gross
OR13 Feb 3, 2024
2138d7e
begin key binding
OR13 Feb 3, 2024
e7fff53
tests
OR13 Feb 3, 2024
c30d117
prepare resolver refactor
OR13 Feb 3, 2024
54a23bd
resolver
OR13 Feb 3, 2024
0b048fa
readme
OR13 Feb 3, 2024
d355a2a
add todos
OR13 Feb 3, 2024
02a1042
add more todos
OR13 Feb 3, 2024
c3ac78a
more notes
OR13 Feb 3, 2024
aa675c6
more todos
OR13 Feb 3, 2024
e9be764
todo
OR13 Feb 3, 2024
ca760e1
add sanity test
OR13 Feb 4, 2024
3a8023a
cleaning
OR13 Feb 4, 2024
3d19d3d
prepare to replace top level apis with signers
OR13 Feb 4, 2024
239da02
wip
OR13 Feb 4, 2024
50b75b5
tests
OR13 Feb 5, 2024
aa78399
tests
OR13 Feb 5, 2024
6838479
revert alg change, cannot remove yet
OR13 Feb 5, 2024
8cf66a3
remove aud
OR13 Feb 5, 2024
9a7d80d
cleaning
OR13 Feb 5, 2024
82d88bb
cleaning
OR13 Feb 5, 2024
ea6f482
cleaning
OR13 Feb 5, 2024
7b75dd6
add cose
OR13 Feb 5, 2024
89694c4
broken interfaces for unsecured presentations
OR13 Feb 5, 2024
cfcaad2
tests
OR13 Feb 5, 2024
6fbf247
factoring
OR13 Feb 5, 2024
539f8e7
fix aud / nonce bug
OR13 Feb 5, 2024
de7cc9e
renaming
OR13 Feb 5, 2024
3ff88b2
cleaning
OR13 Feb 5, 2024
71b8a95
add status list sanity
OR13 Feb 5, 2024
22e2dcc
add schema validator
OR13 Feb 5, 2024
43832e8
add a status test
OR13 Feb 5, 2024
f05a15c
most validation tests
OR13 Feb 6, 2024
7e18013
tests
OR13 Feb 6, 2024
48669d3
add initial tests
OR13 Feb 6, 2024
2067b9a
remove attic
OR13 Feb 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 13 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,96 +15,30 @@

🚧 Experimental implementation of Verifiable Credentials Data Model v2.0 🔥

## Usage

```sh
npm i @transmute/verifiable-credentials@latest --save
```
- [CR-vc-data-model-2.0-20240201](https://www.w3.org/TR/2024/CR-vc-data-model-2.0-20240201/)
- [WD-vc-jose-cose-20240126](https://www.w3.org/TR/2024/WD-vc-jose-cose-20240126/)
- [WD-vc-bitstring-status-list-20240107](https://www.w3.org/TR/2024/WD-vc-bitstring-status-list-20240107/)

```ts
import transmute from '@transmute/verifiable-credentials'
```
- [CG-ED-traceability-vocab](https://w3c-ccg.github.io/traceability-vocab/)

This library relies on [transmute-industries/vc-jwt-sd](https://github.com/transmute-industries/vc-jwt-sd)
to support the [Verifiable Credentials Data Model v2.0](https://www.w3.org/TR/vc-data-model-2.0/)
## Usage

### Issuance
Requires node 18 or higher.

```ts
const alg = 'ES384'
const nonce = 'nonce-123'
const audience = 'audience-456'
const issuerRole = await transmute.vc.sd.key.generate(alg)
const holderRole = await transmute.vc.sd.key.generate(alg)
const vc = await transmute.vc.sd.issuer({
kid: issuerRole.publicKeyJwk.kid,
secretKeyJwk: issuerRole.secretKeyJwk
})
.issue({
holder: holderRole.publicKeyJwk.kid, // jkt and jwk confirmation are both supported.
claimset: fs.readFileSync('test/vc-data-model-2.0/example1/issuance-claims.yaml').toString()
})
```sh
nvm use 18
```

### Presentation

```ts
const vp = await transmute.vc.sd.holder({
kid: holderRole.publicKeyJwk.kid,
secretKeyJwk: holderRole.secretKeyJwk
})
.issue({
token: vc,
nonce: nonce,
audience: audience,
disclosure: fs.readFileSync('test/vc-data-model-2.0/example1/disclosure-claims.yaml').toString()
})
```sh
npm i @transmute/verifiable-credentials@latest --save
```

### Verification

```ts
const verification = await transmute.vc.sd.verifier({
resolver: {
resolve: async (kid: string) => {
if (kid === issuerRole.publicKeyJwk.kid) {
return issuerRole.publicKeyJwk
}
if (kid === holderRole.publicKeyJwk.kid) {
return holderRole.publicKeyJwk
}
throw new Error('Unsupported kid: ' + kid)
}
}
})
.verify({
token: vp,
audience,
nonce
})
import * as transmute from "@transmute/verifiable-credentials";
```



### Validator

```ts
const validator = await w3c.vc.validator({
issuer: async () => {
// this resolver must return parsed application/jwk+json
return publicKey
},
credentialSchema: async () => {
// this resolver MUST return parsed application/schema+json
return credentialSchema
},
credentialStatus: async () => {
// this resolver MUST return application/vc+ld+sd-jwt
return statusList
}
})
// validate after verify...
const validation = await validator.validate(verified)
// todo...
```

## Develop
Expand All @@ -114,4 +48,4 @@ npm i
npm t
npm run lint
npm run build
```
```
Loading
Loading