Skip to content

Commit

Permalink
Use keyDoc for issuer id & pass selectivePointers.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Aug 4, 2024
1 parent 2354efc commit 4a2e4aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
16 changes: 10 additions & 6 deletions test/10-verify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,22 @@ for(const [suiteName, suiteOptions] of suites) {

function _runSuite({
derived, suites,
suiteName, issuer,
suiteName, keyDoc,
keyType, version,
credentialFactory
}) {
const title = `VC ${version} Suite ${suiteName} KeyType ${keyType}`;
const mandatoryPointers = (version === '1.0') ?
['/issuer', '/issuanceDate'] : ['/issuer'];
const selectivePointers = ['/credentialSubject'];
const generateDefaults = {
credentialFactory,
suites,
issuer,
issuer: keyDoc.controller,
mandatoryPointers,
selectivePointers,
derived
};
const mandatoryPointers = (version === '1.0') ?
['/issuer', '/issuanceDate'] : ['/issuer'];
const verifySuite = suites.verify();
const issuerSuite = suites.issue({mandatoryPointers});
describe(title, async function() {
Expand All @@ -47,8 +50,9 @@ function _runSuite({
const {verifiableCredential} = await signCredential({
credential: credentialFactory(),
suites,
issuer,
issuer: keyDoc.controller,
mandatoryPointers,
selectivePointers,
derived
});
const result = await vc.verifyCredential({
Expand Down Expand Up @@ -103,7 +107,7 @@ function _runSuite({
const verifiableCredential = await signCredential({
credential,
suites,
issuer,
issuer: keyDoc.controller,
mandatoryPointers,
derived
});
Expand Down
3 changes: 2 additions & 1 deletion test/mocks/suites.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ async function eddsaRdfc2022() {
const keyDoc = await keyPair.export({publicKey: true});
registerKey({keyDoc});
return {
keyDoc,
keyPair,
keyType: 'Ed25519',
suiteName: 'eddsa-rdfc-2022',
issuer: keyPair.controller,
suites: createDiSuites({
signer: keyPair.signer(),
cryptosuite: eddsaRdfc2020Cryptosuite
Expand All @@ -60,6 +60,7 @@ async function ecdsaRdfc2019() {
const keyDoc = await keyPair.export({publicKey: true});
registerKey({keyDoc});
return {
keyDoc,
keyPair,
keyType: 'P-256',
suiteName: 'ecdsa-rdfc-2019',
Expand Down

0 comments on commit 4a2e4aa

Please sign in to comment.