Skip to content

Commit 6424fef

Browse files
committed
Add test fixture for invalid proofValue prefix.
1 parent 5aaa331 commit 6424fef

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

tests/suites/algorithms-sd.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,11 @@ export function sd2023Algorithms({
173173
'MUST be raised and SHOULD convey an error type of ' +
174174
'PROOF_VERIFICATION_ERROR.', async function() {
175175
this.test.link = 'https://w3c.github.io/vc-di-ecdsa/#selective-disclosure-functions:~:text=produced%20as%20output.-,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';
176-
this.test.cell.skipMessage = 'Not Implemented';
177-
this.skip();
178-
/*
179176
await assertions.verificationFail({
180177
verifier,
181-
credential: fixtures.get('invalidProofValuePrefix'),
178+
credential: fixtures.get(keyType).get('invalidProofValuePrefix'),
182179
reason: 'Should not verify VC with invalid proofValue prefix'
183180
});
184-
*/
185181
});
186182
it('If the decodedProofValue does not start with the ECDSA-SD ' +
187183
'base proof header bytes 0xd9, 0x5d, and 0x00, an error MUST be ' +
@@ -190,13 +186,7 @@ export function sd2023Algorithms({
190186
this.test.link = 'https://w3c.github.io/vc-di-ecdsa/#selective-disclosure-functions:~:text=If%20the%20decodedProofValue%20does%20not%20start%20with%20the%20ECDSA%2DSD%20base%20proof%20header%20bytes%200xd9%2C%200x5d%2C%20and%200x00%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_VERIFICATION_ERROR.';
191187
this.test.cell.skipMessage = 'Not Implemented';
192188
this.skip();
193-
/*
194-
await assertions.verificationFail({
195-
verifier,
196-
credential: fixtures.get('invalidBaseProofHeader'),
197-
reason: 'Should not verify VC with invalid base proof header'
198-
});
199-
*/
189+
assertIssuer();
200190
});
201191
it('If the decodedProofValue does not start with the ECDSA-SD ' +
202192
'disclosure proof header bytes 0xd9, 0x5d, and 0x01, an error ' +
@@ -367,5 +357,18 @@ async function _setup({
367357
suite: cborTagSuites.suite,
368358
selectiveSuite: invalidCborTagProxy(cborTagSuites.selectiveSuite)
369359
}));
360+
const securedCredential = await issueCloned({
361+
credential: _credential,
362+
...getSuites({
363+
signer,
364+
suiteName,
365+
selectivePointers,
366+
mandatoryPointers
367+
})
368+
});
369+
const nonbase64ProofValue = structuredClone(securedCredential);
370+
nonbase64ProofValue.proof.proofValue =
371+
nonbase64ProofValue.proof.proofValue.substring(1);
372+
credentials.set('invalidProofValuePrefix', nonbase64ProofValue);
370373
return credentials;
371374
}

0 commit comments

Comments
 (0)