|
4 | 4 | */ |
5 | 5 | import { |
6 | 6 | assertAllUtf8, |
7 | | - // assertCryptosuiteProof, |
| 7 | + assertCryptosuiteProof, |
8 | 8 | assertDataIntegrityProof |
9 | 9 | } from './assertions.js'; |
10 | 10 | import { |
11 | 11 | encodeSdDerivedProofValue, |
12 | 12 | generateCredential, |
13 | 13 | inspectSdBaseProofValue, |
14 | 14 | inspectSdDerivedProofValue, |
15 | | - // isValidDatetime, |
| 15 | + isValidDatetime, |
16 | 16 | proofExists, |
17 | 17 | secureCredential, |
18 | 18 | setupReportableTestSuite, |
@@ -139,56 +139,56 @@ describe('Algorithms - Base Proof Transformation (ecdsa-sd-2023)', function() { |
139 | 139 | } |
140 | 140 | }); |
141 | 141 |
|
142 | | -// TODO, these tests are not appearing in the report so commenting out |
143 | | -// describe('Algorithms - Base Proof Configuration (ecdsa-sd-2023)', |
144 | | -// function() { |
145 | | -// setupReportableTestSuite(this); |
146 | | -// this.implemented = [...issuers.keys()]; |
147 | | -// for(const [columnId, {endpoints}] of issuers) { |
148 | | -// describe(columnId, function() { |
149 | | -// const [issuer] = endpoints; |
150 | | -// let securedCredential; |
151 | | -// before(async function() { |
152 | | -// const mandatoryPointers = ['/credentialSubject/name']; |
153 | | -// securedCredential = await secureCredential( |
154 | | -// {issuer, vc: generateCredential(), mandatoryPointers}); |
155 | | -// }); |
156 | | -// it('The proof options MUST contain a type identifier for the ' + |
157 | | -// 'cryptographic suite (type) and MUST contain a cryptosuite ' + |
158 | | -// 'identifier (cryptosuite).', |
159 | | -// async function() { |
160 | | -// this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-sd-2023'; |
161 | | -// const proof = proofExists(securedCredential); |
162 | | -// should.exist(proof.type, |
163 | | -// 'Expected a type identifier on the proof.'); |
164 | | -// should.exist(proof.cryptosuite, |
165 | | -// 'Expected a cryptosuite identifier on the proof.'); |
166 | | -// }); |
167 | | -// it('If proofConfig.type is not set to DataIntegrityProof and/or ' + |
168 | | -// 'proofConfig.cryptosuite is not set to ecdsa-sd-2023, ' + |
169 | | -// 'an error MUST be raised and SHOULD convey an error type of ' + |
170 | | -// 'PROOF_GENERATION_ERROR.', |
171 | | -// async function() { |
172 | | -// this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-sd-2023'; |
173 | | -// const proof = proofExists(securedCredential); |
174 | | -// assertCryptosuiteProof(proof, 'ecdsa-sd-2023'); |
175 | | -// }); |
176 | | -// it('If proofConfig.created is set and if the value is not a ' + |
177 | | -// 'valid [XMLSCHEMA11-2] datetime, an error MUST be raised and ' + |
178 | | -// 'SHOULD convey an error type of PROOF_GENERATION_ERROR.', |
179 | | -// async function() { |
180 | | -// this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-sd-2023'; |
181 | | -// const proof = proofExists(securedCredential); |
182 | | -// if(proof?.created) { |
183 | | -// isValidDatetime(proof.created).should.equal( |
184 | | -// true, |
185 | | -// 'Expected created value to be a valid datetime string.' |
186 | | -// ); |
187 | | -// } |
188 | | -// }); |
189 | | -// }); |
190 | | -// } |
191 | | -// }); |
| 142 | +describe('Algorithms - Base Proof Configuration', |
| 143 | + function() { |
| 144 | + setupReportableTestSuite(this); |
| 145 | + this.implemented = [...issuers.keys()]; |
| 146 | + for(const [columnId, {endpoints}] of issuers) { |
| 147 | + describe(columnId, function() { |
| 148 | + const [issuer] = endpoints; |
| 149 | + let securedCredential; |
| 150 | + before(async function() { |
| 151 | + const mandatoryPointers = ['/credentialSubject/name']; |
| 152 | + securedCredential = await secureCredential( |
| 153 | + {issuer, vc: generateCredential(), mandatoryPointers}); |
| 154 | + }); |
| 155 | + beforeEach(setupRow); |
| 156 | + it('The proof options MUST contain a type identifier for the ' + |
| 157 | + 'cryptographic suite (type) and MUST contain a cryptosuite ' + |
| 158 | + 'identifier (cryptosuite).', |
| 159 | + async function() { |
| 160 | + this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-sd-2023'; |
| 161 | + const proof = proofExists(securedCredential); |
| 162 | + should.exist(proof.type, |
| 163 | + 'Expected a type identifier on the proof.'); |
| 164 | + should.exist(proof.cryptosuite, |
| 165 | + 'Expected a cryptosuite identifier on the proof.'); |
| 166 | + }); |
| 167 | + it('If proofConfig.type is not set to DataIntegrityProof and/or ' + |
| 168 | + 'proofConfig.cryptosuite is not set to ecdsa-sd-2023, ' + |
| 169 | + 'an error MUST be raised and SHOULD convey an error type of ' + |
| 170 | + 'PROOF_GENERATION_ERROR.', |
| 171 | + async function() { |
| 172 | + this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-sd-2023'; |
| 173 | + const proof = proofExists(securedCredential); |
| 174 | + assertCryptosuiteProof(proof, 'ecdsa-sd-2023'); |
| 175 | + }); |
| 176 | + it('If proofConfig.created is set and if the value is not a ' + |
| 177 | + 'valid [XMLSCHEMA11-2] datetime, an error MUST be raised and ' + |
| 178 | + 'SHOULD convey an error type of PROOF_GENERATION_ERROR.', |
| 179 | + async function() { |
| 180 | + this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-sd-2023'; |
| 181 | + const proof = proofExists(securedCredential); |
| 182 | + if(proof?.created) { |
| 183 | + isValidDatetime(proof.created).should.equal( |
| 184 | + true, |
| 185 | + 'Expected created value to be a valid datetime string.' |
| 186 | + ); |
| 187 | + } |
| 188 | + }); |
| 189 | + }); |
| 190 | + } |
| 191 | + }); |
192 | 192 |
|
193 | 193 | describe('Algorithms - Base Proof Serialization (ecdsa-sd-2023)', function() { |
194 | 194 | setupReportableTestSuite(this); |
|
0 commit comments