Skip to content

Commit

Permalink
Add noCryptosuite test vector to MUST for proof.{type, cryptosuite}.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Jun 21, 2024
1 parent 4af347f commit 5c1c8c5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
11 changes: 11 additions & 0 deletions tests/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@ export async function verifySetup({credentials, keyTypes, suite}) {
// add a generator to turns safe mode off for proof canonize and hash
generators: [allowUnsafeCanonize, invalidProofType]
});
disclosed.invalid.noCryptosuite = await deriveCredentials({
keys,
vectors: disclosedBasicVectors,
suiteName: suite,
initialParams: {
cryptosuiteName: ''
},
// add a generator to turns safe mode off for proof canonize and hash
generators: [allowUnsafeCanonize, invalidCryptosuite]
});

disclosed.invalid.nonUTF8 = await deriveCredentials({
keys,
vectors: disclosedBasicVectors,
Expand Down
13 changes: 5 additions & 8 deletions tests/suites/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,6 @@ export function verifySuite({
'identifier (cryptosuite). A proof configuration object is produced ' +
'as output.', async function() {
this.test.link = 'https://w3c.github.io/vc-di-bbs/#linkage-via-proof-options-and-mandatory-reveal:~:text=The%20proof%20options%20MUST%20contain%20a%20type%20identifier%20for%20the%20cryptographic%20suite%20(type)%20and%20MUST%20contain%20a%20cryptosuite%20identifier%20(cryptosuite).%20A%20proof%20configuration%20object%20is%20produced%20as%20output.';
const credential = cloneTestVector(
disclosed?.invalid?.noProofTypeOrCryptosuite);
await verificationFail({credential, verifier});
});
it('The proof options MUST contain a type identifier for the ' +
'cryptographic suite (type) and MAY contain a cryptosuite ' +
'identifier (cryptosuite).', async function() {
this.test.link = 'https://w3c.github.io/vc-di-bbs/#linkage-via-proof-options-and-mandatory-reveal:~:text=The%20proof%20options%20MUST%20contain%20a%20type%20identifier%20for%20the%20cryptographic%20suite%20(type)%20and%20MAY%20contain%20a%20cryptosuite%20identifier%20(cryptosuite).';
await verificationFail({
credential: cloneTestVector(
disclosed?.invalid?.noProofTypeOrCryptosuite),
Expand All @@ -130,6 +122,11 @@ export function verifySuite({
disclosed?.invalid?.noProofType),
verifier
});
await verificationFail({
credential: cloneTestVector(
disclosed?.invalid?.noCryptosuite),
verifier
});
});

it('MUST fail to verify a base proof.', async function() {
Expand Down

0 comments on commit 5c1c8c5

Please sign in to comment.