Skip to content

Commit

Permalink
Add invalidPurpose to VC 2.0 context.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Nov 3, 2024
1 parent 1b9a7b7 commit b9ec527
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 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 @@ -12,12 +13,18 @@ import multikeyCtx from '@digitalbazaar/multikey-context';
const contextMap = new Map(credentialsContexts);

const _dataIntegrityCtx = structuredClone(dataIntegrityCtx.CONTEXT);
const {
id: v2ContextUrl,
context: v2Context
} = structuredClone(namedCredentialsContexts.get('v2'));
const v2Ctx = v2Context['@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 = {
diCtx.DataIntegrityProof['@context'].proofPurpose['@context'].invalidPurpose =
v2Ctx.DataIntegrityProof['@context'].proofPurpose['@context'].invalidPurpose = {
'@id': 'https://w3id.org/security#invalidPurpose',
'@type': '@id',
'@container': '@set'
Expand All @@ -34,5 +41,9 @@ contextMap.set(
didCtx.contexts.get(
didCtx.constants.DID_CONTEXT_URL)
);
contextMap.set(
v2ContextUrl,
v2Context
);

export {contextMap};

0 comments on commit b9ec527

Please sign in to comment.