Skip to content

Commit 8a4ce97

Browse files
committed
add proof serialization section
Signed-off-by: PatStLouis <[email protected]>
1 parent 13d0011 commit 8a4ce97

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/90-algorithms-jcs.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,48 @@ describe('ecdsa-jcs-2019 - Algorithms - Proof Configuration', function() {
192192
});
193193
}
194194
});
195+
196+
describe('ecdsa-jcs-2019 - Algorithms - Proof Serialization', function() {
197+
setupReportableTestSuite(this);
198+
this.implemented = [...issuers.keys()];
199+
let validCredential;
200+
before(async function() {
201+
validCredential = await createValidCredential();
202+
});
203+
for(const [columnId, {endpoints}] of issuers) {
204+
describe(columnId, function() {
205+
const [issuer] = endpoints;
206+
let issuedVc;
207+
let proofs;
208+
let jcs2019Proofs = [];
209+
before(async function() {
210+
issuedVc = await createInitialVc({issuer, vc: validCredential});
211+
proofs = getProofs(issuedVc);
212+
if(proofs?.length) {
213+
jcs2019Proofs = proofs.filter(
214+
proof => proof?.cryptosuite === cryptosuite);
215+
}
216+
});
217+
beforeEach(setupRow);
218+
const assertBefore = () => {
219+
should.exist(issuedVc, 'Expected issuer to have issued a ' +
220+
'credential.');
221+
should.exist(proofs, 'Expected credential to have a proof.');
222+
jcs2019Proofs.length.should.be.gte(1, 'Expected at least one ' +
223+
'ecdsa-jcs-2019 cryptosuite.');
224+
};
225+
it('The proof options MUST contain a type identifier for the ' +
226+
'cryptographic suite (type) and MAY contain a cryptosuite identifier ' +
227+
'(cryptosuite).',
228+
async function() {
229+
this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-serialization-ecdsa-jcs-2019';
230+
assertBefore();
231+
for(const proof of jcs2019Proofs) {
232+
should.exist(proof.type,
233+
'Expected a type identifier on the proof.');
234+
}
235+
});
236+
});
237+
}
238+
});
239+

0 commit comments

Comments
 (0)