Skip to content

Commit

Permalink
Add UnknownProofType to V2 context & DI Context pass loader to issueC…
Browse files Browse the repository at this point in the history
…loned.
  • Loading branch information
aljones15 committed Aug 2, 2024
1 parent 17b8962 commit 0af1943
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
21 changes: 6 additions & 15 deletions tests/vc-generator/contexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
import {
contexts as credentialsContexts
contexts as credentialsContexts,
named as namedCredentialsContexts
} from '@digitalbazaar/credentials-context';
import dataIntegrityCtx from '@digitalbazaar/data-integrity-context';
import didCtx from '@digitalcredentials/did-context';
Expand All @@ -16,29 +17,19 @@ const setContexts = contexts => {
}
};

/*
const {context: vc2Context} = namedCredentialsContexts.get('v2');
const v2Ctx = vc2Context['@context'];
v2Ctx.UnknownProofType = structuredClone(v2Ctx.DataIntegrityProof);
const _dataIntegrityCtx = structuredClone(dataIntegrityCtx.CONTEXT);
const diCtx = _dataIntegrityCtx['@context'];
// add UnknownProofType to local context for test data
diCtx.UnknownProofType =
structuredClone(_dataIntegrityCtx['@context'].DataIntegrityProof);
// add invalidPurpose to context for test data
diCtx.DataIntegrityProof['@context'].proofPurpose['@context'].invalidPurpose = {
'@id': 'https://w3id.org/security#invalidPurpose',
'@type': '@id',
'@container': '@set'
};
diCtx.UnknownProofType = structuredClone(diCtx.DataIntegrityProof);
contextMap.set(
dataIntegrityCtx.constants.CONTEXT_URL,
_dataIntegrityCtx
);
*/

// add contexts for the documentLoader
contextMap.set(multikeyCtx.constants.CONTEXT_URL, multikeyCtx.CONTEXT);

// add the data integrity contexts
setContexts(dataIntegrityCtx.contexts);
// add the dids contexts
setContexts(didCtx.contexts);

Expand Down
2 changes: 2 additions & 0 deletions tests/vc-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export async function verifyCredential({
}

export async function deriveCredentials({
documentLoader = defaultLoader,
keys,
vectors,
map = new Map(),
Expand All @@ -110,6 +111,7 @@ export async function deriveCredentials({
suite: getSuite({suite: suiteName, signer, mandatoryPointers}),
selectiveSuite: getSuite({suite: suiteName, signer, selectivePointers}),
credential: _credential,
loader: documentLoader,
// add the ability to overwrite the defaults
...initialParams
};
Expand Down

0 comments on commit 0af1943

Please sign in to comment.