@@ -87,7 +87,7 @@ export function ecdsaRdfc2019Algorithms({
8787 verifiers,
8888 mandatoryPointers,
8989 selectivePointers,
90- keyType ,
90+ keyTypes ,
9191 suiteName,
9292 vcVersion,
9393 setup = _setup
@@ -98,95 +98,106 @@ export function ecdsaRdfc2019Algorithms({
9898 this . implemented = [ ] ;
9999 this . rowLabel = 'Test Name' ;
100100 this . columnLabel = 'Implementation' ;
101- let credentials = new Map ( ) ;
101+ const credentials = new Map ( keyTypes . map ( kt => [ kt , null ] ) ) ;
102102 before ( async function ( ) {
103- credentials = await setup ( {
104- suiteName,
105- keyType,
106- credential,
107- mandatoryPointers,
108- selectivePointers
109- } ) ;
103+ for ( const keyType of keyTypes ) {
104+ credentials . set ( keyType , await setup ( {
105+ suiteName,
106+ keyType,
107+ credential,
108+ mandatoryPointers,
109+ selectivePointers
110+ } ) ) ;
111+ }
110112 } ) ;
111113 for ( const [ name , { endpoints} ] of verifiers ) {
112114 const [ verifier ] = endpoints ;
113- this . implemented . push ( `${ name } : ${ keyType } ` ) ;
114- describe ( `${ name } : ${ keyType } ` , function ( ) {
115- beforeEach ( function ( ) {
116- this . currentTest . cell = {
117- rowId : this . currentTest . title ,
118- columnId : this . currentTest . parent . title
119- } ;
120- } ) ;
121- it ( 'The transformation options MUST contain a type identifier for ' +
122- 'the cryptographic suite (type) and a cryptosuite identifier ' +
123- '(cryptosuite).' , async function ( ) {
124- this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019' ;
125- await assertions . verificationFail ( {
126- verifier,
127- credentials : credentials . get ( 'noTypeOrCryptosuite' ) ,
128- reason : 'Should not verify VC w/ no type or cryptosuite identifier'
115+ for ( const keyType of keyTypes ) {
116+ this . implemented . push ( `${ name } : ${ keyType } ` ) ;
117+ describe ( `${ name } : ${ keyType } ` , function ( ) {
118+ beforeEach ( function ( ) {
119+ this . currentTest . cell = {
120+ rowId : this . currentTest . title ,
121+ columnId : this . currentTest . parent . title
122+ } ;
129123 } ) ;
130- } ) ;
131- it ( 'Whenever this algorithm encodes strings, it MUST use UTF-8 ' +
132- 'encoding. (proof.type)' , async function ( ) {
133- this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019' ;
134- await assertions . verificationFail ( {
135- verifier,
136- credentials : credentials . get ( 'notUTF8' ) ,
137- reason : 'Should not verify VC w/ non UTF-8 encoding'
124+ it ( 'The transformation options MUST contain a type identifier for ' +
125+ 'the cryptographic suite (type) and a cryptosuite identifier ' +
126+ '(cryptosuite).' , async function ( ) {
127+ this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019' ;
128+ await assertions . verificationFail ( {
129+ verifier,
130+ credentials : credentials . get ( 'noTypeOrCryptosuite' ) ,
131+ reason : 'Should not verify VC w/ no type or cryptosuite ' +
132+ 'identifier'
133+ } ) ;
138134 } ) ;
139- } ) ;
140- it ( 'If options.type is not set to the string DataIntegrityProof ' +
141- 'and options.cryptosuite is not set to the string ecdsa-rdfc-2019, ' +
142- 'an error MUST be raised ' , async function ( ) {
143- this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019:~:text=If%20options.type%20is%20not%20set%20to%20the%20string%20DataIntegrityProof%20and%20options.cryptosuite%20is%20not%20set%20to%20the%20string%20ecdsa%2Drdfc%2D2019%2C%20an%20error%20MUST%20be%20raised' ;
144- await assertions . verificationFail ( {
145- verifier,
146- credentials : credentials . get ( 'noTypeOrCryptosuite' ) ,
147- reason : 'Should not verify VC w/ no type or cryptosuite identifier'
135+ it ( 'Whenever this algorithm encodes strings, it MUST use UTF-8 ' +
136+ 'encoding. (proof.type)' , async function ( ) {
137+ this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019' ;
138+ await assertions . verificationFail ( {
139+ verifier,
140+ credentials : credentials . get ( 'notUTF8' ) ,
141+ reason : 'Should not verify VC w/ non UTF-8 encoding'
142+ } ) ;
148143 } ) ;
149- } ) ;
150- it ( 'The proof options MUST contain a type identifier for the ' +
151- 'cryptographic suite (type) and MUST contain a cryptosuite ' +
152- 'identifier (cryptosuite).' , async function ( ) {
153- this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#proof-configuration-ecdsa-rdfc-2019' ;
154- await assertions . verificationFail ( {
155- verifier,
156- credentials : credentials . get ( 'noTypeOrCryptosuite' ) ,
157- reason : 'Should not verify VC w/ no type or cryptosuite identifier'
144+ it ( 'If options.type is not set to the string DataIntegrityProof ' +
145+ 'and options.cryptosuite is not set to the string ecdsa-rdfc-2019, ' +
146+ 'an error MUST be raised ' , async function ( ) {
147+ this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019:~:text=If%20options.type%20is%20not%20set%20to%20the%20string%20DataIntegrityProof%20and%20options.cryptosuite%20is%20not%20set%20to%20the%20string%20ecdsa%2Drdfc%2D2019%2C%20an%20error%20MUST%20be%20raised' ;
148+ await assertions . verificationFail ( {
149+ verifier,
150+ credentials : credentials . get ( 'noTypeOrCryptosuite' ) ,
151+ reason : 'Should not verify VC w/ no type or cryptosuite ' +
152+ 'identifier'
153+ } ) ;
158154 } ) ;
159- } ) ;
160- it ( 'If proofConfig.type is not set to DataIntegrityProof and/or ' +
161- 'proofConfig.cryptosuite is not set to ecdsa-rdfc-2019, an error ' +
162- 'MUST be raised' , async function ( ) {
163- this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#proof-configuration-ecdsa-rdfc-2019:~:text=If%20proofConfig.type%20is%20not%20set%20to%20DataIntegrityProof%20and/or%20proofConfig.cryptosuite%20is%20not%20set%20to%20ecdsa%2Drdfc%2D2019%2C%20an%20error%20MUST%20be%20raised' ;
164- await assertions . verificationFail ( {
165- verifier,
166- credentials : credentials . get ( 'noTypeOrCryptosuite' ) ,
167- reason : 'Should not verify VC w/ no type or cryptosuite identifier'
155+ it ( 'The proof options MUST contain a type identifier for the ' +
156+ 'cryptographic suite (type) and MUST contain a cryptosuite ' +
157+ 'identifier (cryptosuite).' , async function ( ) {
158+ this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#proof-configuration-ecdsa-rdfc-2019' ;
159+ await assertions . verificationFail ( {
160+ verifier,
161+ credentials : credentials . get ( 'noTypeOrCryptosuite' ) ,
162+ reason : 'Should not verify VC w/ no type or cryptosuite ' +
163+ 'identifier'
164+ } ) ;
168165 } ) ;
169- } ) ;
170- it ( 'If proofConfig.created is set and if the value is not a valid ' +
171- '[XMLSCHEMA11-2] datetime, an error MUST be raised' , async function ( ) {
172- this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#proof-configuration-ecdsa-rdfc-2019' ;
173- await assertions . verificationFail ( {
174- verifier,
175- credentials : credentials . get ( 'invalidCreated' ) ,
176- reason : 'Should not verify VC w/ invalid "proof.created"'
166+ it ( 'If proofConfig.type is not set to DataIntegrityProof and/or ' +
167+ 'proofConfig.cryptosuite is not set to ecdsa-rdfc-2019, an error ' +
168+ 'MUST be raised' , async function ( ) {
169+ this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#proof-configuration-ecdsa-rdfc-2019:~:text=If%20proofConfig.type%20is%20not%20set%20to%20DataIntegrityProof%20and/or%20proofConfig.cryptosuite%20is%20not%20set%20to%20ecdsa%2Drdfc%2D2019%2C%20an%20error%20MUST%20be%20raised' ;
170+ await assertions . verificationFail ( {
171+ verifier,
172+ credentials : credentials . get ( 'noTypeOrCryptosuite' ) ,
173+ reason : 'Should not verify VC w/ no type or cryptosuite ' +
174+ 'identifier'
175+ } ) ;
177176 } ) ;
178- } ) ;
179- it ( 'The proof options MUST contain a type identifier for the ' +
180- 'cryptographic suite (type) and MAY contain a cryptosuite ' +
181- 'identifier (cryptosuite).' , async function ( ) {
182- this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#proof-serialization-ecdsa-rdfc-2019' ;
183- await assertions . verificationFail ( {
184- verifier,
185- credentials : credentials . get ( 'noTypeOrCryptosuite' ) ,
186- reason : 'Should not verify VC w/ no type or cryptosuite identifier'
177+ it ( 'If proofConfig.created is set and if the value is not a valid ' +
178+ '[XMLSCHEMA11-2] datetime, an error MUST be raised' ,
179+ async function ( ) {
180+ this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#proof-configuration-ecdsa-rdfc-2019' ;
181+ await assertions . verificationFail ( {
182+ verifier,
183+ credentials : credentials . get ( 'invalidCreated' ) ,
184+ reason : 'Should not verify VC w/ invalid "proof.created"'
185+ } ) ;
186+ } ) ;
187+ it ( 'The proof options MUST contain a type identifier for the ' +
188+ 'cryptographic suite (type) and MAY contain a cryptosuite ' +
189+ 'identifier (cryptosuite).' , async function ( ) {
190+ this . test . link = 'https://w3c.github.io/vc-di-ecdsa/#proof-serialization-ecdsa-rdfc-2019' ;
191+ await assertions . verificationFail ( {
192+ verifier,
193+ credentials : credentials . get ( 'noTypeOrCryptosuite' ) ,
194+ reason : 'Should not verify VC w/ no type or cryptosuite ' +
195+ 'identifier'
196+ } ) ;
187197 } ) ;
188198 } ) ;
189- } ) ;
199+
200+ }
190201 }
191202 } ) ;
192203}
0 commit comments