Skip to content

Commit

Permalink
Update createSuites to take optional algorithm param.
Browse files Browse the repository at this point in the history
  • Loading branch information
JSAssassin committed Nov 2, 2023
1 parent b26d208 commit 9b8927d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/suites.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const SUPPORTED_LEGACY_SUITES = new Map([
['Ed25519Signature2020', Ed25519Signature2020]
]);

export function createSuites({ecdsaKeyTypes} = {}) {
export function createSuites({algorithm} = {}) {
const cfg = bedrock.config['vc-verifier'];
const {supportedSuites} = cfg;
const suites = [];
Expand All @@ -36,11 +36,11 @@ export function createSuites({ecdsaKeyTypes} = {}) {
const cryptosuite = SUPPORTED_CRYPTOSUITES.get(supportedSuite);
if(cryptosuite) {
if(supportedSuite === 'ecdsa-2019') {
for(const ecdsaKeyType of ecdsaKeyTypes) {
const suiteConfig = {...cryptosuite};
suiteConfig.requiredAlgorithm = ecdsaKeyType;
suites.push(new DataIntegrityProof({cryptosuite: suiteConfig}));
const suiteConfig = {...cryptosuite};
if(algorithm) {
suiteConfig.requiredAlgorithm = algorithm;
}
suites.push(new DataIntegrityProof({cryptosuite: suiteConfig}));
} else {
suites.push(new DataIntegrityProof({cryptosuite}));
}
Expand Down

0 comments on commit 9b8927d

Please sign in to comment.