Skip to content

Commit b9ec527

Browse files
committed
Add invalidPurpose to VC 2.0 context.
1 parent 1b9a7b7 commit b9ec527

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/vc-generator/contexts.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* SPDX-License-Identifier: BSD-3-Clause
44
*/
55
import {
6-
contexts as credentialsContexts
6+
contexts as credentialsContexts,
7+
named as namedCredentialsContexts
78
} from '@digitalbazaar/credentials-context';
89
import dataIntegrityCtx from '@digitalbazaar/data-integrity-context';
910
import didCtx from '@digitalcredentials/did-context';
@@ -12,12 +13,18 @@ import multikeyCtx from '@digitalbazaar/multikey-context';
1213
const contextMap = new Map(credentialsContexts);
1314

1415
const _dataIntegrityCtx = structuredClone(dataIntegrityCtx.CONTEXT);
16+
const {
17+
id: v2ContextUrl,
18+
context: v2Context
19+
} = structuredClone(namedCredentialsContexts.get('v2'));
20+
const v2Ctx = v2Context['@context'];
1521
const diCtx = _dataIntegrityCtx['@context'];
1622
// add UnknownProofType to local context for test data
1723
diCtx.UnknownProofType =
1824
structuredClone(_dataIntegrityCtx['@context'].DataIntegrityProof);
1925
// add invalidPurpose to context for test data
20-
diCtx.DataIntegrityProof['@context'].proofPurpose['@context'].invalidPurpose = {
26+
diCtx.DataIntegrityProof['@context'].proofPurpose['@context'].invalidPurpose =
27+
v2Ctx.DataIntegrityProof['@context'].proofPurpose['@context'].invalidPurpose = {
2128
'@id': 'https://w3id.org/security#invalidPurpose',
2229
'@type': '@id',
2330
'@container': '@set'
@@ -34,5 +41,9 @@ contextMap.set(
3441
didCtx.contexts.get(
3542
didCtx.constants.DID_CONTEXT_URL)
3643
);
44+
contextMap.set(
45+
v2ContextUrl,
46+
v2Context
47+
);
3748

3849
export {contextMap};

0 commit comments

Comments
 (0)