@@ -11,6 +11,7 @@ import {
1111 generateCredential ,
1212 getProofs ,
1313 isValidDatetime ,
14+ proofExists ,
1415 secureCredential ,
1516 setupReportableTestSuite ,
1617 setupRow ,
@@ -46,17 +47,18 @@ describe('Algorithms - Create Proof (ecdsa-jcs-2019)', function() {
4647 describe ( columnId , function ( ) {
4748 const [ issuer ] = endpoints ;
4849 let securedCredential ;
49- let proof ;
50+ let proofs ;
5051 before ( async function ( ) {
5152 securedCredential = await secureCredential (
5253 { issuer, vc : generateCredential ( ) } ) ;
53- proof = getProofs ( securedCredential ) [ 0 ] ;
54+ proofs = getProofs ( securedCredential ) ;
5455 } ) ;
5556 beforeEach ( setupRow ) ;
5657 it ( 'A data integrity proof (map), or an error, is produced as output.' ,
5758 async function ( ) {
5859 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#create-proof-ecdsa-jcs-2019' ;
5960 assertSecuredCredential ( securedCredential ) ;
61+ const proof = proofExists ( proofs ) ;
6062 assertDataIntegrityProof ( proof , 'ecdsa-jcs-2019' ) ;
6163 // Since we are not sending proof options, we only do a positive test
6264 } ) ;
@@ -67,6 +69,7 @@ describe('Algorithms - Create Proof (ecdsa-jcs-2019)', function() {
6769 // NOTE, for backwards compatibility reason, this step is not mandatory
6870 // This feature is designed to be used with proof sets/chains,
6971 // when adding new context in subsequent proofs
72+ const proof = proofExists ( proofs ) ;
7073 should . exist ( proof [ '@context' ] ,
7174 'Expected proof to have context.' ) ;
7275 canonicalize ( proof [ '@context' ] ) . should . equal (
@@ -80,6 +83,7 @@ describe('Algorithms - Create Proof (ecdsa-jcs-2019)', function() {
8083 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#create-proof-ecdsa-jcs-2019' ;
8184 // Shallow multibase test
8285 // TODO try decoding
86+ const proof = proofExists ( proofs ) ;
8387 should . exist ( proof . proofValue ,
8488 'Expected proof to have proofValue.' ) ;
8589 expect ( proof . proofValue . startsWith ( 'z' ) ) . to . be . true ;
@@ -124,18 +128,19 @@ describe('Algorithms - Transformation (ecdsa-jcs-2019)', function() {
124128 describe ( columnId , function ( ) {
125129 const [ issuer ] = endpoints ;
126130 let securedCredential ;
127- let proof ;
131+ let proofs ;
128132 before ( async function ( ) {
129133 securedCredential = await secureCredential (
130134 { issuer, vc : generateCredential ( ) } ) ;
131- proof = getProofs ( securedCredential ) [ 0 ] ;
135+ proofs = getProofs ( securedCredential ) ;
132136 } ) ;
133137 beforeEach ( setupRow ) ;
134138 it ( 'The transformation options MUST contain a type identifier ' +
135139 'for the cryptographic suite (type) and a cryptosuite identifier ' +
136140 '(cryptosuite).' ,
137141 async function ( ) {
138142 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-jcs-2019' ;
143+ const proof = proofExists ( proofs ) ;
139144 should . exist ( proof . type ,
140145 'Expected a type identifier on the proof.' ) ;
141146 should . exist ( proof . cryptosuite ,
@@ -145,6 +150,7 @@ describe('Algorithms - Transformation (ecdsa-jcs-2019)', function() {
145150 'it MUST use UTF-8 encoding.' ,
146151 async function ( ) {
147152 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-jcs-2019' ;
153+ const proof = proofExists ( proofs ) ;
148154 assertAllUtf8 ( proof ) ;
149155 } ) ;
150156 it ( 'If options.type is not set to the string DataIntegrityProof or ' +
@@ -153,6 +159,7 @@ describe('Algorithms - Transformation (ecdsa-jcs-2019)', function() {
153159 'of PROOF_TRANSFORMATION_ERROR.' ,
154160 async function ( ) {
155161 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-jcs-2019' ;
162+ const proof = proofExists ( proofs ) ;
156163 should . exist ( proof . type ,
157164 'Expected a type identifier on the proof.' ) ;
158165 should . exist ( proof . cryptosuite ,
@@ -173,18 +180,19 @@ describe('Algorithms - Proof Configuration (ecdsa-jcs-2019)', function() {
173180 describe ( columnId , function ( ) {
174181 const [ issuer ] = endpoints ;
175182 let securedCredential ;
176- let proof ;
183+ let proofs ;
177184 before ( async function ( ) {
178185 securedCredential = await secureCredential (
179186 { issuer, vc : generateCredential ( ) } ) ;
180- proof = getProofs ( securedCredential ) [ 0 ] ;
187+ proofs = getProofs ( securedCredential ) ;
181188 } ) ;
182189 beforeEach ( setupRow ) ;
183190 it ( 'The proof options MUST contain a type identifier for the ' +
184191 'cryptographic suite (type) and MUST contain a cryptosuite ' +
185192 'identifier (cryptosuite).' ,
186193 async function ( ) {
187194 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-jcs-2019' ;
195+ const proof = proofExists ( proofs ) ;
188196 should . exist ( proof . type ,
189197 'Expected a type identifier on the proof.' ) ;
190198 should . exist ( proof . cryptosuite ,
@@ -196,6 +204,7 @@ describe('Algorithms - Proof Configuration (ecdsa-jcs-2019)', function() {
196204 'of PROOF_GENERATION_ERROR.' ,
197205 async function ( ) {
198206 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-jcs-2019' ;
207+ const proof = proofExists ( proofs ) ;
199208 should . exist ( proof . type ,
200209 'Expected a type identifier on the proof.' ) ;
201210 should . exist ( proof . cryptosuite ,
@@ -210,6 +219,7 @@ describe('Algorithms - Proof Configuration (ecdsa-jcs-2019)', function() {
210219 'SHOULD convey an error type of PROOF_GENERATION_ERROR.' ,
211220 async function ( ) {
212221 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-jcs-2019' ;
222+ const proof = proofExists ( proofs ) ;
213223 if ( proof ?. created ) {
214224 isValidDatetime ( proof . created ) . should . equal (
215225 true ,
@@ -228,18 +238,19 @@ describe('Algorithms - Proof Serialization (ecdsa-jcs-2019)', function() {
228238 describe ( columnId , function ( ) {
229239 const [ issuer ] = endpoints ;
230240 let securedCredential ;
231- let proof ;
241+ let proofs ;
232242 before ( async function ( ) {
233243 securedCredential = await secureCredential (
234244 { issuer, vc : generateCredential ( ) } ) ;
235- proof = getProofs ( securedCredential ) [ 0 ] ;
245+ proofs = getProofs ( securedCredential ) ;
236246 } ) ;
237247 beforeEach ( setupRow ) ;
238248 it ( 'The proof options MUST contain a type identifier for the ' +
239249 'cryptographic suite (type) and MAY contain a cryptosuite identifier ' +
240250 '(cryptosuite).' ,
241251 async function ( ) {
242252 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-serialization-ecdsa-jcs-2019' ;
253+ const proof = proofExists ( proofs ) ;
243254 should . exist ( proof . type ,
244255 'Expected a type identifier on the proof.' ) ;
245256 } ) ;
0 commit comments