@@ -14,27 +14,42 @@ import dataIntegrityCtx from '@digitalbazaar/data-integrity-context';
14
14
import didCtx from '@digitalcredentials/did-context' ;
15
15
import multikeyCtx from '@digitalbazaar/multikey-context' ;
16
16
17
- const contextMap = new Map ( credentialsContexts ) ;
17
+ const contextMap = new Map ( ) ;
18
18
const setContexts = contexts => {
19
19
for ( const [ key , value ] of contexts ) {
20
20
contextMap . set ( key , structuredClone ( value ) ) ;
21
21
}
22
22
} ;
23
+ const invalidPurpose = {
24
+ '@id' : 'https://w3id.org/security#invalidPurpose' ,
25
+ '@type' : '@id' ,
26
+ '@container' : '@set'
27
+ } ;
23
28
24
- const { context : vc2Context } = namedCredentialsContexts . get ( 'v2' ) ;
25
- const v2Ctx = vc2Context [ '@context' ] ;
29
+ // adding terms manually
30
+ const {
31
+ id : v2ContextUrl ,
32
+ context : v2Context
33
+ } = structuredClone ( namedCredentialsContexts . get ( 'v2' ) ) ;
34
+ const v2Ctx = v2Context [ '@context' ] ;
26
35
v2Ctx . UnknownProofType = structuredClone ( v2Ctx . DataIntegrityProof ) ;
36
+ v2Ctx . DataIntegrityProof [ '@context' ] . proofPurpose [ '@context' ] . invalidPurpose =
37
+ invalidPurpose ;
38
+ v2Ctx . undefinedTerm = 'urn:example:undefinedTerm' ;
39
+
27
40
const _dataIntegrityCtx = structuredClone ( dataIntegrityCtx . CONTEXT ) ;
28
41
const diCtx = _dataIntegrityCtx [ '@context' ] ;
29
42
diCtx . UnknownProofType = structuredClone ( diCtx . DataIntegrityProof ) ;
30
- contextMap . set (
31
- dataIntegrityCtx . constants . CONTEXT_URL ,
32
- _dataIntegrityCtx
33
- ) ;
34
- // add contexts for the documentLoader
43
+ diCtx . DataIntegrityProof [ '@context' ] . proofPurpose [ '@context' ] . invalidPurpose =
44
+ invalidPurpose ;
45
+ diCtx . undefinedTerm = 'urn:example:undefinedTerm' ;
46
+
47
+ // adding to contextMap
48
+ setContexts ( didCtx . contexts ) ;
49
+ setContexts ( credentialsContexts ) ;
35
50
contextMap . set ( multikeyCtx . constants . CONTEXT_URL , multikeyCtx . CONTEXT ) ;
36
51
contextMap . set ( vdlCtxUrl , vdlCtx ) ;
37
- // add the dids contexts
38
- setContexts ( didCtx . contexts ) ;
52
+ contextMap . set ( dataIntegrityCtx . constants . CONTEXT_URL , _dataIntegrityCtx ) ;
53
+ contextMap . set ( v2ContextUrl , v2Context ) ;
39
54
40
55
export { contextMap } ;
0 commit comments