@veramo/credential-ld 5.1.5-next.12 → 5.1.5-next.13

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 (71) hide show
  1. package/build/contexts/schema.org.json +8612 -0
  2. package/build/contexts/w3id.org_security_bbs_v1.json +128 -0
  3. package/build/contexts/w3id.org_security_suites_ed25519-2018_v1.json +89 -56
  4. package/build/contexts/{ed25519-signature-2018-v1.json → w3id.org_security_suites_ed25519-2020-v1.json} +10 -8
  5. package/build/contexts/{json-web-signature-2020-v1.json → w3id.org_security_suites_jws-2020_v1.json} +15 -8
  6. package/build/contexts/w3id.org_security_suites_x25519-2020_v1.json +27 -0
  7. package/build/contexts/w3id.org_security_v1.json +36 -9
  8. package/build/contexts/w3id.org_security_v2.json +90 -22
  9. package/build/contexts/w3id.org_security_v3-unstable.json +4 -2
  10. package/build/contexts/www.w3.org_2018_credentials_examples_v1.json +69 -0
  11. package/build/contexts/www.w3.org_2018_credentials_v1.json +156 -36
  12. package/build/ld-credential-module.d.ts.map +1 -1
  13. package/build/ld-credential-module.js +5 -2
  14. package/build/ld-credential-module.js.map +1 -1
  15. package/build/ld-default-contexts.d.ts.map +1 -1
  16. package/build/ld-default-contexts.js +18 -9
  17. package/build/ld-default-contexts.js.map +1 -1
  18. package/build/ld-suites.d.ts +2 -2
  19. package/build/ld-suites.d.ts.map +1 -1
  20. package/build/ld-suites.js.map +1 -1
  21. package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +1 -1
  22. package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
  23. package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +3 -2
  24. package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
  25. package/build/suites/Ed25519Signature2018.d.ts +1 -1
  26. package/build/suites/Ed25519Signature2018.d.ts.map +1 -1
  27. package/build/suites/Ed25519Signature2018.js +2 -1
  28. package/build/suites/Ed25519Signature2018.js.map +1 -1
  29. package/build/suites/Ed25519Signature2020.d.ts +3 -5
  30. package/build/suites/Ed25519Signature2020.d.ts.map +1 -1
  31. package/build/suites/Ed25519Signature2020.js +50 -9
  32. package/build/suites/Ed25519Signature2020.js.map +1 -1
  33. package/build/suites/JsonWebSignature2020.d.ts +1 -1
  34. package/build/suites/JsonWebSignature2020.d.ts.map +1 -1
  35. package/build/suites/JsonWebSignature2020.js +2 -1
  36. package/build/suites/JsonWebSignature2020.js.map +1 -1
  37. package/package.json +4 -4
  38. package/src/__tests__/issue-verify-ed25519-2020.test.ts +143 -0
  39. package/src/contexts/schema.org.json +8612 -0
  40. package/src/contexts/veramo.io_contexts_profile_v1.json +4 -4
  41. package/src/contexts/w3id.org_security_bbs_v1.json +128 -0
  42. package/src/contexts/w3id.org_security_suites_ed25519-2018_v1.json +89 -57
  43. package/src/contexts/{ed25519-signature-2018-v1.json → w3id.org_security_suites_ed25519-2020-v1.json} +10 -8
  44. package/src/contexts/w3id.org_security_suites_jws-2020_v1.json +78 -0
  45. package/src/contexts/w3id.org_security_suites_x25519-2020_v1.json +27 -0
  46. package/src/contexts/w3id.org_security_v1.json +36 -12
  47. package/src/contexts/w3id.org_security_v2.json +124 -57
  48. package/src/contexts/w3id.org_security_v3-unstable.json +684 -692
  49. package/src/contexts/www.w3.org_2018_credentials_examples_v1.json +69 -0
  50. package/src/contexts/www.w3.org_2018_credentials_v1.json +157 -79
  51. package/src/contexts/www.w3.org_ns_did_v1.json +0 -1
  52. package/src/ld-credential-module.ts +19 -5
  53. package/src/ld-default-contexts.ts +19 -10
  54. package/src/ld-suites.ts +2 -1
  55. package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +4 -5
  56. package/src/suites/Ed25519Signature2018.ts +2 -1
  57. package/src/suites/Ed25519Signature2020.ts +72 -11
  58. package/src/suites/JsonWebSignature2020.ts +2 -1
  59. package/build/contexts/did_v0.11.json +0 -61
  60. package/build/contexts/ed25519-signature-2020-v1.json +0 -77
  61. package/build/contexts/kyc-v1.json +0 -8
  62. package/build/contexts/socialmedia-v1.json +0 -7
  63. package/build/contexts/transmute_v1.json +0 -20
  64. package/src/contexts/did_v0.11.json +0 -64
  65. package/src/contexts/ed25519-signature-2020-v1.json +0 -77
  66. package/src/contexts/json-web-signature-2020-v1.json +0 -71
  67. package/src/contexts/kyc-v1.json +0 -8
  68. package/src/contexts/socialmedia-v1.json +0 -7
  69. package/src/contexts/transmute_v1.json +0 -21
  70. /package/build/contexts/{eip712.json → w3id.org_security_suites_eip712sig-2021_v1.json} +0 -0
  71. /package/src/contexts/{eip712.json → w3id.org_security_suites_eip712sig-2021_v1.json} +0 -0
@@ -0,0 +1,69 @@
1
+ {
2
+ "@context": [
3
+ {
4
+ "@version": 1.1
5
+ },
6
+ "https://www.w3.org/ns/odrl.jsonld",
7
+ {
8
+ "ex": "https://example.org/examples#",
9
+ "schema": "http://schema.org/",
10
+ "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
11
+ "3rdPartyCorrelation": "ex:3rdPartyCorrelation",
12
+ "AllVerifiers": "ex:AllVerifiers",
13
+ "Archival": "ex:Archival",
14
+ "BachelorDegree": "ex:BachelorDegree",
15
+ "Child": "ex:Child",
16
+ "CLCredentialDefinition2019": "ex:CLCredentialDefinition2019",
17
+ "CLSignature2019": "ex:CLSignature2019",
18
+ "IssuerPolicy": "ex:IssuerPolicy",
19
+ "HolderPolicy": "ex:HolderPolicy",
20
+ "Mother": "ex:Mother",
21
+ "RelationshipCredential": "ex:RelationshipCredential",
22
+ "UniversityDegreeCredential": "ex:UniversityDegreeCredential",
23
+ "AlumniCredential": "ex:AlumniCredential",
24
+ "DisputeCredential": "ex:DisputeCredential",
25
+ "PrescriptionCredential": "ex:PrescriptionCredential",
26
+ "ZkpExampleSchema2018": "ex:ZkpExampleSchema2018",
27
+ "issuerData": "ex:issuerData",
28
+ "attributes": "ex:attributes",
29
+ "signature": "ex:signature",
30
+ "signatureCorrectnessProof": "ex:signatureCorrectnessProof",
31
+ "primaryProof": "ex:primaryProof",
32
+ "nonRevocationProof": "ex:nonRevocationProof",
33
+ "alumniOf": {
34
+ "@id": "schema:alumniOf",
35
+ "@type": "rdf:HTML"
36
+ },
37
+ "child": {
38
+ "@id": "ex:child",
39
+ "@type": "@id"
40
+ },
41
+ "degree": "ex:degree",
42
+ "degreeType": "ex:degreeType",
43
+ "degreeSchool": "ex:degreeSchool",
44
+ "college": "ex:college",
45
+ "name": {
46
+ "@id": "schema:name",
47
+ "@type": "rdf:HTML"
48
+ },
49
+ "givenName": "schema:givenName",
50
+ "familyName": "schema:familyName",
51
+ "parent": {
52
+ "@id": "ex:parent",
53
+ "@type": "@id"
54
+ },
55
+ "referenceId": "ex:referenceId",
56
+ "documentPresence": "ex:documentPresence",
57
+ "evidenceDocument": "ex:evidenceDocument",
58
+ "spouse": "schema:spouse",
59
+ "subjectPresence": "ex:subjectPresence",
60
+ "verifier": {
61
+ "@id": "ex:verifier",
62
+ "@type": "@id"
63
+ },
64
+ "currentStatus": "ex:currentStatus",
65
+ "statusReason": "ex:statusReason",
66
+ "prescription": "ex:prescription"
67
+ }
68
+ ]
69
+ }
@@ -2,102 +2,137 @@
2
2
  "@context": {
3
3
  "@version": 1.1,
4
4
  "@protected": true,
5
-
6
5
  "id": "@id",
7
6
  "type": "@type",
8
-
9
7
  "VerifiableCredential": {
10
8
  "@id": "https://www.w3.org/2018/credentials#VerifiableCredential",
11
9
  "@context": {
12
10
  "@version": 1.1,
13
11
  "@protected": true,
14
-
15
12
  "id": "@id",
16
13
  "type": "@type",
17
-
18
14
  "cred": "https://www.w3.org/2018/credentials#",
19
15
  "sec": "https://w3id.org/security#",
20
16
  "xsd": "http://www.w3.org/2001/XMLSchema#",
21
-
22
17
  "credentialSchema": {
23
18
  "@id": "cred:credentialSchema",
24
19
  "@type": "@id",
25
20
  "@context": {
26
21
  "@version": 1.1,
27
22
  "@protected": true,
28
-
29
23
  "id": "@id",
30
24
  "type": "@type",
31
-
32
25
  "cred": "https://www.w3.org/2018/credentials#",
33
-
34
26
  "JsonSchemaValidator2018": "cred:JsonSchemaValidator2018"
35
27
  }
36
28
  },
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"},
29
+ "credentialStatus": {
30
+ "@id": "cred:credentialStatus",
31
+ "@type": "@id"
32
+ },
33
+ "credentialSubject": {
34
+ "@id": "cred:credentialSubject",
35
+ "@type": "@id"
36
+ },
37
+ "evidence": {
38
+ "@id": "cred:evidence",
39
+ "@type": "@id"
40
+ },
41
+ "expirationDate": {
42
+ "@id": "cred:expirationDate",
43
+ "@type": "xsd:dateTime"
44
+ },
45
+ "holder": {
46
+ "@id": "cred:holder",
47
+ "@type": "@id"
48
+ },
49
+ "issued": {
50
+ "@id": "cred:issued",
51
+ "@type": "xsd:dateTime"
52
+ },
53
+ "issuer": {
54
+ "@id": "cred:issuer",
55
+ "@type": "@id"
56
+ },
57
+ "issuanceDate": {
58
+ "@id": "cred:issuanceDate",
59
+ "@type": "xsd:dateTime"
60
+ },
61
+ "proof": {
62
+ "@id": "sec:proof",
63
+ "@type": "@id",
64
+ "@container": "@graph"
65
+ },
46
66
  "refreshService": {
47
67
  "@id": "cred:refreshService",
48
68
  "@type": "@id",
49
69
  "@context": {
50
70
  "@version": 1.1,
51
71
  "@protected": true,
52
-
53
72
  "id": "@id",
54
73
  "type": "@type",
55
-
56
74
  "cred": "https://www.w3.org/2018/credentials#",
57
-
58
75
  "ManualRefreshService2018": "cred:ManualRefreshService2018"
59
76
  }
60
77
  },
61
- "termsOfUse": {"@id": "cred:termsOfUse", "@type": "@id"},
62
- "validFrom": {"@id": "cred:validFrom", "@type": "xsd:dateTime"},
63
- "validUntil": {"@id": "cred:validUntil", "@type": "xsd:dateTime"}
78
+ "termsOfUse": {
79
+ "@id": "cred:termsOfUse",
80
+ "@type": "@id"
81
+ },
82
+ "validFrom": {
83
+ "@id": "cred:validFrom",
84
+ "@type": "xsd:dateTime"
85
+ },
86
+ "validUntil": {
87
+ "@id": "cred:validUntil",
88
+ "@type": "xsd:dateTime"
89
+ }
64
90
  }
65
91
  },
66
-
67
92
  "VerifiablePresentation": {
68
93
  "@id": "https://www.w3.org/2018/credentials#VerifiablePresentation",
69
94
  "@context": {
70
95
  "@version": 1.1,
71
96
  "@protected": true,
72
-
73
97
  "id": "@id",
74
98
  "type": "@type",
75
-
76
99
  "cred": "https://www.w3.org/2018/credentials#",
77
100
  "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"}
101
+ "holder": {
102
+ "@id": "cred:holder",
103
+ "@type": "@id"
104
+ },
105
+ "proof": {
106
+ "@id": "sec:proof",
107
+ "@type": "@id",
108
+ "@container": "@graph"
109
+ },
110
+ "verifiableCredential": {
111
+ "@id": "cred:verifiableCredential",
112
+ "@type": "@id",
113
+ "@container": "@graph"
114
+ }
82
115
  }
83
116
  },
84
-
85
117
  "EcdsaSecp256k1Signature2019": {
86
118
  "@id": "https://w3id.org/security#EcdsaSecp256k1Signature2019",
87
119
  "@context": {
88
120
  "@version": 1.1,
89
121
  "@protected": true,
90
-
91
122
  "id": "@id",
92
123
  "type": "@type",
93
-
94
124
  "sec": "https://w3id.org/security#",
95
125
  "xsd": "http://www.w3.org/2001/XMLSchema#",
96
-
97
126
  "challenge": "sec:challenge",
98
- "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"},
127
+ "created": {
128
+ "@id": "http://purl.org/dc/terms/created",
129
+ "@type": "xsd:dateTime"
130
+ },
99
131
  "domain": "sec:domain",
100
- "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
132
+ "expires": {
133
+ "@id": "sec:expiration",
134
+ "@type": "xsd:dateTime"
135
+ },
101
136
  "jws": "sec:jws",
102
137
  "nonce": "sec:nonce",
103
138
  "proofPurpose": {
@@ -106,37 +141,47 @@
106
141
  "@context": {
107
142
  "@version": 1.1,
108
143
  "@protected": true,
109
-
110
144
  "id": "@id",
111
145
  "type": "@type",
112
-
113
146
  "sec": "https://w3id.org/security#",
114
-
115
- "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
116
- "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"}
147
+ "assertionMethod": {
148
+ "@id": "sec:assertionMethod",
149
+ "@type": "@id",
150
+ "@container": "@set"
151
+ },
152
+ "authentication": {
153
+ "@id": "sec:authenticationMethod",
154
+ "@type": "@id",
155
+ "@container": "@set"
156
+ }
117
157
  }
118
158
  },
119
159
  "proofValue": "sec:proofValue",
120
- "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"}
160
+ "verificationMethod": {
161
+ "@id": "sec:verificationMethod",
162
+ "@type": "@id"
163
+ }
121
164
  }
122
165
  },
123
-
124
166
  "EcdsaSecp256r1Signature2019": {
125
167
  "@id": "https://w3id.org/security#EcdsaSecp256r1Signature2019",
126
168
  "@context": {
127
169
  "@version": 1.1,
128
170
  "@protected": true,
129
-
130
171
  "id": "@id",
131
172
  "type": "@type",
132
-
133
173
  "sec": "https://w3id.org/security#",
134
174
  "xsd": "http://www.w3.org/2001/XMLSchema#",
135
-
136
175
  "challenge": "sec:challenge",
137
- "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"},
176
+ "created": {
177
+ "@id": "http://purl.org/dc/terms/created",
178
+ "@type": "xsd:dateTime"
179
+ },
138
180
  "domain": "sec:domain",
139
- "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
181
+ "expires": {
182
+ "@id": "sec:expiration",
183
+ "@type": "xsd:dateTime"
184
+ },
140
185
  "jws": "sec:jws",
141
186
  "nonce": "sec:nonce",
142
187
  "proofPurpose": {
@@ -145,37 +190,47 @@
145
190
  "@context": {
146
191
  "@version": 1.1,
147
192
  "@protected": true,
148
-
149
193
  "id": "@id",
150
194
  "type": "@type",
151
-
152
195
  "sec": "https://w3id.org/security#",
153
-
154
- "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
155
- "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"}
196
+ "assertionMethod": {
197
+ "@id": "sec:assertionMethod",
198
+ "@type": "@id",
199
+ "@container": "@set"
200
+ },
201
+ "authentication": {
202
+ "@id": "sec:authenticationMethod",
203
+ "@type": "@id",
204
+ "@container": "@set"
205
+ }
156
206
  }
157
207
  },
158
208
  "proofValue": "sec:proofValue",
159
- "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"}
209
+ "verificationMethod": {
210
+ "@id": "sec:verificationMethod",
211
+ "@type": "@id"
212
+ }
160
213
  }
161
214
  },
162
-
163
215
  "Ed25519Signature2018": {
164
216
  "@id": "https://w3id.org/security#Ed25519Signature2018",
165
217
  "@context": {
166
218
  "@version": 1.1,
167
219
  "@protected": true,
168
-
169
220
  "id": "@id",
170
221
  "type": "@type",
171
-
172
222
  "sec": "https://w3id.org/security#",
173
223
  "xsd": "http://www.w3.org/2001/XMLSchema#",
174
-
175
224
  "challenge": "sec:challenge",
176
- "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"},
225
+ "created": {
226
+ "@id": "http://purl.org/dc/terms/created",
227
+ "@type": "xsd:dateTime"
228
+ },
177
229
  "domain": "sec:domain",
178
- "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
230
+ "expires": {
231
+ "@id": "sec:expiration",
232
+ "@type": "xsd:dateTime"
233
+ },
179
234
  "jws": "sec:jws",
180
235
  "nonce": "sec:nonce",
181
236
  "proofPurpose": {
@@ -184,31 +239,43 @@
184
239
  "@context": {
185
240
  "@version": 1.1,
186
241
  "@protected": true,
187
-
188
242
  "id": "@id",
189
243
  "type": "@type",
190
-
191
244
  "sec": "https://w3id.org/security#",
192
-
193
- "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
194
- "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"}
245
+ "assertionMethod": {
246
+ "@id": "sec:assertionMethod",
247
+ "@type": "@id",
248
+ "@container": "@set"
249
+ },
250
+ "authentication": {
251
+ "@id": "sec:authenticationMethod",
252
+ "@type": "@id",
253
+ "@container": "@set"
254
+ }
195
255
  }
196
256
  },
197
257
  "proofValue": "sec:proofValue",
198
- "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"}
258
+ "verificationMethod": {
259
+ "@id": "sec:verificationMethod",
260
+ "@type": "@id"
261
+ }
199
262
  }
200
263
  },
201
-
202
264
  "RsaSignature2018": {
203
265
  "@id": "https://w3id.org/security#RsaSignature2018",
204
266
  "@context": {
205
267
  "@version": 1.1,
206
268
  "@protected": true,
207
-
208
269
  "challenge": "sec:challenge",
209
- "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"},
270
+ "created": {
271
+ "@id": "http://purl.org/dc/terms/created",
272
+ "@type": "xsd:dateTime"
273
+ },
210
274
  "domain": "sec:domain",
211
- "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
275
+ "expires": {
276
+ "@id": "sec:expiration",
277
+ "@type": "xsd:dateTime"
278
+ },
212
279
  "jws": "sec:jws",
213
280
  "nonce": "sec:nonce",
214
281
  "proofPurpose": {
@@ -217,21 +284,32 @@
217
284
  "@context": {
218
285
  "@version": 1.1,
219
286
  "@protected": true,
220
-
221
287
  "id": "@id",
222
288
  "type": "@type",
223
-
224
289
  "sec": "https://w3id.org/security#",
225
-
226
- "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
227
- "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"}
290
+ "assertionMethod": {
291
+ "@id": "sec:assertionMethod",
292
+ "@type": "@id",
293
+ "@container": "@set"
294
+ },
295
+ "authentication": {
296
+ "@id": "sec:authenticationMethod",
297
+ "@type": "@id",
298
+ "@container": "@set"
299
+ }
228
300
  }
229
301
  },
230
302
  "proofValue": "sec:proofValue",
231
- "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"}
303
+ "verificationMethod": {
304
+ "@id": "sec:verificationMethod",
305
+ "@type": "@id"
306
+ }
232
307
  }
233
308
  },
234
-
235
- "proof": {"@id": "https://w3id.org/security#proof", "@type": "@id", "@container": "@graph"}
309
+ "proof": {
310
+ "@id": "https://w3id.org/security#proof",
311
+ "@type": "@id",
312
+ "@container": "@graph"
313
+ }
236
314
  }
237
- }
315
+ }
@@ -3,7 +3,6 @@
3
3
  "@protected": true,
4
4
  "id": "@id",
5
5
  "type": "@type",
6
-
7
6
  "alsoKnownAs": {
8
7
  "@id": "https://www.w3.org/ns/activitystreams#alsoKnownAs",
9
8
  "@type": "@id"
@@ -10,6 +10,7 @@ import {
10
10
  import fetch from 'cross-fetch'
11
11
  import Debug from 'debug'
12
12
  import jsonldSignatures from '@digitalcredentials/jsonld-signatures'
13
+
13
14
  const { extendContextLoader } = jsonldSignatures
14
15
  import * as vc from '@digitalcredentials/vc'
15
16
  import { LdContextLoader } from './ld-context-loader.js'
@@ -35,7 +36,10 @@ export class LdCredentialModule {
35
36
  this.ldSuiteLoader = options.ldSuiteLoader
36
37
  }
37
38
 
38
- getDocumentLoader(context: IAgentContext<IResolver>, attemptToFetchContexts: boolean = false) {
39
+ getDocumentLoader(
40
+ context: IAgentContext<IResolver>,
41
+ attemptToFetchContexts: boolean = false,
42
+ ) {
39
43
  return extendContextLoader(async (url: string) => {
40
44
  // console.log(`resolving context for: ${url}`)
41
45
 
@@ -46,16 +50,20 @@ export class LdCredentialModule {
46
50
 
47
51
  if (!didDoc) return
48
52
 
53
+ let result: any = didDoc
54
+
49
55
  // currently, Veramo LD suites can modify the resolution response for DIDs from
50
56
  // the document Loader. This allows us to fix incompatibilities between DID Documents
51
57
  // and LD suites to be fixed specifically within the Veramo LD Suites definition
52
- this.ldSuiteLoader.getAllSignatureSuites().forEach((x) => x.preDidResolutionModification(url, didDoc))
58
+ for (const x of this.ldSuiteLoader.getAllSignatureSuites()) {
59
+ result = (await x.preDidResolutionModification(url, result, context)) || result;
60
+ }
53
61
 
54
62
  // console.log(`Returning from Documentloader: ${JSON.stringify(returnDocument)}`)
55
63
  return {
56
64
  contextUrl: null,
57
65
  documentUrl: url,
58
- document: didDoc,
66
+ document: result,
59
67
  }
60
68
  }
61
69
 
@@ -102,7 +110,10 @@ export class LdCredentialModule {
102
110
  options: any,
103
111
  context: IAgentContext<RequiredAgentMethods>,
104
112
  ): Promise<VerifiableCredential> {
105
- const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type, key.meta?.verificationMethod?.type ?? '')
113
+ const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(
114
+ key.type,
115
+ key.meta?.verificationMethod?.type ?? '',
116
+ )
106
117
  const documentLoader = this.getDocumentLoader(context, options.fetchRemoteContexts)
107
118
 
108
119
  // some suites can modify the incoming credential (e.g. add required contexts)
@@ -127,7 +138,10 @@ export class LdCredentialModule {
127
138
  options: any,
128
139
  context: IAgentContext<RequiredAgentMethods>,
129
140
  ): Promise<VerifiablePresentation> {
130
- const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type, key.meta?.verificationMethod?.type ?? '')
141
+ const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(
142
+ key.type,
143
+ key.meta?.verificationMethod?.type ?? '',
144
+ )
131
145
  const documentLoader = this.getDocumentLoader(context, options.fetchRemoteContexts)
132
146
 
133
147
  suite.preSigningPresModification(presentation)
@@ -1,17 +1,20 @@
1
1
  import contextCredentialV1 from './contexts/www.w3.org_2018_credentials_v1.json' assert { type: 'json' }
2
+ import contextCredentialExamplesV1 from './contexts/www.w3.org_2018_credentials_examples_v1.json' assert { type: 'json' }
2
3
  import contextDidV1 from './contexts/www.w3.org_ns_did_v1.json' assert { type: 'json' }
3
4
  import contextSecurityV1 from './contexts/w3id.org_security_v1.json' assert { type: 'json' }
4
5
  import contextSecurityV2 from './contexts/w3id.org_security_v2.json' assert { type: 'json' }
5
6
  import contextSecurityV3 from './contexts/w3id.org_security_v3-unstable.json' assert { type: 'json' }
7
+ import contextSecurityBBSV1 from './contexts/w3id.org_security_bbs_v1.json' assert { type: 'json' }
6
8
  import contextSuitesEd25519 from './contexts/w3id.org_security_suites_ed25519-2018_v1.json' assert { type: 'json' }
7
9
  import contextSuitesX25519 from './contexts/w3id.org_security_suites_x25519-2019_v1.json' assert { type: 'json' }
8
- import contextProfile from './contexts/veramo.io_contexts_profile_v1.json' assert { type: 'json' }
10
+ import contextVeramoProfile from './contexts/veramo.io_contexts_profile_v1.json' assert { type: 'json' }
9
11
  import contextLdsEcdsaSecpRecovery2020_0 from './contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json' assert { type: 'json' }
10
- import contextLdsEcdsaSecpRecovery2020_2 from './contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json' assert { type: 'json' }
11
- import contextSuitesSecp from './contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json' assert { type: 'json' }
12
- import contextSuitesEd25519_2020 from './contexts/ed25519-signature-2020-v1.json' assert { type: 'json' }
13
- import contextSuitesJws_2020 from './contexts/json-web-signature-2020-v1.json' assert { type: 'json' }
14
- import contextSuiteEip712 from './contexts/eip712.json' assert { type: 'json' }
12
+ import contextSuitesSecp256k1Recovery2020 from './contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json' assert { type: 'json' }
13
+ import contextSuitesEd25519_2020 from './contexts/w3id.org_security_suites_ed25519-2020-v1.json' assert { type: 'json' }
14
+ import contextSuitesX25519_2020 from './contexts/w3id.org_security_suites_x25519-2020_v1.json' assert { type: 'json' }
15
+ import contextSuitesJws_2020 from './contexts/w3id.org_security_suites_jws-2020_v1.json' assert { type: 'json' }
16
+ import contextSuiteEip712 from './contexts/w3id.org_security_suites_eip712sig-2021_v1.json' assert { type: 'json' }
17
+ import schema_org from './contexts/schema.org.json' assert { type: 'json' }
15
18
 
16
19
  /**
17
20
  * Provides a hardcoded map of common Linked Data `@context` definitions.
@@ -24,24 +27,30 @@ import contextSuiteEip712 from './contexts/eip712.json' assert { type: 'json' }
24
27
  // @ts-ignore
25
28
  export const LdDefaultContexts = new Map([
26
29
  ['https://www.w3.org/2018/credentials/v1', contextCredentialV1],
30
+ ['https://www.w3.org/2018/credentials/examples/v1', contextCredentialExamplesV1],
27
31
  ['https://www.w3.org/ns/did/v1', contextDidV1],
32
+ ['https://w3id.org/did/v1', contextDidV1], //legacy
28
33
  ['https://w3id.org/security/v1', contextSecurityV1],
29
34
  ['https://w3id.org/security/v2', contextSecurityV2],
30
35
  ['https://w3id.org/security/v3-unstable', contextSecurityV3],
36
+ ['https://w3id.org/security/bbs/v1', contextSecurityBBSV1],
31
37
  ['https://w3id.org/security/suites/ed25519-2018/v1', contextSuitesEd25519],
32
38
  ['https://w3id.org/security/suites/x25519-2019/v1', contextSuitesX25519],
33
39
  ['https://w3id.org/security/suites/ed25519-2020/v1', contextSuitesEd25519_2020],
40
+ ['https://w3id.org/security/suites/x25519-2020/v1', contextSuitesX25519_2020],
34
41
  ['https://w3id.org/security/suites/jws-2020/v1', contextSuitesJws_2020],
35
- ['https://veramo.io/contexts/profile/v1', contextProfile],
42
+ ['https://veramo.io/contexts/profile/v1', contextVeramoProfile],
36
43
  [
37
- 'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld',
44
+ 'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld', //legacy
38
45
  contextLdsEcdsaSecpRecovery2020_0,
39
46
  ],
40
47
  [
41
48
  'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld',
42
- contextLdsEcdsaSecpRecovery2020_2,
49
+ contextSuitesSecp256k1Recovery2020,
43
50
  ],
44
- ['https://w3id.org/security/suites/secp256k1recovery-2020/v2', contextSuitesSecp],
51
+ ['https://w3id.org/security/suites/secp256k1recovery-2020/v2', contextSuitesSecp256k1Recovery2020],
45
52
  ['https://w3id.org/security/suites/eip712sig-2021', contextSuiteEip712],
46
53
  ['https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/', contextSuiteEip712],
54
+ ['https://w3id.org/security/suites/eip712sig-2021/v1', contextSuiteEip712],
55
+ ['https://schema.org', schema_org],
47
56
  ])
package/src/ld-suites.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  CredentialPayload,
3
+ DIDDocComponent,
3
4
  IAgentContext,
4
5
  IKey,
5
6
  IKeyManager,
@@ -35,7 +36,7 @@ export abstract class VeramoLdSignature {
35
36
 
36
37
  abstract getSuiteForVerification(): any
37
38
 
38
- abstract preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void
39
+ abstract preDidResolutionModification(didUrl: string, didDoc: DIDDocument | DIDDocComponent, context: IAgentContext<IResolver>): Promise<DIDDocument | DIDDocComponent>
39
40
 
40
41
  abstract preSigningCredModification(credential: CredentialPayload): void
41
42
 
@@ -1,13 +1,11 @@
1
1
  import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js'
2
2
  import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core-types'
3
3
  import ldsEcdsa from '@veramo-community/lds-ecdsa-secp256k1-recovery2020'
4
- const {
5
- EcdsaSecp256k1RecoveryMethod2020,
6
- EcdsaSecp256k1RecoverySignature2020,
7
- } = ldsEcdsa
8
4
  import * as u8a from 'uint8arrays'
9
5
  import { asArray, encodeJoseBlob } from '@veramo/utils'
10
6
 
7
+ const { EcdsaSecp256k1RecoveryMethod2020, EcdsaSecp256k1RecoverySignature2020 } = ldsEcdsa
8
+
11
9
  /**
12
10
  * Veramo wrapper for the EcdsaSecp256k1RecoverySignature2020 suite by Transmute Industries
13
11
  *
@@ -75,7 +73,7 @@ export class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature
75
73
  preSigningCredModification(credential: CredentialPayload): void {
76
74
  }
77
75
 
78
- preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void {
76
+ async preDidResolutionModification(didUrl: string, didDoc: DIDDocument): Promise<DIDDocument> {
79
77
  // did:ethr
80
78
  const idx = didDoc['@context']?.indexOf('https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld') || -1
81
79
  if (Array.isArray(didDoc['@context']) && idx !== -1) {
@@ -93,6 +91,7 @@ export class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature
93
91
  }
94
92
  })
95
93
  }
94
+ return didDoc
96
95
  }
97
96
  getContext(): string {
98
97
  return 'https://w3id.org/security/suites/secp256k1recovery-2020/v2'
@@ -74,7 +74,8 @@ export class VeramoEd25519Signature2018 extends VeramoLdSignature {
74
74
  // nothing to do here
75
75
  }
76
76
 
77
- preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void {
77
+ async preDidResolutionModification(didUrl: string, didDoc: DIDDocument): Promise<DIDDocument> {
78
78
  // nothing to do here
79
+ return didDoc
79
80
  }
80
81
  }