@@ -14,7 +14,7 @@ import {
1414 secureCredential ,
1515 setupReportableTestSuite ,
1616 setupRow ,
17- verifyFail ,
17+ verifyError ,
1818 verifySuccess
1919} from './helpers.js' ;
2020import canonicalize from 'json-canon' ;
@@ -53,21 +53,20 @@ describe('Algorithms - Create Proof (ecdsa-jcs-2019)', function() {
5353 proof = getProofs ( securedCredential ) [ 0 ] ;
5454 } ) ;
5555 beforeEach ( setupRow ) ;
56- it ( 'The following algorithm specifies how to create a ' +
57- 'data integrity proof given an unsecured data document. ' +
58- 'Required inputs are an unsecured data document ' +
59- '(map unsecuredDocument), and a set of proof options ' +
60- '(map options). A data integrity proof (map), or an error, ' +
61- 'is produced as output.' ,
62- async function ( ) {
63- this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#create-proof-ecdsa-jcs-2019' ;
64- assertSecuredCredential ( securedCredential ) ;
65- assertDataIntegrityProof ( proof , 'ecdsa-jcs-2019' ) ;
66- } ) ;
56+ it ( 'A data integrity proof (map), or an error, is produced as output.' ,
57+ async function ( ) {
58+ this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#create-proof-ecdsa-jcs-2019' ;
59+ assertSecuredCredential ( securedCredential ) ;
60+ assertDataIntegrityProof ( proof , 'ecdsa-jcs-2019' ) ;
61+ // Since we are not sending proof options, we only do a positive test
62+ } ) ;
6763 it ( 'If unsecuredDocument.@context is present, ' +
6864 'set proof.@context to unsecuredDocument.@context.' ,
6965 async function ( ) {
7066 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#create-proof-ecdsa-jcs-2019' ;
67+ // NOTE, for backwards compatibility reason, this step is not mandatory
68+ // This feature is designed to be used with proof sets/chains,
69+ // when adding new context in subsequent proofs
7170 should . exist ( proof [ '@context' ] ,
7271 'Expected proof to have context.' ) ;
7372 canonicalize ( proof [ '@context' ] ) . should . equal (
@@ -79,6 +78,8 @@ describe('Algorithms - Create Proof (ecdsa-jcs-2019)', function() {
7978 'Multibase value of the proofBytes.' ,
8079 async function ( ) {
8180 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#create-proof-ecdsa-jcs-2019' ;
81+ // Shallow multibase test
82+ // TODO try decoding
8283 should . exist ( proof . proofValue ,
8384 'Expected proof to have proofValue.' ) ;
8485 expect ( proof . proofValue . startsWith ( 'z' ) ) . to . be . true ;
@@ -100,13 +101,16 @@ describe('Algorithms - Verify Proof (ecdsa-jcs-2019)', function() {
100101 async function ( ) {
101102 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#verify-proof-ecdsa-rdfc-2019' ;
102103 for ( const curve of verifier . settings . supportedEcdsaKeyTypes ) {
104+ // Send a valid VC and an invalid VC to the verifier
105+ // Check for success/error on response
103106 const testVector = structuredClone ( ecdsaJcsVectors [ curve ] ) ;
104107 await verifySuccess ( verifier , testVector ) ;
105108
106109 // Slice the proof
107110 testVector . proof . proofValue =
108111 testVector . proof . proofValue . slice ( 0 , - 1 ) ;
109- await verifyFail ( verifier , testVector ) ;
112+ await verifyError ( verifier , testVector ) ;
113+ // TODO, create a verifyProblemDetails function
110114 }
111115 } ) ;
112116 } ) ;
@@ -136,12 +140,12 @@ describe('Algorithms - Transformation', function() {
136140 'Expected a type identifier on the proof.' ) ;
137141 } ) ;
138142 it ( 'The transformation options MUST contain a type identifier ' +
139- 'for the cryptographic suite (type) and a cryptosuite identifier ' +
140- '(cryptosuite).' ,
143+ 'for the cryptographic suite (type) and a cryptosuite identifier ' +
144+ '(cryptosuite).' ,
141145 async function ( ) {
142146 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-jcs-2019' ;
143- should . exist ( proof . type , 'Expected a type identifier on ' +
144- ' the proof.') ;
147+ should . exist ( proof . type ,
148+ 'Expected a type identifier on the proof.') ;
145149 should . exist ( proof . cryptosuite ,
146150 'Expected a cryptosuite identifier on the proof.' ) ;
147151 } ) ;
@@ -195,9 +199,9 @@ describe('ecdsa-jcs-2019 - Algorithms - Proof Configuration', function() {
195199 'Expected a cryptosuite identifier on the proof.' ) ;
196200 } ) ;
197201 it ( 'If proofConfig.type is not set to DataIntegrityProof ' +
198- 'and/or proofConfig.cryptosuite is not set to ecdsa-jcs-2019, ' +
199- 'an error MUST be raised and SHOULD convey an error type ' +
200- 'of PROOF_GENERATION_ERROR.' ,
202+ 'and/or proofConfig.cryptosuite is not set to ecdsa-jcs-2019, ' +
203+ 'an error MUST be raised and SHOULD convey an error type ' +
204+ 'of PROOF_GENERATION_ERROR.' ,
201205 async function ( ) {
202206 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-jcs-2019' ;
203207 should . exist ( proof . type ,
@@ -210,8 +214,8 @@ describe('ecdsa-jcs-2019 - Algorithms - Proof Configuration', function() {
210214 'Expected ecdsa-jcs-2019 cryptosuite.' ) ;
211215 } ) ;
212216 it ( 'If proofConfig.created is set and if the value is not a ' +
213- 'valid [XMLSCHEMA11-2] datetime, an error MUST be raised and ' +
214- 'SHOULD convey an error type of PROOF_GENERATION_ERROR.' ,
217+ 'valid [XMLSCHEMA11-2] datetime, an error MUST be raised and ' +
218+ 'SHOULD convey an error type of PROOF_GENERATION_ERROR.' ,
215219 async function ( ) {
216220 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-jcs-2019' ;
217221 if ( proof ?. created ) {
0 commit comments