Skip to content

Commit

Permalink
Pass cryptosuite & key to di verify tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Jun 6, 2024
1 parent 2343277 commit cd08568
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 6 additions & 0 deletions tests/15-di-rdfc-verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import {
checkDataIntegrityProofVerifyErrors
} from 'data-integrity-test-suite-assertion';
import {config} from './helpers.js';
import {
cryptosuite as eddsaRdfc2022CryptoSuite
} from '@digitalbazaar/eddsa-rdfc-2022-cryptosuite';
import {endpoints} from 'vc-test-suite-implementations';
import {getMultikey} from './vc-generator/helpers.js';

// only use implementations with `eddsa-rdfc-2022` verifiers.
const {tags} = config.suites['eddsa-rdfc-2022'];
Expand All @@ -17,6 +21,8 @@ const {match} = endpoints.filterByTag({
// options for the DI Verifier Suite
const testDataOptions = {
suiteName: 'eddsa-rdfc-2022',
cryptosuite: eddsaRdfc2022CryptoSuite,
key: await getMultikey()
};

checkDataIntegrityProofVerifyErrors({
Expand Down
5 changes: 4 additions & 1 deletion tests/vc-generator/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import * as Ed25519Multikey from '@digitalbazaar/ed25519-multikey';
import crypto from 'crypto';
import {decodeSecretKeySeed} from 'bnid';

export const getMultikey = async ({seedMultibase}) => {
export const getMultikey = async ({
// all else fails use the test key seed
seedMultibase = 'z1AYMku6XEB5KV3XJbYzz9VejGJYRuqzu5wmq4JDRyUCjr8'
} = {}) => {
if(!seedMultibase) {
throw new Error('seedMultibase required');
}
Expand Down
8 changes: 2 additions & 6 deletions tests/vc-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ const vcCache = new Map([
*/
export async function generateTestData() {
const {signer, issuer} = await getMultikey({
seedMultibase: (
process.env?.KEY_SEED_DB ||
process.env?.CLIENT_SECRET_DB ||
// all else fails use the test key seed
'z1AYMku6XEB5KV3XJbYzz9VejGJYRuqzu5wmq4JDRyUCjr8'
)
seedMultibase: (process.env?.KEY_SEED_DB ||
process.env?.CLIENT_SECRET_DB)
});
const credential = klona(validVc);
credential.issuer = issuer;
Expand Down

0 comments on commit cd08568

Please sign in to comment.