@@ -29,51 +29,6 @@ export function runDataIntegrityProofVerifyTests({
2929 before ( async function ( ) {
3030 proofValueTests = shouldBeProofValue ( { credentials, verifier} ) ;
3131 } ) ;
32- it ( 'An OPTIONAL string value (proof.previousProof) or unordered list of ' +
33- 'string values. Each value identifies another data integrity proof that ' +
34- 'MUST verify before the current proof is processed.' , async function ( ) {
35- this . test . link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=An%20OPTIONAL%20string%20value%20or%20unordered%20list%20of%20string%20values.%20Each%20value%20identifies%20another%20data%20integrity%20proof%20that%20MUST%20verify%20before%20the%20current%20proof%20is%20processed' ;
36- await verificationSuccess ( {
37- credential : credentials . clone ( 'previousProofString' ) ,
38- verifier,
39- reason : 'Should verify VC with a string "proof.previousProof".'
40- } ) ;
41- await verificationSuccess ( {
42- credential : credentials . clone ( 'previousProofArray' ) ,
43- verifier,
44- reason : 'Should verify VC with an Array "proof.previousProof".'
45- } ) ;
46- } ) ;
47- it ( 'If an unordered list (proof), all referenced proofs in ' +
48- 'the array MUST verify.' , async function ( ) {
49- this . test . link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=If%20an%20unordered%20list%2C%20all%20referenced%20proofs%20in%20the%20array%20MUST%20verify' ;
50- await verificationSuccess ( {
51- credential : credentials . clone ( 'proofSet' ) ,
52- verifier,
53- reason : 'Should verify VC with multiple proofs.'
54- } ) ;
55- } ) ;
56- it ( 'If a proof with id equal to previousProof does not exist in ' +
57- 'allProofs, an error MUST be raised and SHOULD convey an error type ' +
58- 'of PROOF_GENERATION_ERROR.' , async function ( ) {
59- this . test . link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=If%20a%20proof%20with%20id%20equal%20to%20previousProof%20does%20not%20exist%20in%20allProofs%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.' ;
60- await verificationFail ( {
61- credential : credentials . clone ( 'missingPreviousProofString' ) ,
62- verifier,
63- reason : 'Should not verify VC with invalid "proof.previousProof".'
64- } ) ;
65- } ) ;
66- it ( 'If any element of previousProof list has an id attribute that does ' +
67- 'not match the id attribute of any element of allProofs, an error MUST ' +
68- 'be raised and SHOULD convey an error type of PROOF_GENERATION_ERROR.' ,
69- async function ( ) {
70- this . test . link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=If%20any%20element%20of%20previousProof%20list%20has%20an%20id%20attribute%20that%20does%20not%20match%20the%20id%20attribute%20of%20any%20element%20of%20allProofs%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.' ;
71- await verificationFail ( {
72- credential : credentials . clone ( 'missingPreviousProofArray' ) ,
73- verifier,
74- reason : 'Should not verify VC with invalid "proof.previousProof".'
75- } ) ;
76- } ) ;
7732 it ( 'When deserializing to RDF, implementations MUST ensure that the ' +
7833 'base URL is set to null.' , async function ( ) {
7934 this . test . link = 'https://w3c.github.io/vc-data-integrity/#securing-data-losslessly:~:text=When%20deserializing%20to%20RDF%2C%20implementations%20MUST%20ensure%20that%20the%20base%20URL%20is%20set%20to%20null.' ;
@@ -272,6 +227,55 @@ export function runDataIntegrityProofVerifyTests({
272227 } ) ;
273228 } ) ;
274229 }
230+ if ( optionalTests . proofChain ) {
231+ it ( 'An OPTIONAL string value (proof.previousProof) or unordered list ' +
232+ 'of string values. Each value identifies another data integrity proof ' +
233+ 'that MUST verify before the current proof is processed.' ,
234+ async function ( ) {
235+ this . test . link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=An%20OPTIONAL%20string%20value%20or%20unordered%20list%20of%20string%20values.%20Each%20value%20identifies%20another%20data%20integrity%20proof%20that%20MUST%20verify%20before%20the%20current%20proof%20is%20processed' ;
236+ await verificationSuccess ( {
237+ credential : credentials . clone ( 'previousProofString' ) ,
238+ verifier,
239+ reason : 'Should verify VC with a string "proof.previousProof".'
240+ } ) ;
241+ await verificationSuccess ( {
242+ credential : credentials . clone ( 'previousProofArray' ) ,
243+ verifier,
244+ reason : 'Should verify VC with an Array "proof.previousProof".'
245+ } ) ;
246+ } ) ;
247+ it ( 'If an unordered list (proof), all referenced proofs in ' +
248+ 'the array MUST verify.' , async function ( ) {
249+ this . test . link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=If%20an%20unordered%20list%2C%20all%20referenced%20proofs%20in%20the%20array%20MUST%20verify' ;
250+ await verificationSuccess ( {
251+ credential : credentials . clone ( 'proofSet' ) ,
252+ verifier,
253+ reason : 'Should verify VC with multiple proofs.'
254+ } ) ;
255+ } ) ;
256+ it ( 'If a proof with id equal to previousProof does not exist in ' +
257+ 'allProofs, an error MUST be raised and SHOULD convey an error type ' +
258+ 'of PROOF_GENERATION_ERROR.' , async function ( ) {
259+ this . test . link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=If%20a%20proof%20with%20id%20equal%20to%20previousProof%20does%20not%20exist%20in%20allProofs%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.' ;
260+ await verificationFail ( {
261+ credential : credentials . clone ( 'missingPreviousProofString' ) ,
262+ verifier,
263+ reason : 'Should not verify VC with invalid "proof.previousProof".'
264+ } ) ;
265+ } ) ;
266+ it ( 'If any element of previousProof list has an id attribute that does ' +
267+ 'not match the id attribute of any element of allProofs, an error MUST ' +
268+ 'be raised and SHOULD convey an error type of PROOF_GENERATION_ERROR.' ,
269+ async function ( ) {
270+ this . test . link = 'https://w3c.github.io/vc-data-integrity/#proofs:~:text=If%20any%20element%20of%20previousProof%20list%20has%20an%20id%20attribute%20that%20does%20not%20match%20the%20id%20attribute%20of%20any%20element%20of%20allProofs%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.' ;
271+ await verificationFail ( {
272+ credential : credentials . clone ( 'missingPreviousProofArray' ) ,
273+ verifier,
274+ reason : 'Should not verify VC with invalid "proof.previousProof".'
275+ } ) ;
276+ } ) ;
277+
278+ }
275279 } ) ;
276280}
277281
0 commit comments