Skip to content

Commit 9523612

Browse files
committed
Add _getSuites & initial generator params.
1 parent 76c823d commit 9523612

File tree

1 file changed

+60
-7
lines changed

1 file changed

+60
-7
lines changed

tests/suites/conformance.js

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import {
77
generators,
88
issueCloned
99
} from 'data-integrity-test-suite-assertion';
10+
import {DataIntegrityProof} from '@digitalbazaar/data-integrity';
1011
import {getMultiKey} from '../vc-generator/key-gen.js';
12+
import {getSuite} from '../vc-generator/cryptosuites.js';
1113

1214
export function assertConformance({
1315
verifiers,
@@ -40,6 +42,13 @@ export function assertConformance({
4042
'Data Model and 3. Algorithms of this document MUST be enforced.',
4143
async function() {
4244
this.test.link = 'https://w3c.github.io/vc-di-ecdsa/#:~:text=Specifically%2C%20all%20relevant%20normative%20statements%20in%20Sections%202.%20Data%20Model%20and%203.%20Algorithms%20of%20this%20document%20MUST%20be%20enforced.';
45+
for(const [key, credential] of credentials) {
46+
await assertions.verificationFail({
47+
verifier,
48+
credential,
49+
reason: `Should not verify VC with ${key}`
50+
});
51+
}
4352
});
4453
it('Conforming processors MUST produce errors when non-conforming ' +
4554
'documents are consumed.', async function() {
@@ -60,7 +69,6 @@ async function _setup({
6069
credential,
6170
suiteName,
6271
keyType,
63-
cryptosuite,
6472
mandatoryPointers,
6573
selectivePointers
6674
}) {
@@ -75,14 +83,59 @@ async function _setup({
7583
// not bs58 encoded verificationMethod via invalidVm
7684
// type is not DataIntegrityProof invalidType
7785
// invalid cryptosuite name invalidCryptosuite
78-
credentials.set('invalidCryptosuite', await issueCloned(invalidCryptosuite({
79-
86+
credentials.set('invalid cryptosuite', await issueCloned(invalidCryptosuite({
87+
credential: structuredClone(credential),
88+
..._getSuites({
89+
signer,
90+
suiteName,
91+
selectivePointers,
92+
mandatoryPointers
93+
})
8094
})));
81-
credentials.set('invalidVerificationMethod', await issueCloned(invalidVm({
82-
95+
credentials.set('invalid VerificationMethod', await issueCloned(invalidVm({
96+
credential: structuredClone(credential),
97+
..._getSuites({
98+
signer,
99+
suiteName,
100+
selectivePointers,
101+
mandatoryPointers
102+
})
83103
})));
84-
credentials.set('invalidProofType', await issueCloned(invalidProofType({
85-
104+
credentials.set('invalid Proof Type', await issueCloned(invalidProofType({
105+
credential: structuredClone(credential),
106+
..._getSuites({
107+
signer,
108+
suiteName,
109+
selectivePointers,
110+
mandatoryPointers
111+
})
86112
})));
87113
return credentials;
88114
}
115+
116+
function _getSuites({
117+
signer,
118+
suiteName,
119+
mandatoryPointers,
120+
selectivePointers
121+
}) {
122+
const suites = {
123+
suite: new DataIntegrityProof({
124+
signer,
125+
cryptosuite: getSuite({
126+
suite: suiteName,
127+
mandatoryPointers
128+
})
129+
})
130+
};
131+
if(selectivePointers) {
132+
suites.selectiveSuite = new DataIntegrityProof({
133+
signer,
134+
cryptosuite: getSuite({
135+
suite: suiteName,
136+
selectivePointers
137+
})
138+
});
139+
}
140+
return suites;
141+
}

0 commit comments

Comments
 (0)