Skip to content

Commit 60ed0b6

Browse files
committed
Rebase with main
Signed-off-by: PatStLouis <[email protected]>
1 parent f2256c2 commit 60ed0b6

File tree

2 files changed

+1
-205
lines changed

2 files changed

+1
-205
lines changed

tests/90-algorithms-rdfc.js

Lines changed: 0 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,8 @@
55
import {
66
generateCredential,
77
isValidDatetime,
8-
<<<<<<< HEAD
98
proofExists,
109
secureCredential,
11-
=======
12-
<<<<<<< HEAD
13-
isValidUtf8,
14-
=======
15-
proofExists,
16-
secureCredential,
17-
>>>>>>> 265e798 (improve proof handling when asserting a secured credential)
18-
>>>>>>> ec4cd6a (improve proof handling when asserting a secured credential)
1910
setupReportableTestSuite,
2011
setupRow
2112
} from './helpers.js';
@@ -42,67 +33,27 @@ describe('Algorithms - Transformation (ecdsa-rdfc-2019)', function() {
4233
for(const [columnId, {endpoints}] of issuers) {
4334
describe(columnId, function() {
4435
const [issuer] = endpoints;
45-
<<<<<<< HEAD
4636
let securedCredential;
4737
before(async function() {
4838
securedCredential = await secureCredential(
4939
{issuer, vc: generateCredential()});
50-
=======
51-
<<<<<<< HEAD
52-
let issuedVc;
53-
let proofs;
54-
let rdfc2019Proofs = [];
55-
before(async function() {
56-
issuedVc = await createInitialVc({issuer, vc: validCredential});
57-
proofs = getProofs(issuedVc);
58-
if(proofs?.length) {
59-
rdfc2019Proofs = proofs.filter(
60-
proof => proof?.cryptosuite === cryptosuite);
61-
}
62-
=======
63-
let securedCredential;
64-
let proofs;
65-
before(async function() {
66-
securedCredential = await secureCredential(
67-
{issuer, vc: generateCredential()});
68-
proofs = getProofs(securedCredential);
69-
>>>>>>> 265e798 (improve proof handling when asserting a secured credential)
70-
>>>>>>> ec4cd6a (improve proof handling when asserting a secured credential)
7140
});
7241
beforeEach(setupRow);
7342
it('The transformation options MUST contain a type identifier ' +
7443
'for the cryptographic suite (type) and a cryptosuite identifier ' +
7544
'(cryptosuite).',
7645
async function() {
7746
this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019';
78-
<<<<<<< HEAD
7947
const proof = proofExists(securedCredential);
80-
=======
81-
<<<<<<< HEAD
82-
assertBefore();
83-
for(const proof of rdfc2019Proofs) {
84-
should.exist(proof.type, 'Expected a type identifier on ' +
85-
'the proof.');
86-
should.exist(proof.cryptosuite,
87-
'Expected a cryptosuite identifier on the proof.');
88-
}
89-
=======
90-
const proof = proofExists(proofs);
91-
>>>>>>> ec4cd6a (improve proof handling when asserting a secured credential)
9248
should.exist(proof.type,
9349
'Expected a type identifier on the proof.');
9450
should.exist(proof.cryptosuite,
9551
'Expected a cryptosuite identifier on the proof.');
96-
<<<<<<< HEAD
97-
=======
98-
>>>>>>> 265e798 (improve proof handling when asserting a secured credential)
99-
>>>>>>> ec4cd6a (improve proof handling when asserting a secured credential)
10052
});
10153
it('Whenever this algorithm encodes strings, ' +
10254
'it MUST use UTF-8 encoding.',
10355
async function() {
10456
this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019';
105-
<<<<<<< HEAD
10657
const proof = proofExists(securedCredential);
10758
assertAllUtf8(proof);
10859
});
@@ -173,113 +124,11 @@ describe('Algorithms - Proof Configuration (ecdsa-rdfc-2019)', function() {
173124
const proof = proofExists(securedCredential);
174125
if(proof?.created) {
175126
isValidDatetime(proof.created).should.equal(
176-
=======
177-
<<<<<<< HEAD
178-
assertBefore();
179-
for(const proof of rdfc2019Proofs) {
180-
should.exist(proof?.proofValue,
181-
'Expected proofValue to exist.');
182-
isValidUtf8(proof.proofValue).should.equal(
183-
>>>>>>> ec4cd6a (improve proof handling when asserting a secured credential)
184-
true,
185-
'Expected created value to be a valid datetime string.'
186-
);
187-
}
188-
=======
189-
const proof = proofExists(proofs);
190-
assertAllUtf8(proof);
191-
>>>>>>> 265e798 (improve proof handling when asserting a secured credential)
192-
});
193-
<<<<<<< HEAD
194-
=======
195-
it('If options.type is not set to the string DataIntegrityProof or ' +
196-
'options.cryptosuite is not set to the string ecdsa-rdfc-2019, ' +
197-
'an error MUST be raised and SHOULD convey an error type ' +
198-
'of PROOF_TRANSFORMATION_ERROR.',
199-
async function() {
200-
this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019';
201-
<<<<<<< HEAD
202-
assertBefore();
203-
for(const proof of rdfc2019Proofs) {
204-
should.exist(proof.type,
205-
'Expected a type identifier on the proof.');
206-
should.exist(proof.cryptosuite,
207-
'Expected a cryptosuite identifier on the proof.');
208-
proof.type.should.equal('DataIntegrityProof',
209-
'Expected DataIntegrityProof type.');
210-
proof.cryptosuite.should.equal('ecdsa-rdfc-2019',
211-
'Expected ecdsa-rdfc-2019 cryptosuite.');
212-
=======
213-
const proof = proofExists(proofs);
214-
should.exist(proof.type,
215-
'Expected a type identifier on the proof.');
216-
should.exist(proof.cryptosuite,
217-
'Expected a cryptosuite identifier on the proof.');
218-
proof.type.should.equal('DataIntegrityProof',
219-
'Expected DataIntegrityProof type.');
220-
proof.cryptosuite.should.equal('ecdsa-rdfc-2019',
221-
'Expected ecdsa-rdfc-2019 cryptosuite.');
222-
});
223-
});
224-
}
225-
});
226-
227-
describe('Algorithms - Proof Configuration (ecdsa-rdfc-2019)', function() {
228-
setupReportableTestSuite(this);
229-
this.implemented = [...issuers.keys()];
230-
for(const [columnId, {endpoints}] of issuers) {
231-
describe(columnId, function() {
232-
const [issuer] = endpoints;
233-
let securedCredential;
234-
let proofs;
235-
before(async function() {
236-
securedCredential = await secureCredential(
237-
{issuer, vc: generateCredential()});
238-
proofs = getProofs(securedCredential);
239-
});
240-
beforeEach(setupRow);
241-
it('The proof options MUST contain a type identifier for the ' +
242-
'cryptographic suite (type) and MUST contain a cryptosuite ' +
243-
'identifier (cryptosuite).',
244-
async function() {
245-
this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-rdfc-2019';
246-
const proof = proofExists(proofs);
247-
should.exist(proof.type,
248-
'Expected a type identifier on the proof.');
249-
should.exist(proof.cryptosuite,
250-
'Expected a cryptosuite identifier on the proof.');
251-
});
252-
it('If proofConfig.type is not set to DataIntegrityProof ' +
253-
'and/or proofConfig.cryptosuite is not set to ecdsa-rdfc-2019, ' +
254-
'an error MUST be raised and SHOULD convey an error type ' +
255-
'of PROOF_GENERATION_ERROR.',
256-
async function() {
257-
this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-rdfc-2019';
258-
const proof = proofExists(proofs);
259-
should.exist(proof.type,
260-
'Expected a type identifier on the proof.');
261-
should.exist(proof.cryptosuite,
262-
'Expected a cryptosuite identifier on the proof.');
263-
proof.type.should.equal('DataIntegrityProof',
264-
'Expected DataIntegrityProof type.');
265-
proof.cryptosuite.should.equal('ecdsa-rdfc-2019',
266-
'Expected ecdsa-rdfc-2019 cryptosuite.');
267-
});
268-
it('If proofConfig.created is set and if the value is not a ' +
269-
'valid [XMLSCHEMA11-2] datetime, an error MUST be raised and ' +
270-
'SHOULD convey an error type of PROOF_GENERATION_ERROR.',
271-
async function() {
272-
this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-configuration-ecdsa-rdfc-2019';
273-
const proof = proofExists(proofs);
274-
if(proof?.created) {
275-
isValidDatetime(proof.created).should.equal(
276127
true,
277128
'Expected created value to be a valid datetime string.'
278129
);
279-
>>>>>>> 265e798 (improve proof handling when asserting a secured credential)
280130
}
281131
});
282-
>>>>>>> ec4cd6a (improve proof handling when asserting a secured credential)
283132
});
284133
}
285134
});
@@ -290,56 +139,20 @@ describe('Algorithms - Proof Serialization (ecdsa-rdfc-2019)', function() {
290139
for(const [columnId, {endpoints}] of issuers) {
291140
describe(columnId, function() {
292141
const [issuer] = endpoints;
293-
<<<<<<< HEAD
294-
let securedCredential;
295-
before(async function() {
296-
securedCredential = await secureCredential(
297-
{issuer, vc: generateCredential()});
298-
=======
299-
<<<<<<< HEAD
300-
let issuedVc;
301-
let proofs;
302-
let rdfc2019Proofs = [];
303-
before(async function() {
304-
issuedVc = await createInitialVc({issuer, vc: validCredential});
305-
proofs = getProofs(issuedVc);
306-
if(proofs?.length) {
307-
rdfc2019Proofs = proofs.filter(
308-
proof => proof?.cryptosuite === cryptosuite);
309-
}
310-
=======
311142
let securedCredential;
312-
let proofs;
313143
before(async function() {
314144
securedCredential = await secureCredential(
315145
{issuer, vc: generateCredential()});
316-
proofs = getProofs(securedCredential);
317-
>>>>>>> 265e798 (improve proof handling when asserting a secured credential)
318-
>>>>>>> ec4cd6a (improve proof handling when asserting a secured credential)
319146
});
320147
beforeEach(setupRow);
321148
it('The proof options MUST contain a type identifier for the ' +
322149
'cryptographic suite (type) and MAY contain a cryptosuite identifier ' +
323150
'(cryptosuite).',
324151
async function() {
325152
this.test.link = 'https://www.w3.org/TR/vc-di-ecdsa/#proof-serialization-ecdsa-rdfc-2019';
326-
<<<<<<< HEAD
327153
const proof = proofExists(securedCredential);
328154
should.exist(proof.type,
329155
'Expected a type identifier on the proof.');
330-
=======
331-
<<<<<<< HEAD
332-
assertBefore();
333-
for(const proof of rdfc2019Proofs) {
334-
should.exist(proof.type,
335-
'Expected a type identifier on the proof.');
336-
}
337-
=======
338-
const proof = proofExists(proofs);
339-
should.exist(proof.type,
340-
'Expected a type identifier on the proof.');
341-
>>>>>>> 265e798 (improve proof handling when asserting a secured credential)
342-
>>>>>>> ec4cd6a (improve proof handling when asserting a secured credential)
343156
});
344157
});
345158
}

tests/helpers.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const ISOTimeStamp = ({date = new Date()} = {}) => {
4242

4343
export const config = JSON.parse(readFileSync('./config/runner.json'));
4444

45-
export const createInitialVc = async ({
45+
export const secureCredential = async ({
4646
issuer,
4747
vc,
4848
mandatoryPointers,
@@ -287,34 +287,17 @@ export function setupRow() {
287287
};
288288
}
289289

290-
<<<<<<< HEAD
291290
export function proofExists(securedCredential) {
292291
should.exist(securedCredential,
293292
'Expected issuer to have issued a credential.');
294293
const proofs = getProofs(securedCredential);
295-
=======
296-
<<<<<<< HEAD
297-
=======
298-
export function proofExists(proofs) {
299-
>>>>>>> ec4cd6a (improve proof handling when asserting a secured credential)
300294
should.exist(proofs,
301295
'Expected credential to have a proof.');
302296
proofs.length.should.be.gte(1,
303297
'Expected credential to have at least one proof.');
304298
return proofs[0];
305299
}
306300

307-
<<<<<<< HEAD
308-
=======
309-
export function assertSecuredCredential(securedCredential) {
310-
should.exist(securedCredential,
311-
'Expected issuer to have issued a credential.');
312-
const proofs = getProofs(securedCredential);
313-
proofExists(proofs);
314-
}
315-
316-
>>>>>>> 265e798 (improve proof handling when asserting a secured credential)
317-
>>>>>>> ec4cd6a (improve proof handling when asserting a secured credential)
318301
export async function verifySuccess(verifier, securedCredential) {
319302
const body = {
320303
verifiableCredential: securedCredential

0 commit comments

Comments
 (0)