@@ -51,18 +51,37 @@ export function runDataIntegrityProofVerifyTests({
5151 reason : 'Should not verify VC with invalid "proof.type"'
5252 } ) ;
5353 } ) ;
54- it ( 'If the "proof" field is missing, an error MUST be raised.' ,
55- async function ( ) {
56- const credential = credentials . clone ( 'issuedVc' ) ;
57- delete credential . proof ;
58- await verificationFail ( { credential, verifier} ) ;
54+ it ( 'If one or more of proof.type, proof.verificationMethod, and ' +
55+ 'proof.proofPurpose does not exist, an error MUST be raised and ' +
56+ 'SHOULD convey an error type of PROOF_VERIFICATION_ERROR' ,
57+ async function ( ) {
58+ this . test . link = 'https://w3c.github.io/vc-data-integrity/#:~:text=If%20one%20or%20more%20of%20proof.type%2C%20proof.verificationMethod%2C%20and%20proof.proofPurpose%20does%20not%20exist%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_VERIFICATION_ERROR.' ;
59+ const credential = credentials . clone ( 'issuedVc' ) ;
60+ delete credential . proof ;
61+ await verificationFail ( {
62+ credential,
63+ verifier,
64+ reason : 'MUST not verify VC w/o a proof'
5965 } ) ;
60- it ( 'If the "proof" field is invalid, an error MUST be raised.' ,
61- async function ( ) {
62- const credential = credentials . clone ( 'issuedVc' ) ;
63- credential . proof = null ;
64- await verificationFail ( { credential, verifier} ) ;
66+ } ) ;
67+ it ( 'If either securedDocument is not a map or securedDocument.proof is ' +
68+ 'not a map, an error MUST be raised and SHOULD convey an error type ' +
69+ 'of PARSING_ERROR.' , async function ( ) {
70+ this . test . link = 'https://w3c.github.io/vc-data-integrity/#:~:text=If%20either%20securedDocument%20is%20not%20a%20map%20or%20securedDocument.proof%20is%20not%20a%20map%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PARSING_ERROR.' ;
71+ const credential = credentials . clone ( 'issuedVc' ) ;
72+ credential . proof = null ;
73+ await verificationFail ( {
74+ credential,
75+ verifier,
76+ reason : 'MUST not verify VC with proof that is not a map.'
6577 } ) ;
78+ await verificationFail ( {
79+ // use a string as the non map representation of a VC
80+ credential : JSON . stringify ( credentials . clone ( 'issuedVc' ) ) ,
81+ verifier,
82+ reason : 'MUST not verify VC that is not a map.'
83+ } ) ;
84+ } ) ;
6685 it ( 'If the "proof.type" field is missing, an error MUST be raised.' ,
6786 async function ( ) {
6887 const credential = credentials . clone ( 'issuedVc' ) ;
0 commit comments