44 */
55import {
66 assertAllUtf8 ,
7- assertDataIntegrityProof ,
8- assertSecuredCredential
7+ assertDataIntegrityProof
98} from './assertions.js' ;
109import {
1110 generateCredential ,
12- getProofs ,
1311 isValidDatetime ,
1412 proofExists ,
1513 secureCredential ,
@@ -47,18 +45,15 @@ describe('Algorithms - Create Proof (ecdsa-jcs-2019)', function() {
4745 describe ( columnId , function ( ) {
4846 const [ issuer ] = endpoints ;
4947 let securedCredential ;
50- let proofs ;
5148 before ( async function ( ) {
5249 securedCredential = await secureCredential (
5350 { issuer, vc : generateCredential ( ) } ) ;
54- proofs = getProofs ( securedCredential ) ;
5551 } ) ;
5652 beforeEach ( setupRow ) ;
5753 it ( 'A data integrity proof (map), or an error, is produced as output.' ,
5854 async function ( ) {
5955 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#create-proof-ecdsa-jcs-2019' ;
60- assertSecuredCredential ( securedCredential ) ;
61- const proof = proofExists ( proofs ) ;
56+ const proof = proofExists ( securedCredential ) ;
6257 assertDataIntegrityProof ( proof , 'ecdsa-jcs-2019' ) ;
6358 // Since we are not sending proof options, we only do a positive test
6459 } ) ;
@@ -69,7 +64,7 @@ describe('Algorithms - Create Proof (ecdsa-jcs-2019)', function() {
6964 // NOTE, for backwards compatibility reason, this step is not mandatory
7065 // This feature is designed to be used with proof sets/chains,
7166 // when adding new context in subsequent proofs
72- const proof = proofExists ( proofs ) ;
67+ const proof = proofExists ( securedCredential ) ;
7368 should . exist ( proof [ '@context' ] ,
7469 'Expected proof to have context.' ) ;
7570 canonicalize ( proof [ '@context' ] ) . should . equal (
@@ -83,7 +78,7 @@ describe('Algorithms - Create Proof (ecdsa-jcs-2019)', function() {
8378 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#create-proof-ecdsa-jcs-2019' ;
8479 // Shallow multibase test
8580 // TODO try decoding
86- const proof = proofExists ( proofs ) ;
81+ const proof = proofExists ( securedCredential ) ;
8782 should . exist ( proof . proofValue ,
8883 'Expected proof to have proofValue.' ) ;
8984 expect ( proof . proofValue . startsWith ( 'z' ) ) . to . be . true ;
@@ -128,19 +123,17 @@ describe('Algorithms - Transformation (ecdsa-jcs-2019)', function() {
128123 describe ( columnId , function ( ) {
129124 const [ issuer ] = endpoints ;
130125 let securedCredential ;
131- let proofs ;
132126 before ( async function ( ) {
133127 securedCredential = await secureCredential (
134128 { issuer, vc : generateCredential ( ) } ) ;
135- proofs = getProofs ( securedCredential ) ;
136129 } ) ;
137130 beforeEach ( setupRow ) ;
138131 it ( 'The transformation options MUST contain a type identifier ' +
139132 'for the cryptographic suite (type) and a cryptosuite identifier ' +
140133 '(cryptosuite).' ,
141134 async function ( ) {
142135 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-jcs-2019' ;
143- const proof = proofExists ( proofs ) ;
136+ const proof = proofExists ( securedCredential ) ;
144137 should . exist ( proof . type ,
145138 'Expected a type identifier on the proof.' ) ;
146139 should . exist ( proof . cryptosuite ,
@@ -150,7 +143,7 @@ describe('Algorithms - Transformation (ecdsa-jcs-2019)', function() {
150143 'it MUST use UTF-8 encoding.' ,
151144 async function ( ) {
152145 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-jcs-2019' ;
153- const proof = proofExists ( proofs ) ;
146+ const proof = proofExists ( securedCredential ) ;
154147 assertAllUtf8 ( proof ) ;
155148 } ) ;
156149 it ( 'If options.type is not set to the string DataIntegrityProof or ' +
@@ -159,7 +152,7 @@ describe('Algorithms - Transformation (ecdsa-jcs-2019)', function() {
159152 'of PROOF_TRANSFORMATION_ERROR.' ,
160153 async function ( ) {
161154 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-jcs-2019' ;
162- const proof = proofExists ( proofs ) ;
155+ const proof = proofExists ( securedCredential ) ;
163156 should . exist ( proof . type ,
164157 'Expected a type identifier on the proof.' ) ;
165158 should . exist ( proof . cryptosuite ,
@@ -180,19 +173,17 @@ describe('Algorithms - Proof Configuration (ecdsa-jcs-2019)', function() {
180173 describe ( columnId , function ( ) {
181174 const [ issuer ] = endpoints ;
182175 let securedCredential ;
183- let proofs ;
184176 before ( async function ( ) {
185177 securedCredential = await secureCredential (
186178 { issuer, vc : generateCredential ( ) } ) ;
187- proofs = getProofs ( securedCredential ) ;
188179 } ) ;
189180 beforeEach ( setupRow ) ;
190181 it ( 'The proof options MUST contain a type identifier for the ' +
191182 'cryptographic suite (type) and MUST contain a cryptosuite ' +
192183 'identifier (cryptosuite).' ,
193184 async function ( ) {
194185 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-jcs-2019' ;
195- const proof = proofExists ( proofs ) ;
186+ const proof = proofExists ( securedCredential ) ;
196187 should . exist ( proof . type ,
197188 'Expected a type identifier on the proof.' ) ;
198189 should . exist ( proof . cryptosuite ,
@@ -204,7 +195,7 @@ describe('Algorithms - Proof Configuration (ecdsa-jcs-2019)', function() {
204195 'of PROOF_GENERATION_ERROR.' ,
205196 async function ( ) {
206197 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-jcs-2019' ;
207- const proof = proofExists ( proofs ) ;
198+ const proof = proofExists ( securedCredential ) ;
208199 should . exist ( proof . type ,
209200 'Expected a type identifier on the proof.' ) ;
210201 should . exist ( proof . cryptosuite ,
@@ -219,7 +210,7 @@ describe('Algorithms - Proof Configuration (ecdsa-jcs-2019)', function() {
219210 'SHOULD convey an error type of PROOF_GENERATION_ERROR.' ,
220211 async function ( ) {
221212 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-jcs-2019' ;
222- const proof = proofExists ( proofs ) ;
213+ const proof = proofExists ( securedCredential ) ;
223214 if ( proof ?. created ) {
224215 isValidDatetime ( proof . created ) . should . equal (
225216 true ,
@@ -238,19 +229,17 @@ describe('Algorithms - Proof Serialization (ecdsa-jcs-2019)', function() {
238229 describe ( columnId , function ( ) {
239230 const [ issuer ] = endpoints ;
240231 let securedCredential ;
241- let proofs ;
242232 before ( async function ( ) {
243233 securedCredential = await secureCredential (
244234 { issuer, vc : generateCredential ( ) } ) ;
245- proofs = getProofs ( securedCredential ) ;
246235 } ) ;
247236 beforeEach ( setupRow ) ;
248237 it ( 'The proof options MUST contain a type identifier for the ' +
249238 'cryptographic suite (type) and MAY contain a cryptosuite identifier ' +
250239 '(cryptosuite).' ,
251240 async function ( ) {
252241 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-serialization-ecdsa-jcs-2019' ;
253- const proof = proofExists ( proofs ) ;
242+ const proof = proofExists ( securedCredential ) ;
254243 should . exist ( proof . type ,
255244 'Expected a type identifier on the proof.' ) ;
256245 } ) ;
0 commit comments