-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from scitt-community/feat/w3c-verifiable-creden…
…tials Add w3c verifiable credentials
- Loading branch information
Showing
12 changed files
with
278 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
private-key.cbor |
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,18 @@ | ||
|
||
## W3C Verifiable Credentials | ||
|
||
You will need a CLI that can produce and consume SCITT transparent statements. | ||
This one supports RFC9162 and json, and is 🚧 EXPERIMENTAL 🚧. | ||
|
||
```sh | ||
npm i -g @transmute/cli | ||
``` | ||
|
||
### Make a Transparent W3C Verifiable Credential | ||
|
||
Signs the jsonld, registers it with a test ledger, adds a receipt to the signature, producing a transparent w3c verifiable credential. | ||
|
||
```sh | ||
./script.sh | ||
``` | ||
|
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,20 @@ | ||
{ | ||
"@context": [ | ||
"https://www.w3.org/ns/credentials/v2", | ||
"https://www.w3.org/ns/credentials/examples/v2" | ||
], | ||
"id": "http://university.example/credentials/1872", | ||
"type": [ | ||
"VerifiableCredential", | ||
"ExampleAlumniCredential" | ||
], | ||
"issuer": "https://university.example/issuers/565049", | ||
"validFrom": "2010-01-01T19:23:24Z", | ||
"credentialSubject": { | ||
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21", | ||
"alumniOf": { | ||
"id": "did:example:c276e12ec21ebfeb1f712ebc6f1", | ||
"name": "Example University" | ||
} | ||
} | ||
} |
Binary file not shown.
65 changes: 65 additions & 0 deletions
65
w3c-verifiable-credentials/artifacts/credential.json.cbor.with-transparency.md
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,65 @@ | ||
~~~~ cbor-diag | ||
18( / COSE Sign 1 / | ||
[ | ||
h'a4013822...3a343536', / Protected / | ||
{ / Unprotected / | ||
-333: [ / Receipts (1) / | ||
h'd284584e...6b6f3c77' / Receipt 1 / | ||
] | ||
}, | ||
nil, / Detached payload / | ||
h'09772c7f...5c4e736f' / Signature / | ||
] | ||
) | ||
~~~~ | ||
|
||
~~~~ cbor-diag | ||
{ / Protected / | ||
1: -35, / Algorithm / | ||
3: application/json, / Content type / | ||
4: h'177f12cb...1933d554', / Key identifier / | ||
13: { / CWT Claims / | ||
1: urn:example:123, / Issuer / | ||
2: urn:example:456, / Subject / | ||
}, | ||
} | ||
~~~~ | ||
|
||
~~~~ cbor-diag | ||
18( / COSE Sign 1 / | ||
[ | ||
h'a4013822...3a616263', / Protected / | ||
{ / Unprotected / | ||
-222: { / Proofs / | ||
-1: [ / Inclusion proofs (1) / | ||
h'83010080', / Inclusion proof 1 / | ||
] | ||
}, | ||
}, | ||
nil, / Detached payload / | ||
h'662ced5f...6b6f3c77' / Signature / | ||
] | ||
) | ||
~~~~ | ||
|
||
~~~~ cbor-diag | ||
{ / Protected / | ||
1: -35, / Algorithm / | ||
4: h'177f12cb...1933d554', / Key identifier / | ||
-111: 1, / Verifiable Data Structure / | ||
13: { / CWT Claims / | ||
1: urn:example:789, / Issuer / | ||
2: urn:example:abc, / Subject / | ||
}, | ||
} | ||
~~~~ | ||
|
||
~~~~ cbor-diag | ||
[ / Inclusion proof 1 / | ||
1, / Tree size / | ||
0, / Leaf index / | ||
[ / Inclusion hashes (0) / | ||
] | ||
] | ||
~~~~ |
10 changes: 10 additions & 0 deletions
10
w3c-verifiable-credentials/artifacts/credential.json.issuer.public-key.cbor.md
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,10 @@ | ||
~~~~ cbor-diag | ||
{ / COSE Key / | ||
1: 2, / Type / | ||
2: h'177f12cb...1933d554', / Identifier / | ||
3: -35, / Algorithm / | ||
-1: 2, / Curve / | ||
-2: h'0fbe22a0...3a009118', / x public key component / | ||
-3: h'c9ab6a83...18ca36e2', / y public key component / | ||
} | ||
~~~~ |
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,8 @@ | ||
{ | ||
"name": "scitt-ledger", | ||
"version": "0.0.0", | ||
"leaves": [ | ||
"48f2fe25a4970bd8d7256b6ff52a1f73c2eabced75fbe6ffb9e6c953c6a6b322", | ||
"98ed4cedcbfc8bfda210162d8eaf77d51f8f5f560d9ef840cbc3828debcb12c9" | ||
] | ||
} |
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,29 @@ | ||
{ | ||
"@context": [ | ||
"https://www.w3.org/ns/credentials/v2", | ||
"https://www.w3.org/ns/credentials/examples/v2" | ||
], | ||
"type": "VerifiablePresentation", | ||
"verifiableCredential": [ | ||
{ | ||
"@context": [ | ||
"https://www.w3.org/ns/credentials/v2", | ||
"https://www.w3.org/ns/credentials/examples/v2" | ||
], | ||
"id": "http://university.example/credentials/1872", | ||
"type": [ | ||
"VerifiableCredential", | ||
"ExampleAlumniCredential" | ||
], | ||
"issuer": "https://university.example/issuers/565049", | ||
"validFrom": "2010-01-01T19:23:24Z", | ||
"credentialSubject": { | ||
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21", | ||
"alumniOf": { | ||
"id": "did:example:c276e12ec21ebfeb1f712ebc6f1", | ||
"name": "Example University" | ||
} | ||
} | ||
} | ||
] | ||
} |
Binary file not shown.
65 changes: 65 additions & 0 deletions
65
w3c-verifiable-credentials/artifacts/presentation.json.cbor.with-transparency.md
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,65 @@ | ||
~~~~ cbor-diag | ||
18( / COSE Sign 1 / | ||
[ | ||
h'a4013822...3a343536', / Protected / | ||
{ / Unprotected / | ||
-333: [ / Receipts (1) / | ||
h'd284584e...4c60d1a3' / Receipt 1 / | ||
] | ||
}, | ||
nil, / Detached payload / | ||
h'69c81123...c1db08cf' / Signature / | ||
] | ||
) | ||
~~~~ | ||
|
||
~~~~ cbor-diag | ||
{ / Protected / | ||
1: -35, / Algorithm / | ||
3: application/json, / Content type / | ||
4: h'177f12cb...1933d554', / Key identifier / | ||
13: { / CWT Claims / | ||
1: urn:example:123, / Issuer / | ||
2: urn:example:456, / Subject / | ||
}, | ||
} | ||
~~~~ | ||
|
||
~~~~ cbor-diag | ||
18( / COSE Sign 1 / | ||
[ | ||
h'a4013822...3a616263', / Protected / | ||
{ / Unprotected / | ||
-222: { / Proofs / | ||
-1: [ / Inclusion proofs (1) / | ||
h'83020181...c6a6b322', / Inclusion proof 1 / | ||
] | ||
}, | ||
}, | ||
nil, / Detached payload / | ||
h'5aef3c97...4c60d1a3' / Signature / | ||
] | ||
) | ||
~~~~ | ||
|
||
~~~~ cbor-diag | ||
{ / Protected / | ||
1: -35, / Algorithm / | ||
4: h'177f12cb...1933d554', / Key identifier / | ||
-111: 1, / Verifiable Data Structure / | ||
13: { / CWT Claims / | ||
1: urn:example:789, / Issuer / | ||
2: urn:example:abc, / Subject / | ||
}, | ||
} | ||
~~~~ | ||
|
||
~~~~ cbor-diag | ||
[ / Inclusion proof 1 / | ||
2, / Tree size / | ||
1, / Leaf index / | ||
[ / Inclusion hashes (1) / | ||
h'48f2fe25...c6a6b322' / Intermediate hash 1 / | ||
] | ||
] | ||
~~~~ |
Binary file not shown.
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,62 @@ | ||
|
||
|
||
transmute scitt key generate \ | ||
--alg -35 \ | ||
--output private-key.cbor | ||
|
||
transmute scitt key export \ | ||
--input private-key.cbor \ | ||
--output public-key.cbor | ||
|
||
transmute scitt key diagnose \ | ||
--input public-key.cbor \ | ||
--output artifacts/credential.json.issuer.public-key.cbor.md | ||
|
||
transmute scitt statement issue \ | ||
--iss urn:example:123 \ | ||
--sub urn:example:456 \ | ||
--issuer-key private-key.cbor \ | ||
--statement artifacts/credential.json \ | ||
--signed-statement artifacts/credential.json.cbor | ||
|
||
transmute scitt statement issue \ | ||
--iss urn:example:123 \ | ||
--sub urn:example:456 \ | ||
--issuer-key private-key.cbor \ | ||
--statement artifacts/presentation.json \ | ||
--signed-statement artifacts/presentation.json.cbor | ||
|
||
transmute scitt statement verify \ | ||
--issuer-key public-key.cbor \ | ||
--statement artifacts/credential.json \ | ||
--signed-statement artifacts/credential.json.cbor \ | ||
|
||
transmute scitt ledger receipt issue \ | ||
--iss urn:example:789 \ | ||
--sub urn:example:abc \ | ||
--issuer-key private-key.cbor \ | ||
--signed-statement artifacts/credential.json.cbor \ | ||
--transparent-statement artifacts/credential.json.cbor \ | ||
--ledger artifacts/ledger.json | ||
|
||
transmute scitt ledger receipt issue \ | ||
--iss urn:example:789 \ | ||
--sub urn:example:abc \ | ||
--issuer-key private-key.cbor \ | ||
--signed-statement artifacts/presentation.json.cbor \ | ||
--transparent-statement artifacts/presentation.json.cbor \ | ||
--ledger artifacts/ledger.json | ||
|
||
transmute scitt transparent statement verify \ | ||
--issuer-key public-key.cbor \ | ||
--transparency-service-key public-key.cbor \ | ||
--statement artifacts/credential.json \ | ||
--transparent-statement artifacts/credential.json.cbor | ||
|
||
transmute scitt statement diagnose \ | ||
--input artifacts/credential.json.cbor \ | ||
--output artifacts/credential.json.cbor.with-transparency.md | ||
|
||
transmute scitt statement diagnose \ | ||
--input artifacts/presentation.json.cbor \ | ||
--output artifacts/presentation.json.cbor.with-transparency.md |