Skip to content

Commit

Permalink
Fixes and updates.
Browse files Browse the repository at this point in the history
- Use P-256 for VC and P-384 for VP for variety.
- Add P-384 support to did:web driver.
- Use 'authentication' method from VP did:web document.
  • Loading branch information
davidlehn committed Aug 14, 2024
1 parent 62c6081 commit 6362466
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions examples/rt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*/

// Example round trip.
// - generate example ECDSA did:key for VC
// - generate example ECDSA P-256 did:key for VC
// - setup 'ecdsa-rdfc-2019 DataIntegrityProof
// - setup document loader including did:key and did:web resolvers
// - sign credential with did:key
// - verify credential
// - generate example ECDSA did:web doc for VP
// - generate example ECDSA P-384 did:web doc for VP
// - create presentation
// - sign presentation with did:web
// - verify presentation
Expand Down Expand Up @@ -55,13 +55,21 @@ didKeyDriverMultikey.use({
multibaseMultikeyHeader: 'zDna',
fromMultibase: EcdsaMultikey.from
});
//didWebDriver.use({
// name: 'Ed25519',
// handler: Ed25519VerificationKey2020,
// multibaseMultikeyHeader: 'z6Mk',
// fromMultibase: Ed25519VerificationKey2020.from
//});
// P-256
didWebDriver.use({
multibaseMultikeyHeader: 'zDna',
fromMultibase: EcdsaMultikey.from
//name: 'Ed25519',
//handler: Ed25519VerificationKey2020,
//multibaseMultikeyHeader: 'z6Mk',
//fromMultibase: Ed25519VerificationKey2020.from
});
// P-384
didWebDriver.use({
multibaseMultikeyHeader: 'z82L',
fromMultibase: EcdsaMultikey.from
});
resolver.use(didKeyDriverMultikey);
resolver.use(didWebDriver);
Expand All @@ -73,7 +81,7 @@ async function main({credential, documentLoader}) {
console.log('CREDENTIAL:');
console.log(JSON.stringify(credential, null, 2));

// generate example ecdsa keypair for VC
// generate example keypair for VC signer
const vcEcdsaKeyPair = await EcdsaMultikey.generate({curve: 'P-256'});

const {
Expand Down Expand Up @@ -128,15 +136,15 @@ async function main({credential, documentLoader}) {
const VP_DID_URL = 'https://example.org/issuer/123';
//const VP_DID_DOC_URL = VP_DID_URL + '/did.json';

// generate example ed25519 keypair for VP signer
const vpEcdsaKeyPair = await EcdsaMultikey.generate({curve: 'P-256'});
// generate example keypair for VP signer
const vpEcdsaKeyPair = await EcdsaMultikey.generate({curve: 'P-384'});
const {
didDocument: vpDidDocument, methodFor: vpMethodFor
} = await didWebDriver.fromKeyPair({
url: VP_DID_URL,
verificationKeyPair: vpEcdsaKeyPair
});
const didWebKey = vpMethodFor({purpose: 'assertionMethod'});
const didWebKey = vpMethodFor({purpose: 'authentication'});
vpEcdsaKeyPair.id = didWebKey.id;
vpEcdsaKeyPair.controller = vpDidDocument.id;
// setup VP ecdsa-rdfc-2019 signing suite
Expand Down

0 comments on commit 6362466

Please sign in to comment.