@@ -8,6 +8,10 @@ export function algorithmsAssertions({
8
8
testDescription,
9
9
vendorName,
10
10
credential,
11
+ features = {
12
+ authentication : false ,
13
+ proofChain : false
14
+ }
11
15
} ) {
12
16
return describe ( testDescription , function ( ) {
13
17
const columnId = testDescription ;
@@ -54,78 +58,73 @@ and proof.proofPurpose values is not set, an error MUST be raised.',
54
58
'type' , 'proofPurpose' , 'verificationMethod' ) ;
55
59
}
56
60
} ) ;
57
- it ( 'If options has a non-null domain item, it MUST be equal to \
58
- proof.domain or an error MUST be raised.' ,
59
- function ( ) {
60
- this . test . link = 'https://www.w3.org/TR/vc-data-integrity/#:~:text=If%20options%20has%20a%20non%2Dnull%20domain%20item%2C%20it%20MUST%20be%20equal%20to%20proof.domain%20or%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.' ;
61
- this . test . cell . skipMessage = 'Pending test.' ;
62
- this . skip ( ) ;
63
- } ) ;
64
- it ( 'If options has a non-null challenge item, it MUST be equal to \
65
- proof.challenge or an error MUST be raised.' ,
66
- function ( ) {
67
- this . test . link = 'https://www.w3.org/TR/vc-data-integrity/#:~:text=If%20options%20has%20a%20non%2Dnull%20challenge%20item%2C%20it%20MUST%20be%20equal%20to%20proof.challenge%20or%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.' ;
68
- this . test . cell . skipMessage = 'Pending test.' ;
69
- this . skip ( ) ;
70
- } ) ;
71
- it ( 'Whenever this algorithm encodes strings, it MUST use UTF-8 encoding.' ,
61
+ if ( features ?. authentication ) {
62
+ it ( 'If options has a non-null domain item, it MUST be equal to \
63
+ proof.domain or an error MUST be raised.' ,
72
64
function ( ) {
73
- this . test . link = 'https://www.w3.org/TR/vc-data-integrity/#:~:text=(map).-,Whenever%20this%20algorithm%20encodes%20strings%2C%20it%20MUST%20use%20UTF%2D8%20encoding.,-Let%20proof%20be' ;
74
- for ( const proof of proofs ) {
75
- expect ( proof . proofValue . isWellFormed ( ) ) . to . be . true ;
76
- }
65
+ this . test . link = 'https://www.w3.org/TR/vc-data-integrity/#:~:text=If%20options%20has%20a%20non%2Dnull%20domain%20item%2C%20it%20MUST%20be%20equal%20to%20proof.domain%20or%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.' ;
66
+ this . test . cell . skipMessage = 'Pending test.' ;
67
+ this . skip ( ) ;
77
68
} ) ;
78
- it ( 'If a proof with id equal to previousProof does not exist in allProofs, \
79
- an error MUST be raised.' ,
80
- function ( ) {
81
- this . test . link = 'https://www.w3.org/TR/vc-data-integrity/#:~:text=If%20a%20proof%20with%20id%20equal%20to%20previousProofdoes%20not%20exist%20in%20allProofs%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.' ;
82
- for ( const proof of proofs ) {
83
- if ( 'previousProof' in proof ) {
84
- if ( typeof proof . previousProof === 'string' ) {
85
- proofs . some (
86
- otherProof => otherProof . id == proof . previousProof ) .
87
- should . equal ( true ,
88
- 'Expected previousProof ' +
89
- `${ proof . previousProof } ` +
90
- 'to be the id of another included proof.'
91
- ) ;
92
- } if ( Array . isArray ( proof . previousProof ) ) {
93
- for ( const previousProof in proof . previousProof ) {
69
+ it ( 'If options has a non-null challenge item, it MUST be equal to \
70
+ proof.challenge or an error MUST be raised.' ,
71
+ function ( ) {
72
+ this . test . link = 'https://www.w3.org/TR/vc-data-integrity/#:~:text=If%20options%20has%20a%20non%2Dnull%20challenge%20item%2C%20it%20MUST%20be%20equal%20to%20proof.challenge%20or%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.' ;
73
+ this . test . cell . skipMessage = 'Pending test.' ;
74
+ this . skip ( ) ;
75
+ } ) ;
76
+ }
77
+ if ( features ?. proofChain ) {
78
+ it ( 'If a proof with id equal to previousProof does not exist in ' +
79
+ 'allProofs, an error MUST be raised.' , function ( ) {
80
+ this . test . link = 'https://www.w3.org/TR/vc-data-integrity/#:~:text=If%20a%20proof%20with%20id%20equal%20to%20previousProofdoes%20not%20exist%20in%20allProofs%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_GENERATION_ERROR.' ;
81
+ for ( const proof of proofs ) {
82
+ if ( 'previousProof' in proof ) {
83
+ if ( typeof proof . previousProof === 'string' ) {
94
84
proofs . some (
95
- otherProof => otherProof . id == previousProof ) .
85
+ otherProof => otherProof . id == proof . previousProof ) .
96
86
should . equal ( true ,
97
87
'Expected previousProof ' +
98
- `${ proof . previousProof } ` +
99
- 'to be the id of another included proof.'
88
+ `${ proof . previousProof } ` +
89
+ 'to be the id of another included proof.'
100
90
) ;
91
+ } if ( Array . isArray ( proof . previousProof ) ) {
92
+ for ( const previousProof in proof . previousProof ) {
93
+ proofs . some (
94
+ otherProof => otherProof . id == previousProof ) .
95
+ should . equal ( true ,
96
+ 'Expected previousProof ' +
97
+ `${ proof . previousProof } ` +
98
+ 'to be the id of another included proof.'
99
+ ) ;
100
+ }
101
101
}
102
102
}
103
103
}
104
- }
105
- } ) ;
106
- it ( 'If any element of previousProof array has an id attribute \
107
- that does not match the id attribute of any element of allProofs, \
108
- an error MUST be raised.' ,
109
- function ( ) {
110
- this . test . link = 'https://www.w3.org/TR/vc-data-integrity/#:~:text=If%20any%20element%20of%20previousProof%20array%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.' ;
111
- const previousProofs = [ ] ;
112
- for ( const proof of proofs ) {
113
- if ( 'previousProof' in proof ) {
114
- if ( typeof proof . previousProof === 'string' ) {
115
- previousProofs . push ( proof . previousProof ) ;
116
- } if ( Array . isArray ( proof . previousProof ) ) {
117
- previousProofs . concat ( proof . previousProof ) ;
104
+ } ) ;
105
+ it ( 'If any element of previousProof array has an id attribute' +
106
+ ' that does not match the id attribute of any element of allProofs,' +
107
+ ' an error MUST be raised.' , function ( ) {
108
+ this . test . link = 'https://www.w3.org/TR/vc-data-integrity/#:~:text=If%20any%20element%20of%20previousProof%20array%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.' ;
109
+ const previousProofs = [ ] ;
110
+ for ( const proof of proofs ) {
111
+ if ( 'previousProof' in proof ) {
112
+ if ( typeof proof . previousProof === 'string' ) {
113
+ previousProofs . push ( proof . previousProof ) ;
114
+ } if ( Array . isArray ( proof . previousProof ) ) {
115
+ previousProofs . concat ( proof . previousProof ) ;
116
+ }
118
117
}
119
118
}
120
- }
121
- for ( const previousProof of previousProofs ) {
122
- proofs . some (
123
- otherProof => otherProof . id == previousProof ) . should . equal (
124
- true ,
125
- 'Expected all previousProof values to be the id of \
126
- another included proof.'
127
- ) ;
128
- }
129
- } ) ;
119
+ for ( const previousProof of previousProofs ) {
120
+ proofs . some (
121
+ otherProof => otherProof . id == previousProof ) . should . equal (
122
+ true ,
123
+ 'Expected all previousProof values to be the id of \
124
+ another included proof.'
125
+ ) ;
126
+ }
127
+ } ) ;
128
+ }
130
129
} ) ;
131
130
}
0 commit comments