Skip to content

Commit

Permalink
add dedicated Ed25519Signature2018 support
Browse files Browse the repository at this point in the history
Signed-off-by: F-Node-Karlsruhe <[email protected]>
  • Loading branch information
F-Node-Karlsruhe committed Jun 5, 2023
1 parent 1f29834 commit 4b3b930
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ VC Verifier Changelog
WIP
---

- use hash of proof as COM identifier
- support Ed25519Signature2018 crypto suite

1.5.1 (2023-06-01)
---
Expand Down
76 changes: 76 additions & 0 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@digitalbazaar/data-integrity": "^1.4.0",
"@digitalbazaar/did-method-key": "^3.0.0",
"@digitalbazaar/ecdsa-sd-2023-cryptosuite": "^1.0.2",
"@digitalbazaar/ed25519-signature-2018": "^4.0.0",
"@digitalbazaar/ed25519-signature-2020": "^5.0.0",
"@digitalbazaar/vc": "^5.0.0",
"@digitalbazaar/vc-revocation-list": "^5.0.0",
Expand Down
18 changes: 12 additions & 6 deletions api/src/services/verifier/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// @ts-ignore
import { verifyCredential, verify } from '@digitalbazaar/vc';
// @ts-ignore
import { Ed25519Signature2018 } from '@digitalbazaar/ed25519-signature-2018';
// @ts-ignore
import { Ed25519Signature2020 } from '@digitalbazaar/ed25519-signature-2020';
// @ts-ignore
import { checkStatus } from '@digitalbazaar/vc-revocation-list';
Expand All @@ -18,14 +20,18 @@ const { purposes: { AssertionProofPurpose } } = jsigs;

function getSuite(proof: Proof): unknown[] {

// Ed25519Signature2020 is backwards compatible to Ed25519Signature2018
if (['Ed25519Signature2020', 'Ed25519Signature2018'].includes(proof.type)) return new Ed25519Signature2020();
switch (proof.type) {

case 'Ed25519Signature2018': return new Ed25519Signature2018();

if (proof.type == 'DataIntegrityProof') return new DataIntegrityProof({
cryptosuite: createVerifyCryptosuite()
});
case 'Ed25519Signature2020': return new Ed25519Signature2020();

throw new Error(`${proof.type} not implemented`);
case 'DataIntegrityProof': return new DataIntegrityProof({
cryptosuite: createVerifyCryptosuite()
});

default: throw new Error(`${proof.type} not implemented`);
}

}

Expand Down

0 comments on commit 4b3b930

Please sign in to comment.