@veramo/credential-ld 3.1.1-next.8 → 3.1.2-next.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/build/action-handler.d.ts.map +1 -1
  2. package/build/action-handler.js +2 -2
  3. package/build/action-handler.js.map +1 -1
  4. package/build/index.js +5 -1
  5. package/build/index.js.map +1 -1
  6. package/build/ld-context-loader.d.ts +2 -2
  7. package/build/ld-context-loader.d.ts.map +1 -1
  8. package/build/ld-context-loader.js +9 -2
  9. package/build/ld-context-loader.js.map +1 -1
  10. package/build/ld-credential-module.d.ts +3 -3
  11. package/build/ld-credential-module.d.ts.map +1 -1
  12. package/build/ld-credential-module.js +41 -8
  13. package/build/ld-credential-module.js.map +1 -1
  14. package/build/ld-default-contexts.d.ts +5 -1
  15. package/build/ld-default-contexts.d.ts.map +1 -1
  16. package/build/ld-default-contexts.js +30 -13
  17. package/build/ld-default-contexts.js.map +1 -1
  18. package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +5 -1
  19. package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
  20. package/build/suites/Ed25519Signature2018.js +5 -1
  21. package/build/suites/Ed25519Signature2018.js.map +1 -1
  22. package/build/tsdoc-metadata.json +1 -1
  23. package/build/types.d.ts +12 -0
  24. package/build/types.d.ts.map +1 -1
  25. package/contexts/X25519KeyAgreementKey2019.json +26 -0
  26. package/contexts/did_v0.11.json +58 -0
  27. package/contexts/ed25519-signature-2018-v1.json +91 -0
  28. package/contexts/kyc-v1.json +8 -0
  29. package/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json +60 -0
  30. package/contexts/profile-v1.json +8 -0
  31. package/contexts/security_context_v1.json +58 -0
  32. package/contexts/socialmedia-v1.json +7 -0
  33. package/contexts/transmute_v1.json +21 -0
  34. package/contexts/w3_2018_credentials_v1.json +237 -0
  35. package/package.json +14 -13
  36. package/plugin.schema.json +10 -0
  37. package/src/__tests__/context.loader.test.ts +39 -0
  38. package/src/__tests__/issue-verify-flow.test.ts +84 -0
  39. package/src/action-handler.ts +8 -2
  40. package/src/ld-context-loader.ts +7 -6
  41. package/src/ld-credential-module.ts +38 -5
  42. package/src/ld-default-contexts.ts +17 -13
  43. package/src/types.ts +14 -0
@@ -0,0 +1,91 @@
1
+ {
2
+ "@context": {
3
+ "id": "@id",
4
+ "type": "@type",
5
+ "@protected": true,
6
+ "proof": {
7
+ "@id": "https://w3id.org/security#proof",
8
+ "@type": "@id",
9
+ "@container": "@graph"
10
+ },
11
+ "Ed25519VerificationKey2018": {
12
+ "@id": "https://w3id.org/security#Ed25519VerificationKey2018",
13
+ "@context": {
14
+ "@protected": true,
15
+ "id": "@id",
16
+ "type": "@type",
17
+ "controller": {
18
+ "@id": "https://w3id.org/security#controller",
19
+ "@type": "@id"
20
+ },
21
+ "revoked": {
22
+ "@id": "https://w3id.org/security#revoked",
23
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
24
+ },
25
+ "publicKeyBase58": {
26
+ "@id": "https://w3id.org/security#publicKeyBase58"
27
+ }
28
+ }
29
+ },
30
+ "Ed25519Signature2018": {
31
+ "@id": "https://w3id.org/security#Ed25519Signature2018",
32
+ "@context": {
33
+ "@protected": true,
34
+ "id": "@id",
35
+ "type": "@type",
36
+ "challenge": "https://w3id.org/security#challenge",
37
+ "created": {
38
+ "@id": "http://purl.org/dc/terms/created",
39
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
40
+ },
41
+ "domain": "https://w3id.org/security#domain",
42
+ "expires": {
43
+ "@id": "https://w3id.org/security#expiration",
44
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
45
+ },
46
+ "nonce": "https://w3id.org/security#nonce",
47
+ "proofPurpose": {
48
+ "@id": "https://w3id.org/security#proofPurpose",
49
+ "@type": "@vocab",
50
+ "@context": {
51
+ "@protected": true,
52
+ "id": "@id",
53
+ "type": "@type",
54
+ "assertionMethod": {
55
+ "@id": "https://w3id.org/security#assertionMethod",
56
+ "@type": "@id",
57
+ "@container": "@set"
58
+ },
59
+ "authentication": {
60
+ "@id": "https://w3id.org/security#authenticationMethod",
61
+ "@type": "@id",
62
+ "@container": "@set"
63
+ },
64
+ "capabilityInvocation": {
65
+ "@id": "https://w3id.org/security#capabilityInvocationMethod",
66
+ "@type": "@id",
67
+ "@container": "@set"
68
+ },
69
+ "capabilityDelegation": {
70
+ "@id": "https://w3id.org/security#capabilityDelegationMethod",
71
+ "@type": "@id",
72
+ "@container": "@set"
73
+ },
74
+ "keyAgreement": {
75
+ "@id": "https://w3id.org/security#keyAgreementMethod",
76
+ "@type": "@id",
77
+ "@container": "@set"
78
+ }
79
+ }
80
+ },
81
+ "jws": {
82
+ "@id": "https://w3id.org/security#jws"
83
+ },
84
+ "verificationMethod": {
85
+ "@id": "https://w3id.org/security#verificationMethod",
86
+ "@type": "@id"
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "@version": 1.1,
4
+ "@protected": true,
5
+ "VerifiableKyc": "https://veramo.io/contexts/kyc#VerifiableKyc",
6
+ "name": "https://schema.org/name"
7
+ }
8
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "@context": {
3
+ "@version": 1.1,
4
+ "id": "@id",
5
+ "type": "@type",
6
+ "esrs2020": "https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#",
7
+
8
+ "EcdsaSecp256k1RecoverySignature2020": {
9
+ "@id": "https://w3id.org/security#EcdsaSecp256k1RecoverySignature2020",
10
+ "@context": {
11
+ "@version": 1.1,
12
+ "@protected": true,
13
+
14
+ "id": "@id",
15
+ "type": "@type",
16
+
17
+ "sec": "https://w3id.org/security#",
18
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
19
+
20
+ "challenge": "sec:challenge",
21
+ "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"},
22
+ "domain": "sec:domain",
23
+ "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
24
+ "jws": "sec:jws",
25
+ "nonce": "sec:nonce",
26
+ "proofPurpose": {
27
+ "@id": "sec:proofPurpose",
28
+ "@type": "@vocab",
29
+ "@context": {
30
+ "@version": 1.1,
31
+ "@protected": true,
32
+
33
+ "id": "@id",
34
+ "type": "@type",
35
+
36
+ "sec": "https://w3id.org/security#",
37
+
38
+ "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
39
+ "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"}
40
+ }
41
+ },
42
+ "proofValue": "sec:proofValue",
43
+ "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"}
44
+ }
45
+ },
46
+
47
+ "EcdsaSecp256k1RecoveryMethod2020": "esrs2020:EcdsaSecp256k1RecoveryMethod2020",
48
+ "publicKeyJwk": {
49
+ "@id": "esrs2020:publicKeyJwk",
50
+ "@type": "@json"
51
+ },
52
+ "privateKeyJwk": {
53
+ "@id": "esrs2020:privateKeyJwk",
54
+ "@type": "@json"
55
+ },
56
+ "publicKeyHex": "esrs2020:publicKeyHex",
57
+ "privateKeyHex": "esrs2020:privateKeyHex",
58
+ "ethereumAddress": "esrs2020:ethereumAddress"
59
+ }
60
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "@version": 1.1,
4
+ "@protected": true,
5
+ "Profile": "https://veramo.io/contexts/profile#Profile",
6
+ "name": "https://schema.org/name"
7
+ }
8
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "@context": {
3
+ "@protected": true,
4
+ "id": "@id",
5
+ "type": "@type",
6
+
7
+ "alsoKnownAs": {
8
+ "@id": "https://www.w3.org/ns/activitystreams#alsoKnownAs",
9
+ "@type": "@id"
10
+ },
11
+ "assertionMethod": {
12
+ "@id": "https://w3id.org/security#assertionMethod",
13
+ "@type": "@id",
14
+ "@container": "@set"
15
+ },
16
+ "authentication": {
17
+ "@id": "https://w3id.org/security#authenticationMethod",
18
+ "@type": "@id",
19
+ "@container": "@set"
20
+ },
21
+ "capabilityDelegation": {
22
+ "@id": "https://w3id.org/security#capabilityDelegationMethod",
23
+ "@type": "@id",
24
+ "@container": "@set"
25
+ },
26
+ "capabilityInvocation": {
27
+ "@id": "https://w3id.org/security#capabilityInvocationMethod",
28
+ "@type": "@id",
29
+ "@container": "@set"
30
+ },
31
+ "controller": {
32
+ "@id": "https://w3id.org/security#controller",
33
+ "@type": "@id"
34
+ },
35
+ "keyAgreement": {
36
+ "@id": "https://w3id.org/security#keyAgreementMethod",
37
+ "@type": "@id",
38
+ "@container": "@set"
39
+ },
40
+ "service": {
41
+ "@id": "https://www.w3.org/ns/did#service",
42
+ "@type": "@id",
43
+ "@context": {
44
+ "@protected": true,
45
+ "id": "@id",
46
+ "type": "@type",
47
+ "serviceEndpoint": {
48
+ "@id": "https://www.w3.org/ns/did#serviceEndpoint",
49
+ "@type": "@id"
50
+ }
51
+ }
52
+ },
53
+ "verificationMethod": {
54
+ "@id": "https://w3id.org/security#verificationMethod",
55
+ "@type": "@id"
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "@context": {
3
+ "@version": 1.1,
4
+ "@protected": true,
5
+ "VerifableSocialMediaPosting": "https://veramo.io/contexts/socialmedia#VerifableSocialMediaPosting"
6
+ }
7
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "@context": [
3
+ {
4
+ "@version": 1.1
5
+ },
6
+ "https://www.w3.org/ns/did/v1",
7
+ {
8
+ "JsonWebKey2020": "https://w3id.org/security#JsonWebKey2020",
9
+ "Ed25519VerificationKey2018": "https://w3id.org/security#Ed25519VerificationKey2018",
10
+ "X25519KeyAgreementKey2019": "https://w3id.org/security#X25519KeyAgreementKey2019",
11
+
12
+ "publicKeyJwk": {
13
+ "@id": "https://w3id.org/security#publicKeyJwk",
14
+ "@type": "@json"
15
+ },
16
+ "publicKeyBase58": {
17
+ "@id": "https://w3id.org/security#publicKeyBase58"
18
+ }
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,237 @@
1
+ {
2
+ "@context": {
3
+ "@version": 1.1,
4
+ "@protected": true,
5
+
6
+ "id": "@id",
7
+ "type": "@type",
8
+
9
+ "VerifiableCredential": {
10
+ "@id": "https://www.w3.org/2018/credentials#VerifiableCredential",
11
+ "@context": {
12
+ "@version": 1.1,
13
+ "@protected": true,
14
+
15
+ "id": "@id",
16
+ "type": "@type",
17
+
18
+ "cred": "https://www.w3.org/2018/credentials#",
19
+ "sec": "https://w3id.org/security#",
20
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
21
+
22
+ "credentialSchema": {
23
+ "@id": "cred:credentialSchema",
24
+ "@type": "@id",
25
+ "@context": {
26
+ "@version": 1.1,
27
+ "@protected": true,
28
+
29
+ "id": "@id",
30
+ "type": "@type",
31
+
32
+ "cred": "https://www.w3.org/2018/credentials#",
33
+
34
+ "JsonSchemaValidator2018": "cred:JsonSchemaValidator2018"
35
+ }
36
+ },
37
+ "credentialStatus": {"@id": "cred:credentialStatus", "@type": "@id"},
38
+ "credentialSubject": {"@id": "cred:credentialSubject", "@type": "@id"},
39
+ "evidence": {"@id": "cred:evidence", "@type": "@id"},
40
+ "expirationDate": {"@id": "cred:expirationDate", "@type": "xsd:dateTime"},
41
+ "holder": {"@id": "cred:holder", "@type": "@id"},
42
+ "issued": {"@id": "cred:issued", "@type": "xsd:dateTime"},
43
+ "issuer": {"@id": "cred:issuer", "@type": "@id"},
44
+ "issuanceDate": {"@id": "cred:issuanceDate", "@type": "xsd:dateTime"},
45
+ "proof": {"@id": "sec:proof", "@type": "@id", "@container": "@graph"},
46
+ "refreshService": {
47
+ "@id": "cred:refreshService",
48
+ "@type": "@id",
49
+ "@context": {
50
+ "@version": 1.1,
51
+ "@protected": true,
52
+
53
+ "id": "@id",
54
+ "type": "@type",
55
+
56
+ "cred": "https://www.w3.org/2018/credentials#",
57
+
58
+ "ManualRefreshService2018": "cred:ManualRefreshService2018"
59
+ }
60
+ },
61
+ "termsOfUse": {"@id": "cred:termsOfUse", "@type": "@id"},
62
+ "validFrom": {"@id": "cred:validFrom", "@type": "xsd:dateTime"},
63
+ "validUntil": {"@id": "cred:validUntil", "@type": "xsd:dateTime"}
64
+ }
65
+ },
66
+
67
+ "VerifiablePresentation": {
68
+ "@id": "https://www.w3.org/2018/credentials#VerifiablePresentation",
69
+ "@context": {
70
+ "@version": 1.1,
71
+ "@protected": true,
72
+
73
+ "id": "@id",
74
+ "type": "@type",
75
+
76
+ "cred": "https://www.w3.org/2018/credentials#",
77
+ "sec": "https://w3id.org/security#",
78
+
79
+ "holder": {"@id": "cred:holder", "@type": "@id"},
80
+ "proof": {"@id": "sec:proof", "@type": "@id", "@container": "@graph"},
81
+ "verifiableCredential": {"@id": "cred:verifiableCredential", "@type": "@id", "@container": "@graph"}
82
+ }
83
+ },
84
+
85
+ "EcdsaSecp256k1Signature2019": {
86
+ "@id": "https://w3id.org/security#EcdsaSecp256k1Signature2019",
87
+ "@context": {
88
+ "@version": 1.1,
89
+ "@protected": true,
90
+
91
+ "id": "@id",
92
+ "type": "@type",
93
+
94
+ "sec": "https://w3id.org/security#",
95
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
96
+
97
+ "challenge": "sec:challenge",
98
+ "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"},
99
+ "domain": "sec:domain",
100
+ "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
101
+ "jws": "sec:jws",
102
+ "nonce": "sec:nonce",
103
+ "proofPurpose": {
104
+ "@id": "sec:proofPurpose",
105
+ "@type": "@vocab",
106
+ "@context": {
107
+ "@version": 1.1,
108
+ "@protected": true,
109
+
110
+ "id": "@id",
111
+ "type": "@type",
112
+
113
+ "sec": "https://w3id.org/security#",
114
+
115
+ "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
116
+ "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"}
117
+ }
118
+ },
119
+ "proofValue": "sec:proofValue",
120
+ "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"}
121
+ }
122
+ },
123
+
124
+ "EcdsaSecp256r1Signature2019": {
125
+ "@id": "https://w3id.org/security#EcdsaSecp256r1Signature2019",
126
+ "@context": {
127
+ "@version": 1.1,
128
+ "@protected": true,
129
+
130
+ "id": "@id",
131
+ "type": "@type",
132
+
133
+ "sec": "https://w3id.org/security#",
134
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
135
+
136
+ "challenge": "sec:challenge",
137
+ "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"},
138
+ "domain": "sec:domain",
139
+ "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
140
+ "jws": "sec:jws",
141
+ "nonce": "sec:nonce",
142
+ "proofPurpose": {
143
+ "@id": "sec:proofPurpose",
144
+ "@type": "@vocab",
145
+ "@context": {
146
+ "@version": 1.1,
147
+ "@protected": true,
148
+
149
+ "id": "@id",
150
+ "type": "@type",
151
+
152
+ "sec": "https://w3id.org/security#",
153
+
154
+ "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
155
+ "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"}
156
+ }
157
+ },
158
+ "proofValue": "sec:proofValue",
159
+ "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"}
160
+ }
161
+ },
162
+
163
+ "Ed25519Signature2018": {
164
+ "@id": "https://w3id.org/security#Ed25519Signature2018",
165
+ "@context": {
166
+ "@version": 1.1,
167
+ "@protected": true,
168
+
169
+ "id": "@id",
170
+ "type": "@type",
171
+
172
+ "sec": "https://w3id.org/security#",
173
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
174
+
175
+ "challenge": "sec:challenge",
176
+ "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"},
177
+ "domain": "sec:domain",
178
+ "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
179
+ "jws": "sec:jws",
180
+ "nonce": "sec:nonce",
181
+ "proofPurpose": {
182
+ "@id": "sec:proofPurpose",
183
+ "@type": "@vocab",
184
+ "@context": {
185
+ "@version": 1.1,
186
+ "@protected": true,
187
+
188
+ "id": "@id",
189
+ "type": "@type",
190
+
191
+ "sec": "https://w3id.org/security#",
192
+
193
+ "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
194
+ "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"}
195
+ }
196
+ },
197
+ "proofValue": "sec:proofValue",
198
+ "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"}
199
+ }
200
+ },
201
+
202
+ "RsaSignature2018": {
203
+ "@id": "https://w3id.org/security#RsaSignature2018",
204
+ "@context": {
205
+ "@version": 1.1,
206
+ "@protected": true,
207
+
208
+ "challenge": "sec:challenge",
209
+ "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"},
210
+ "domain": "sec:domain",
211
+ "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
212
+ "jws": "sec:jws",
213
+ "nonce": "sec:nonce",
214
+ "proofPurpose": {
215
+ "@id": "sec:proofPurpose",
216
+ "@type": "@vocab",
217
+ "@context": {
218
+ "@version": 1.1,
219
+ "@protected": true,
220
+
221
+ "id": "@id",
222
+ "type": "@type",
223
+
224
+ "sec": "https://w3id.org/security#",
225
+
226
+ "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
227
+ "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"}
228
+ }
229
+ },
230
+ "proofValue": "sec:proofValue",
231
+ "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"}
232
+ }
233
+ },
234
+
235
+ "proof": {"@id": "https://w3id.org/security#proof", "@type": "@id", "@container": "@graph"}
236
+ }
237
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@veramo/credential-ld",
3
3
  "description": "Veramo plugin for working with W3C JSON-LD Verifiable Credentials & Presentations.",
4
- "version": "3.1.1-next.8+18c2226e",
4
+ "version": "3.1.2-next.101+c47c08e2",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
7
7
  "scripts": {
@@ -14,27 +14,28 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@transmute/credentials-context": "^0.7.0-unstable.26",
18
- "@transmute/ed25519-signature-2018": "^0.7.0-unstable.27",
17
+ "@transmute/credentials-context": "^0.7.0-unstable.34",
18
+ "@transmute/ed25519-signature-2018": "^0.7.0-unstable.34",
19
19
  "@transmute/lds-ecdsa-secp256k1-recovery2020": "^0.0.7",
20
- "@veramo/core": "^3.1.1-next.8+18c2226e",
21
- "@veramo/did-resolver": "^3.1.1-next.8+18c2226e",
22
- "@veramo/utils": "^3.1.1-next.8+18c2226e",
23
- "debug": "^4.1.1",
24
- "did-resolver": "3.1.3",
20
+ "@veramo/core": "^3.1.2-next.101+c47c08e2",
21
+ "@veramo/did-resolver": "^3.1.2-next.101+c47c08e2",
22
+ "@veramo/utils": "^3.1.2-next.101+c47c08e2",
23
+ "debug": "^4.3.3",
24
+ "did-resolver": "^3.1.5",
25
25
  "jsonld": "^5.2.0",
26
- "jsonld-signatures": "^9.0.2",
27
- "uint8arrays": "^2.1.3",
26
+ "jsonld-signatures": "^9.3.1",
27
+ "uint8arrays": "^3.0.0",
28
28
  "vc-js": "^0.6.4"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/debug": "4.1.7",
32
- "borc": "^3.0.0",
33
- "typescript": "4.4.4"
32
+ "borc": "3.0.0",
33
+ "typescript": "4.6.4"
34
34
  },
35
35
  "files": [
36
36
  "build/**/*",
37
37
  "src/**/*",
38
+ "contexts/**/*.json",
38
39
  "plugin.schema.json",
39
40
  "README.md",
40
41
  "LICENSE"
@@ -46,5 +47,5 @@
46
47
  "author": "Mircea Nistor <mircea.nistor@mesh.xyz>",
47
48
  "license": "Apache-2.0",
48
49
  "keywords": [],
49
- "gitHead": "18c2226e375925446be8c1d15cd5bab4387b8d79"
50
+ "gitHead": "c47c08e2ce9ef676cc429bcaf063bbe8e38a352c"
50
51
  }
@@ -326,6 +326,11 @@
326
326
  "credential": {
327
327
  "$ref": "#/components/schemas/VerifiableCredential",
328
328
  "description": "The json payload of the Credential according to the\n {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model } \n\nThe signer of the Credential is chosen based on the `issuer.id` property of the `credential`"
329
+ },
330
+ "fetchRemoteContexts": {
331
+ "type": "boolean",
332
+ "description": "Set this to true if you want the '@context' URLs to be fetched in case they are not pre-loaded.",
333
+ "default": false
329
334
  }
330
335
  },
331
336
  "required": [
@@ -347,6 +352,11 @@
347
352
  "domain": {
348
353
  "type": "string",
349
354
  "description": "Optional (only for JWT) string domain parameter to verify the verifiable presentation against"
355
+ },
356
+ "fetchRemoteContexts": {
357
+ "type": "boolean",
358
+ "description": "Set this to true if you want the '@context' URLs to be fetched in case they are not pre-loaded.",
359
+ "default": false
350
360
  }
351
361
  },
352
362
  "required": [
@@ -0,0 +1,39 @@
1
+ import { ContextDoc } from '../types'
2
+ import { LdContextLoader } from '../ld-context-loader'
3
+ import { LdDefaultContexts } from '../ld-default-contexts'
4
+
5
+ describe('credential-ld context loader', () => {
6
+ const customContext: Record<string, ContextDoc> = {
7
+ 'https://example.com/custom/context': {
8
+ '@context': {
9
+ '@version': 1.1,
10
+ id: '@id',
11
+ type: '@type',
12
+ nothing: 'https://example.com/nothing',
13
+ },
14
+ },
15
+ }
16
+
17
+ it('loads custom context from record', async () => {
18
+ expect.assertions(2)
19
+ const loader = new LdContextLoader({ contextsPaths: [customContext] })
20
+ expect(loader.has('https://example.com/custom/context')).toBe(true)
21
+ await expect(loader.get('https://example.com/custom/context')).resolves.toEqual({
22
+ '@context': {
23
+ '@version': 1.1,
24
+ id: '@id',
25
+ type: '@type',
26
+ nothing: 'https://example.com/nothing',
27
+ },
28
+ })
29
+ })
30
+
31
+ it('loads context from default map', async () => {
32
+ expect.assertions(2)
33
+ const loader = new LdContextLoader({ contextsPaths: [LdDefaultContexts] })
34
+ expect(loader.has('https://www.w3.org/2018/credentials/v1')).toBe(true)
35
+
36
+ const credsContext = await loader.get('https://www.w3.org/2018/credentials/v1')
37
+ expect(credsContext['@context']).toBeDefined()
38
+ })
39
+ })