Skip to content

Commit

Permalink
Test issuers use mandatoryPointers from versioned VCs.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Sep 8, 2024
1 parent a311acc commit 51959ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
20 changes: 15 additions & 5 deletions tests/10-issuer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,34 @@ describe('Test checkDataIntegrityProofFormat()', function() {

describe('should issue all suites', function() {
for(const testDataOptions of cryptosuites) {
for(const [vcVersion, {credential}] of versionedCredentials) {
for(const [
vcVersion,
{credential, mandatoryPointers}
] of versionedCredentials) {
_runSuite({
vcVersion,
testDataOptions,
credential
credential,
mandatoryPointers
});
}
}
});

function _runSuite({vcVersion, testDataOptions, credential}) {
function _runSuite({
vcVersion, testDataOptions,
credential, mandatoryPointers
}) {
const {suiteName, keyType = ''} = testDataOptions;
return describe(`VC ${vcVersion} Suite ${suiteName} keyType ${keyType}`,
function() {
const implemented = new Map();
const {mandatoryPointers, cryptosuite, key} = testDataOptions;
const {cryptosuite, key, derived} = testDataOptions;
const signer = key.signer();
const suite = createSuite({signer, cryptosuite, mandatoryPointers});
const suite = createSuite({
signer, cryptosuite,
mandatoryPointers, derived
});
// pass the VC's context to the issuer
const {'@context': contexts} = credential;
const issuer = new MockIssuer({
Expand Down
7 changes: 5 additions & 2 deletions tests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
*/
import {DataIntegrityProof} from '@digitalbazaar/data-integrity';

export function createSuite({cryptosuite, signer, mandatoryPointers}) {
if(mandatoryPointers) {
export function createSuite({
cryptosuite, signer,
mandatoryPointers, derived = false
}) {
if(derived) {
return new DataIntegrityProof({
signer,
cryptosuite: cryptosuite.createSignCryptosuite({mandatoryPointers})
Expand Down

0 comments on commit 51959ed

Please sign in to comment.