@@ -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 } ) ;
@@ -128,12 +132,12 @@ describe('Algorithms - Transformation (ecdsa-jcs-2019)', function() {
128132 } ) ;
129133 beforeEach ( setupRow ) ;
130134 it ( 'The transformation options MUST contain a type identifier ' +
131- 'for the cryptographic suite (type) and a cryptosuite identifier ' +
132- '(cryptosuite).' ,
135+ 'for the cryptographic suite (type) and a cryptosuite identifier ' +
136+ '(cryptosuite).' ,
133137 async function ( ) {
134138 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-jcs-2019' ;
135- should . exist ( proof . type , 'Expected a type identifier on ' +
136- ' the proof.') ;
139+ should . exist ( proof . type ,
140+ 'Expected a type identifier on the proof.') ;
137141 should . exist ( proof . cryptosuite ,
138142 'Expected a cryptosuite identifier on the proof.' ) ;
139143 } ) ;
@@ -187,9 +191,9 @@ describe('Algorithms - Proof Configuration (ecdsa-jcs-2019)', function() {
187191 'Expected a cryptosuite identifier on the proof.' ) ;
188192 } ) ;
189193 it ( 'If proofConfig.type is not set to DataIntegrityProof ' +
190- 'and/or proofConfig.cryptosuite is not set to ecdsa-jcs-2019, ' +
191- 'an error MUST be raised and SHOULD convey an error type ' +
192- 'of PROOF_GENERATION_ERROR.' ,
194+ 'and/or proofConfig.cryptosuite is not set to ecdsa-jcs-2019, ' +
195+ 'an error MUST be raised and SHOULD convey an error type ' +
196+ 'of PROOF_GENERATION_ERROR.' ,
193197 async function ( ) {
194198 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-jcs-2019' ;
195199 should . exist ( proof . type ,
@@ -202,8 +206,8 @@ describe('Algorithms - Proof Configuration (ecdsa-jcs-2019)', function() {
202206 'Expected ecdsa-jcs-2019 cryptosuite.' ) ;
203207 } ) ;
204208 it ( 'If proofConfig.created is set and if the value is not a ' +
205- 'valid [XMLSCHEMA11-2] datetime, an error MUST be raised and ' +
206- 'SHOULD convey an error type of PROOF_GENERATION_ERROR.' ,
209+ 'valid [XMLSCHEMA11-2] datetime, an error MUST be raised and ' +
210+ 'SHOULD convey an error type of PROOF_GENERATION_ERROR.' ,
207211 async function ( ) {
208212 this . test . link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-jcs-2019' ;
209213 if ( proof ?. created ) {
0 commit comments