Skip to content

Commit 5f7385c

Browse files
committed
Start work on common setup and proxy.
1 parent 65c0d6f commit 5f7385c

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

tests/suites/algorithms.js

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ async function _setup({
213213
suiteName,
214214
keyType
215215
}) {
216-
// stub suite canonize via Proxy cryptosuite.canonize and set safe to false
217216
const credentials = new Map();
218217
const keyPair = await getMultiKey({keyType});
219218
const signer = keyPair.signer();
@@ -229,6 +228,7 @@ async function _setup({
229228
mandatoryPointers
230229
})
231230
})));
231+
// stub suite canonize via Proxy cryptosuite.canonize and set safe to false
232232
credentials.set('noTypeOrCryptosuite',
233233
await issueCloned(_generateNoTypeCryptosuite({
234234
signer,
@@ -295,6 +295,38 @@ function unsafeProxy(suite) {
295295
});
296296
}
297297

298-
function _commonSetup({}) {
298+
async function _commonSetup({
299+
credential,
300+
mandatoryPointers,
301+
selectivePointers,
302+
suiteName,
303+
keyType
304+
}) {
305+
const credentials = new Map();
306+
const keyPair = await getMultiKey({keyType});
307+
const signer = keyPair.signer();
308+
const _credential = structuredClone(credential);
309+
_credential.issuer = keyPair.controller;
310+
const {suite, selectiveSuite} = getSuites({
311+
signer,
312+
suiteName,
313+
selectivePointers,
314+
mandatoryPointers
315+
});
316+
credentials.set('invalidHash', await issueCloned({
317+
credential: _credential,
318+
suite: invalidHashProxy({suite, suiteName}),
319+
selectiveSuite: invalidHashProxy({suite: selectiveSuite, suiteName})
320+
}));
321+
return credentials;
322+
}
323+
324+
function invalidHashProxy({
325+
suiteName,
326+
suite,
327+
}) {
328+
if(typeof suite !== 'object') {
329+
return suite;
330+
}
299331

300332
}

0 commit comments

Comments
 (0)