Skip to content

Commit

Permalink
Only use deprecated proof type statement with non DataIntegrity suites.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Oct 24, 2024
1 parent 8519753 commit aeedf54
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions suites/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,32 @@ export function runDataIntegrityProofVerifyTests({
reason: 'MUST not verify VC w/o "proof.proofPurpose"'
});
});
it(`If the "proof.type" field is not the string ` +
`"${expectedProofType}", an error MUST be raised.`,
async function() {
const credential = credentials.clone('invalidProofType');
await verificationFail({credential, verifier});
});
// use updated statement for DataIntegrityProof tests
if(expectedProofType === 'DataIntegrityProof') {
it('The type property MUST contain the string DataIntegrityProof.',
async function() {
this.test.link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=The%20type%20property%20MUST%20contain%20the%20string%20DataIntegrityProof.';
const credential = credentials.clone('invalidProofType');
await verificationFail({
credential,
verifier,
reason: 'Should not verify VC with invalid "proof.type"'
});
});
} else {
// if the expectedProofType if Ed25519Sig etc. use the
// deprecated statement
it(`If the "proof.type" field is not the string ` +
`"${expectedProofType}", an error MUST be raised.`,
async function() {
const credential = credentials.clone('invalidProofType');
await verificationFail({
credential,
verifier,
reason: 'Should not verify VC with invalid "proof.type"'
});
});
}
it('If the "proof.verificationMethod" field is invalid, an error ' +
'MUST be raised.', async function() {
const credential = credentials.clone('invalidVm');
Expand Down

0 comments on commit aeedf54

Please sign in to comment.