Skip to content

Commit 5041553

Browse files
committed
Reuse existing sd setup.
1 parent d155c81 commit 5041553

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

tests/suites/algorithms-sd.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,30 @@
55
import {
66
assertions,
77
} from 'data-integrity-test-suite-assertion';
8+
import {sdVerifySetup} from '../setup.js';
89

910
export function sd2023Algorithms({
10-
credential,
11+
credentials,
1112
verifiers,
1213
issuers,
13-
mandatoryPointers,
14-
selectivePointers,
1514
keyTypes,
1615
suiteName,
1716
vcVersion,
18-
setup = _setup
17+
setup = sdVerifySetup
1918
}) {
2019
return describe(`${suiteName} - Algorithms - VC ${vcVersion}`, function() {
2120
this.matrix = true;
2221
this.report = true;
2322
this.implemented = [];
2423
this.rowLabel = 'Test Name';
2524
this.columnLabel = 'Implementation';
26-
const credentials = new Map(keyTypes.map(kt => [kt, null]));
25+
let fixtures = new Map();
2726
before(async function() {
28-
for(const keyType of keyTypes) {
29-
credentials.set(keyType, await setup({
30-
suiteName,
31-
keyType,
32-
credential,
33-
mandatoryPointers,
34-
selectivePointers
35-
}));
36-
}
27+
fixtures = await setup({
28+
suite: suiteName,
29+
keyTypes,
30+
credentials
31+
});
3732
});
3833
for(const [name, {endpoints}] of verifiers) {
3934
const [verifier] = endpoints;
@@ -101,6 +96,11 @@ export function sd2023Algorithms({
10196
'MUST be raised and SHOULD convey an error type of ' +
10297
'PROOF_VERIFICATION_ERROR.', async function() {
10398
this.test.link = 'https://w3c.github.io/vc-di-ecdsa/#selective-disclosure-functions:~:text=labelMap%22%2C%20and%20%22mandatoryIndexes%22.-,If%20the%20proofValue%20string%20does%20not%20start%20with%20u%2C%20indicating%20that%20it%20is%20a%20multibase%2Dbase64url%2Dno%2Dpad%2Dencoded%20value%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_VERIFICATION_ERROR.,-Initialize%20decodedProofValue%20to';
99+
await assertions.verificationFail({
100+
credential,
101+
verifier,
102+
reason: 'Should not verify proofValue not starting with u'
103+
});
104104
});
105105
it('If the decodedProofValue does not start with the ECDSA-SD ' +
106106
'disclosure proof header bytes 0xd9, 0x5d, and 0x01, an error ' +

0 commit comments

Comments
 (0)