|
8 | 8 | issueCloned |
9 | 9 | } from 'data-integrity-test-suite-assertion'; |
10 | 10 | import { |
| 11 | + shouldBeBaseProofValue, |
11 | 12 | shouldBeBs64UrlNoPad, |
12 | 13 | shouldHaveHeaderBytes, |
13 | 14 | } from '../assertions.js'; |
@@ -93,38 +94,8 @@ export function sd2023Algorithms({ |
93 | 94 | 'specific cryptosuite proof generation algorithm.', async function() { |
94 | 95 | this.test.link = 'https://w3c.github.io/vc-di-ecdsa/#base-proof-serialization-ecdsa-sd-2023:~:text=When%20generating%20ECDSA%20signatures%2C%20the%20signature%20value%20MUST%20be%20expressed%20according%20to%20section%207'; |
95 | 96 | assertIssuer(); |
96 | | - const _proof = proofs.find(p => |
97 | | - p?.cryptosuite === 'ecdsa-sd-2023'); |
98 | | - expect( |
99 | | - _proof, |
100 | | - `Expected VC from issuer ${name} to have an ' + |
101 | | - '"ecdsa-sd-2023" proof`).to.exist; |
102 | | - expect( |
103 | | - _proof.proofValue, |
104 | | - `Expected VC from issuer ${name} to have a ' + |
105 | | - '"proof.proofValue"` |
106 | | - ).to.exist; |
107 | | - expect( |
108 | | - _proof.proofValue, |
109 | | - `Expected VC "proof.proofValue" from issuer ${name} to be ` + |
110 | | - 'a string.' |
111 | | - ).to.be.a.string; |
112 | | - //Ensure the proofValue string starts with u, indicating that it |
113 | | - //is a multibase-base64url-no-pad-encoded value, throwing an |
114 | | - //error if it does not. |
115 | | - expect( |
116 | | - _proof.proofValue.startsWith('u'), |
117 | | - `Expected "proof.proofValue" to start with u received ` + |
118 | | - `${_proof.proofValue[0]}`).to.be.true; |
119 | | - // now test the encoding which is bs64 url no pad for this suite |
120 | | - expect( |
121 | | - shouldBeBs64UrlNoPad(_proof.proofValue), |
122 | | - 'Expected "proof.proofValue" to be bs64 url no pad encoded.' |
123 | | - ).to.be.true; |
124 | | - await shouldHaveHeaderBytes( |
125 | | - _proof.proofValue, |
126 | | - new Uint8Array([0xd9, 0x5d, 0x00]) |
127 | | - ); |
| 97 | + const proof = proofs.find(p => p?.cryptosuite === 'ecdsa-sd-2023'); |
| 98 | + await shouldBeBaseProofValue({proof, name}); |
128 | 99 | }); |
129 | 100 | it('If source has an id that is not a blank node identifier, set ' + |
130 | 101 | 'selection.id to its value. Note: All non-blank node identifiers ' + |
@@ -184,9 +155,9 @@ export function sd2023Algorithms({ |
184 | 155 | 'raised and SHOULD convey an error type of PROOF_VERIFICATION_ERROR.', |
185 | 156 | async function() { |
186 | 157 | this.test.link = 'https://w3c.github.io/vc-di-ecdsa/#selective-disclosure-functions:~:text=If%20the%20decodedProofValue%20does%20not%20start%20with%20the%20ECDSA%2DSD%20base%20proof%20header%20bytes%200xd9%2C%200x5d%2C%20and%200x00%2C%20an%20error%20MUST%20be%20raised%20and%20SHOULD%20convey%20an%20error%20type%20of%20PROOF_VERIFICATION_ERROR.'; |
187 | | - this.test.cell.skipMessage = 'Not Implemented'; |
188 | | - this.skip(); |
189 | 158 | assertIssuer(); |
| 159 | + const proof = proofs.find(p => p?.cryptosuite === 'ecdsa-sd-2023'); |
| 160 | + await shouldBeBaseProofValue({proof, name}); |
190 | 161 | }); |
191 | 162 | it('If the decodedProofValue does not start with the ECDSA-SD ' + |
192 | 163 | 'disclosure proof header bytes 0xd9, 0x5d, and 0x01, an error ' + |
|
0 commit comments