Skip to content

Commit

Permalink
Use @digitalbazaar/data-integrity with legacyContext flag for
Browse files Browse the repository at this point in the history
legacy `ecdsa-2019` and `eddsa-2022` cryptosuites.
  • Loading branch information
JSAssassin committed Nov 11, 2023
1 parent f1b018f commit 18e7dc7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions lib/suites.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ import {

// DataIntegrityProof should work for multiple cryptosuites
const SUPPORTED_CRYPTOSUITES = new Map([
['ecdsa-2019', ecdsa2019CryptoSuite],
['eddsa-2022', eddsa2022CryptoSuite],
['ecdsa-rdfc-2019', ecdsaRdfc2019CryptoSuite],
['eddsa-rdfc-2022', eddsaRdfc2022CryptoSuite],
['ecdsa-sd-2023', createEcdsaSd2023VerifyCryptosuite()]
]);

const SUPPORTED_LEGACY_CRYPTOSUITES = new Map([
['ecdsa-2019', ecdsa2019CryptoSuite],
['eddsa-2022', eddsa2022CryptoSuite],
]);

const SUPPORTED_LEGACY_SUITES = new Map([
['Ed25519Signature2018', Ed25519Signature2018],
['Ed25519Signature2020', Ed25519Signature2020]
Expand All @@ -43,6 +46,12 @@ export function createSuites() {
if(LegacySuite) {
return new LegacySuite();
}
const LegacyCryptosuite = SUPPORTED_LEGACY_CRYPTOSUITES.get(supportedSuite);
if(LegacyCryptosuite) {
return new DataIntegrityProof({
cryptosuite: LegacyCryptosuite, legacyContext: true
});
}
const cryptosuite = SUPPORTED_CRYPTOSUITES.get(supportedSuite);
if(cryptosuite) {
return new DataIntegrityProof({cryptosuite});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"homepage": "https://github.com/digitalbazaar/bedrock-vc-verifier",
"dependencies": {
"@digitalbazaar/data-integrity": "digitalbazaar/data-integrity#update-context",
"@digitalbazaar/data-integrity": "digitalbazaar/data-integrity#add-legacy-context-support",
"@digitalbazaar/ecdsa-rdfc-2019-cryptosuite": "digitalbazaar/ecdsa-rdfc-2019-cryptosuite#update-name-and-tests",
"@digitalbazaar/ecdsa-sd-2023-cryptosuite": "digitalbazaar/ecdsa-sd-2023-cryptosuite#use-context-v2",
"@digitalbazaar/eddsa-rdfc-2022-cryptosuite": "digitalbazaar/eddsa-rdfc-2022-cryptosuite#update-name-and-test",
Expand Down

0 comments on commit 18e7dc7

Please sign in to comment.