@veramo/credential-ld 7.0.2 → 8.0.0-next-20261031000417
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.
- package/THIRD_PARTY_NOTICES.md +47 -0
- package/build/contexts/www.w3.org_ns_credentials_undefined-terms_v2.json +5 -0
- package/build/contexts/www.w3.org_ns_credentials_v2.json +301 -0
- package/build/ld-credential-module.d.ts.map +1 -1
- package/build/ld-credential-module.js +17 -21
- package/build/ld-credential-module.js.map +1 -1
- package/build/ld-default-contexts.d.ts +7 -0
- package/build/ld-default-contexts.d.ts.map +1 -1
- package/build/ld-default-contexts.js +15 -0
- package/build/ld-default-contexts.js.map +1 -1
- package/build/ld-suites.d.ts.map +1 -1
- package/build/ld-suites.js +3 -6
- package/build/ld-suites.js.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +25 -39
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
- package/build/suites/Ed25519Signature2018.d.ts +2 -2
- package/build/suites/Ed25519Signature2018.d.ts.map +1 -1
- package/build/suites/Ed25519Signature2018.js +25 -38
- package/build/suites/Ed25519Signature2018.js.map +1 -1
- package/build/suites/Ed25519Signature2020.d.ts +1 -1
- package/build/suites/Ed25519Signature2020.d.ts.map +1 -1
- package/build/suites/Ed25519Signature2020.js +48 -33
- package/build/suites/Ed25519Signature2020.js.map +1 -1
- package/build/suites/JsonWebSignature2020.d.ts +1 -1
- package/build/suites/JsonWebSignature2020.d.ts.map +1 -1
- package/build/suites/JsonWebSignature2020.js +32 -47
- package/build/suites/JsonWebSignature2020.js.map +1 -1
- package/build/suites/jws-detached-signature.d.ts +59 -0
- package/build/suites/jws-detached-signature.d.ts.map +1 -0
- package/build/suites/jws-detached-signature.js +173 -0
- package/build/suites/jws-detached-signature.js.map +1 -0
- package/build/suites/linked-data-signature.d.ts +43 -0
- package/build/suites/linked-data-signature.d.ts.map +1 -0
- package/build/suites/linked-data-signature.js +89 -0
- package/build/suites/linked-data-signature.js.map +1 -0
- package/build/tsdoc-metadata.json +1 -1
- package/build/vc.d.ts +72 -0
- package/build/vc.d.ts.map +1 -0
- package/build/vc.js +245 -0
- package/build/vc.js.map +1 -0
- package/package.json +11 -16
- package/src/__tests__/golden-compat.test.ts +253 -0
- package/src/__tests__/issue-verify-flow-ld.test.ts +115 -1
- package/src/__tests__/jws-detached-signature.test.ts +329 -0
- package/src/__tests__/safe-mode.test.ts +80 -0
- package/src/__tests__/vc.test.ts +141 -0
- package/src/contexts/www.w3.org_ns_credentials_undefined-terms_v2.json +5 -0
- package/src/contexts/www.w3.org_ns_credentials_v2.json +301 -0
- package/src/ld-credential-module.ts +17 -23
- package/src/ld-default-contexts.ts +18 -0
- package/src/ld-suites.ts +8 -7
- package/src/module-types/jsonld/index.d.ts +1 -5
- package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +27 -44
- package/src/suites/Ed25519Signature2018.ts +29 -44
- package/src/suites/Ed25519Signature2020.ts +57 -37
- package/src/suites/JsonWebSignature2020.ts +34 -62
- package/src/suites/jws-detached-signature.ts +246 -0
- package/src/suites/linked-data-signature.ts +109 -0
- package/src/vc.ts +321 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
`@veramo/credential-ld` is licensed under Apache-2.0 (see `LICENSE`). It includes material from the projects below,
|
|
4
|
+
under their own licenses.
|
|
5
|
+
|
|
6
|
+
## @digitalbazaar/vc
|
|
7
|
+
|
|
8
|
+
`src/vc.ts` (and `build/vc.js`) is derived from `@digitalbazaar/vc@7.3.0`
|
|
9
|
+
(`lib/index.js`, `lib/helpers.js`, `lib/CredentialIssuancePurpose.js`), https://github.com/digitalbazaar/vc.
|
|
10
|
+
|
|
11
|
+
BSD 3-Clause License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2017-2021, Digital Bazaar, Inc.
|
|
14
|
+
All rights reserved.
|
|
15
|
+
|
|
16
|
+
Redistribution and use in source and binary forms, with or without
|
|
17
|
+
modification, are permitted provided that the following conditions are met:
|
|
18
|
+
|
|
19
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
20
|
+
list of conditions and the following disclaimer.
|
|
21
|
+
|
|
22
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
23
|
+
this list of conditions and the following disclaimer in the documentation
|
|
24
|
+
and/or other materials provided with the distribution.
|
|
25
|
+
|
|
26
|
+
* Neither the name of the copyright holder nor the names of its
|
|
27
|
+
contributors may be used to endorse or promote products derived from
|
|
28
|
+
this software without specific prior written permission.
|
|
29
|
+
|
|
30
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
31
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
32
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
33
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
34
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
35
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
36
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
37
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
38
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
39
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
40
|
+
|
|
41
|
+
## W3C Verifiable Credentials contexts
|
|
42
|
+
|
|
43
|
+
`src/contexts/www.w3.org_2018_credentials_v1.json`, `src/contexts/www.w3.org_ns_credentials_v2.json` and
|
|
44
|
+
`src/contexts/www.w3.org_ns_credentials_undefined-terms_v2.json` are the JSON-LD contexts published by the W3C at
|
|
45
|
+
https://www.w3.org/2018/credentials/v1, https://www.w3.org/ns/credentials/v2 and
|
|
46
|
+
https://www.w3.org/ns/credentials/undefined-terms/v2, under the W3C Software and Document License,
|
|
47
|
+
https://www.w3.org/copyright/software-license-2023/.
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": {
|
|
3
|
+
"@protected": true,
|
|
4
|
+
"id": "@id",
|
|
5
|
+
"type": "@type",
|
|
6
|
+
"description": "https://schema.org/description",
|
|
7
|
+
"digestMultibase": {
|
|
8
|
+
"@id": "https://w3id.org/security#digestMultibase",
|
|
9
|
+
"@type": "https://w3id.org/security#multibase"
|
|
10
|
+
},
|
|
11
|
+
"digestSRI": {
|
|
12
|
+
"@id": "https://www.w3.org/2018/credentials#digestSRI",
|
|
13
|
+
"@type": "https://www.w3.org/2018/credentials#sriString"
|
|
14
|
+
},
|
|
15
|
+
"mediaType": {
|
|
16
|
+
"@id": "https://schema.org/encodingFormat"
|
|
17
|
+
},
|
|
18
|
+
"name": "https://schema.org/name",
|
|
19
|
+
"VerifiableCredential": {
|
|
20
|
+
"@id": "https://www.w3.org/2018/credentials#VerifiableCredential",
|
|
21
|
+
"@context": {
|
|
22
|
+
"@protected": true,
|
|
23
|
+
"id": "@id",
|
|
24
|
+
"type": "@type",
|
|
25
|
+
"confidenceMethod": {
|
|
26
|
+
"@id": "https://www.w3.org/2018/credentials#confidenceMethod",
|
|
27
|
+
"@type": "@id"
|
|
28
|
+
},
|
|
29
|
+
"credentialSchema": {
|
|
30
|
+
"@id": "https://www.w3.org/2018/credentials#credentialSchema",
|
|
31
|
+
"@type": "@id"
|
|
32
|
+
},
|
|
33
|
+
"credentialStatus": {
|
|
34
|
+
"@id": "https://www.w3.org/2018/credentials#credentialStatus",
|
|
35
|
+
"@type": "@id"
|
|
36
|
+
},
|
|
37
|
+
"credentialSubject": {
|
|
38
|
+
"@id": "https://www.w3.org/2018/credentials#credentialSubject",
|
|
39
|
+
"@type": "@id"
|
|
40
|
+
},
|
|
41
|
+
"description": "https://schema.org/description",
|
|
42
|
+
"evidence": {
|
|
43
|
+
"@id": "https://www.w3.org/2018/credentials#evidence",
|
|
44
|
+
"@type": "@id"
|
|
45
|
+
},
|
|
46
|
+
"issuer": {
|
|
47
|
+
"@id": "https://www.w3.org/2018/credentials#issuer",
|
|
48
|
+
"@type": "@id"
|
|
49
|
+
},
|
|
50
|
+
"name": "https://schema.org/name",
|
|
51
|
+
"proof": {
|
|
52
|
+
"@id": "https://w3id.org/security#proof",
|
|
53
|
+
"@type": "@id",
|
|
54
|
+
"@container": "@graph"
|
|
55
|
+
},
|
|
56
|
+
"refreshService": {
|
|
57
|
+
"@id": "https://www.w3.org/2018/credentials#refreshService",
|
|
58
|
+
"@type": "@id"
|
|
59
|
+
},
|
|
60
|
+
"relatedResource": {
|
|
61
|
+
"@id": "https://www.w3.org/2018/credentials#relatedResource",
|
|
62
|
+
"@type": "@id"
|
|
63
|
+
},
|
|
64
|
+
"renderMethod": {
|
|
65
|
+
"@id": "https://www.w3.org/2018/credentials#renderMethod",
|
|
66
|
+
"@type": "@id"
|
|
67
|
+
},
|
|
68
|
+
"termsOfUse": {
|
|
69
|
+
"@id": "https://www.w3.org/2018/credentials#termsOfUse",
|
|
70
|
+
"@type": "@id"
|
|
71
|
+
},
|
|
72
|
+
"validFrom": {
|
|
73
|
+
"@id": "https://www.w3.org/2018/credentials#validFrom",
|
|
74
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
75
|
+
},
|
|
76
|
+
"validUntil": {
|
|
77
|
+
"@id": "https://www.w3.org/2018/credentials#validUntil",
|
|
78
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"EnvelopedVerifiableCredential": "https://www.w3.org/2018/credentials#EnvelopedVerifiableCredential",
|
|
83
|
+
"VerifiablePresentation": {
|
|
84
|
+
"@id": "https://www.w3.org/2018/credentials#VerifiablePresentation",
|
|
85
|
+
"@context": {
|
|
86
|
+
"@protected": true,
|
|
87
|
+
"id": "@id",
|
|
88
|
+
"type": "@type",
|
|
89
|
+
"holder": {
|
|
90
|
+
"@id": "https://www.w3.org/2018/credentials#holder",
|
|
91
|
+
"@type": "@id"
|
|
92
|
+
},
|
|
93
|
+
"proof": {
|
|
94
|
+
"@id": "https://w3id.org/security#proof",
|
|
95
|
+
"@type": "@id",
|
|
96
|
+
"@container": "@graph"
|
|
97
|
+
},
|
|
98
|
+
"termsOfUse": {
|
|
99
|
+
"@id": "https://www.w3.org/2018/credentials#termsOfUse",
|
|
100
|
+
"@type": "@id"
|
|
101
|
+
},
|
|
102
|
+
"verifiableCredential": {
|
|
103
|
+
"@id": "https://www.w3.org/2018/credentials#verifiableCredential",
|
|
104
|
+
"@type": "@id",
|
|
105
|
+
"@container": "@graph",
|
|
106
|
+
"@context": null
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"EnvelopedVerifiablePresentation": "https://www.w3.org/2018/credentials#EnvelopedVerifiablePresentation",
|
|
111
|
+
"JsonSchemaCredential": "https://www.w3.org/2018/credentials#JsonSchemaCredential",
|
|
112
|
+
"JsonSchema": {
|
|
113
|
+
"@id": "https://www.w3.org/2018/credentials#JsonSchema",
|
|
114
|
+
"@context": {
|
|
115
|
+
"@protected": true,
|
|
116
|
+
"id": "@id",
|
|
117
|
+
"type": "@type",
|
|
118
|
+
"jsonSchema": {
|
|
119
|
+
"@id": "https://www.w3.org/2018/credentials#jsonSchema",
|
|
120
|
+
"@type": "@json"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"BitstringStatusListCredential": "https://www.w3.org/ns/credentials/status#BitstringStatusListCredential",
|
|
125
|
+
"BitstringStatusList": {
|
|
126
|
+
"@id": "https://www.w3.org/ns/credentials/status#BitstringStatusList",
|
|
127
|
+
"@context": {
|
|
128
|
+
"@protected": true,
|
|
129
|
+
"id": "@id",
|
|
130
|
+
"type": "@type",
|
|
131
|
+
"encodedList": {
|
|
132
|
+
"@id": "https://www.w3.org/ns/credentials/status#encodedList",
|
|
133
|
+
"@type": "https://w3id.org/security#multibase"
|
|
134
|
+
},
|
|
135
|
+
"statusPurpose": "https://www.w3.org/ns/credentials/status#statusPurpose",
|
|
136
|
+
"ttl": "https://www.w3.org/ns/credentials/status#ttl"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"BitstringStatusListEntry": {
|
|
140
|
+
"@id": "https://www.w3.org/ns/credentials/status#BitstringStatusListEntry",
|
|
141
|
+
"@context": {
|
|
142
|
+
"@protected": true,
|
|
143
|
+
"id": "@id",
|
|
144
|
+
"type": "@type",
|
|
145
|
+
"statusListCredential": {
|
|
146
|
+
"@id": "https://www.w3.org/ns/credentials/status#statusListCredential",
|
|
147
|
+
"@type": "@id"
|
|
148
|
+
},
|
|
149
|
+
"statusListIndex": "https://www.w3.org/ns/credentials/status#statusListIndex",
|
|
150
|
+
"statusPurpose": "https://www.w3.org/ns/credentials/status#statusPurpose",
|
|
151
|
+
"statusMessage": {
|
|
152
|
+
"@id": "https://www.w3.org/ns/credentials/status#statusMessage",
|
|
153
|
+
"@context": {
|
|
154
|
+
"@protected": true,
|
|
155
|
+
"id": "@id",
|
|
156
|
+
"type": "@type",
|
|
157
|
+
"message": "https://www.w3.org/ns/credentials/status#message",
|
|
158
|
+
"status": "https://www.w3.org/ns/credentials/status#status"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"statusReference": {
|
|
162
|
+
"@id": "https://www.w3.org/ns/credentials/status#statusReference",
|
|
163
|
+
"@type": "@id"
|
|
164
|
+
},
|
|
165
|
+
"statusSize": {
|
|
166
|
+
"@id": "https://www.w3.org/ns/credentials/status#statusSize",
|
|
167
|
+
"@type": "https://www.w3.org/2001/XMLSchema#integer"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"DataIntegrityProof": {
|
|
172
|
+
"@id": "https://w3id.org/security#DataIntegrityProof",
|
|
173
|
+
"@context": {
|
|
174
|
+
"@protected": true,
|
|
175
|
+
"id": "@id",
|
|
176
|
+
"type": "@type",
|
|
177
|
+
"challenge": "https://w3id.org/security#challenge",
|
|
178
|
+
"created": {
|
|
179
|
+
"@id": "http://purl.org/dc/terms/created",
|
|
180
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
181
|
+
},
|
|
182
|
+
"cryptosuite": {
|
|
183
|
+
"@id": "https://w3id.org/security#cryptosuite",
|
|
184
|
+
"@type": "https://w3id.org/security#cryptosuiteString"
|
|
185
|
+
},
|
|
186
|
+
"domain": "https://w3id.org/security#domain",
|
|
187
|
+
"expires": {
|
|
188
|
+
"@id": "https://w3id.org/security#expiration",
|
|
189
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
190
|
+
},
|
|
191
|
+
"nonce": "https://w3id.org/security#nonce",
|
|
192
|
+
"previousProof": {
|
|
193
|
+
"@id": "https://w3id.org/security#previousProof",
|
|
194
|
+
"@type": "@id"
|
|
195
|
+
},
|
|
196
|
+
"proofPurpose": {
|
|
197
|
+
"@id": "https://w3id.org/security#proofPurpose",
|
|
198
|
+
"@type": "@vocab",
|
|
199
|
+
"@context": {
|
|
200
|
+
"@protected": true,
|
|
201
|
+
"id": "@id",
|
|
202
|
+
"type": "@type",
|
|
203
|
+
"assertionMethod": {
|
|
204
|
+
"@id": "https://w3id.org/security#assertionMethod",
|
|
205
|
+
"@type": "@id",
|
|
206
|
+
"@container": "@set"
|
|
207
|
+
},
|
|
208
|
+
"authentication": {
|
|
209
|
+
"@id": "https://w3id.org/security#authenticationMethod",
|
|
210
|
+
"@type": "@id",
|
|
211
|
+
"@container": "@set"
|
|
212
|
+
},
|
|
213
|
+
"capabilityDelegation": {
|
|
214
|
+
"@id": "https://w3id.org/security#capabilityDelegationMethod",
|
|
215
|
+
"@type": "@id",
|
|
216
|
+
"@container": "@set"
|
|
217
|
+
},
|
|
218
|
+
"capabilityInvocation": {
|
|
219
|
+
"@id": "https://w3id.org/security#capabilityInvocationMethod",
|
|
220
|
+
"@type": "@id",
|
|
221
|
+
"@container": "@set"
|
|
222
|
+
},
|
|
223
|
+
"keyAgreement": {
|
|
224
|
+
"@id": "https://w3id.org/security#keyAgreementMethod",
|
|
225
|
+
"@type": "@id",
|
|
226
|
+
"@container": "@set"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"proofValue": {
|
|
231
|
+
"@id": "https://w3id.org/security#proofValue",
|
|
232
|
+
"@type": "https://w3id.org/security#multibase"
|
|
233
|
+
},
|
|
234
|
+
"verificationMethod": {
|
|
235
|
+
"@id": "https://w3id.org/security#verificationMethod",
|
|
236
|
+
"@type": "@id"
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"...": {
|
|
241
|
+
"@id": "https://www.iana.org/assignments/jwt#..."
|
|
242
|
+
},
|
|
243
|
+
"_sd": {
|
|
244
|
+
"@id": "https://www.iana.org/assignments/jwt#_sd",
|
|
245
|
+
"@type": "@json"
|
|
246
|
+
},
|
|
247
|
+
"_sd_alg": {
|
|
248
|
+
"@id": "https://www.iana.org/assignments/jwt#_sd_alg"
|
|
249
|
+
},
|
|
250
|
+
"aud": {
|
|
251
|
+
"@id": "https://www.iana.org/assignments/jwt#aud",
|
|
252
|
+
"@type": "@id"
|
|
253
|
+
},
|
|
254
|
+
"cnf": {
|
|
255
|
+
"@id": "https://www.iana.org/assignments/jwt#cnf",
|
|
256
|
+
"@context": {
|
|
257
|
+
"@protected": true,
|
|
258
|
+
"kid": {
|
|
259
|
+
"@id": "https://www.iana.org/assignments/jwt#kid",
|
|
260
|
+
"@type": "@id"
|
|
261
|
+
},
|
|
262
|
+
"jwk": {
|
|
263
|
+
"@id": "https://www.iana.org/assignments/jwt#jwk",
|
|
264
|
+
"@type": "@json"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
"exp": {
|
|
269
|
+
"@id": "https://www.iana.org/assignments/jwt#exp",
|
|
270
|
+
"@type": "https://www.w3.org/2001/XMLSchema#nonNegativeInteger"
|
|
271
|
+
},
|
|
272
|
+
"iat": {
|
|
273
|
+
"@id": "https://www.iana.org/assignments/jwt#iat",
|
|
274
|
+
"@type": "https://www.w3.org/2001/XMLSchema#nonNegativeInteger"
|
|
275
|
+
},
|
|
276
|
+
"iss": {
|
|
277
|
+
"@id": "https://www.iana.org/assignments/jose#iss",
|
|
278
|
+
"@type": "@id"
|
|
279
|
+
},
|
|
280
|
+
"jku": {
|
|
281
|
+
"@id": "https://www.iana.org/assignments/jose#jku",
|
|
282
|
+
"@type": "@id"
|
|
283
|
+
},
|
|
284
|
+
"kid": {
|
|
285
|
+
"@id": "https://www.iana.org/assignments/jose#kid",
|
|
286
|
+
"@type": "@id"
|
|
287
|
+
},
|
|
288
|
+
"nbf": {
|
|
289
|
+
"@id": "https://www.iana.org/assignments/jwt#nbf",
|
|
290
|
+
"@type": "https://www.w3.org/2001/XMLSchema#nonNegativeInteger"
|
|
291
|
+
},
|
|
292
|
+
"sub": {
|
|
293
|
+
"@id": "https://www.iana.org/assignments/jose#sub",
|
|
294
|
+
"@type": "@id"
|
|
295
|
+
},
|
|
296
|
+
"x5u": {
|
|
297
|
+
"@id": "https://www.iana.org/assignments/jose#x5u",
|
|
298
|
+
"@type": "@id"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ld-credential-module.d.ts","sourceRoot":"","sources":["../src/ld-credential-module.ts"],"names":[],"mappings":"AAA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AAE,mBAAmB,EACjC,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,IAAI,EACT,oBAAoB,EAAE,MAAM,EAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAC3C,OAAO,CAAC,sBAAsB,CAAC,CAiBjC;IAEK,gBAAgB,CACpB,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,GAChC,OAAO,CAAC,aAAa,CAAC,CAexB;IAEK,kBAAkB,CACtB,YAAY,EAAE,sBAAsB,EACpC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,GAChC,OAAO,CAAC,aAAa,CAAC,CAexB;CACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import fetch from 'cross-fetch';
|
|
2
1
|
import Debug from 'debug';
|
|
3
|
-
import jsonldSignatures from '
|
|
2
|
+
import jsonldSignatures from 'jsonld-signatures';
|
|
3
|
+
import { issue, signPresentation, verifyCredential, verifyPresentation } from './vc.js';
|
|
4
4
|
const { extendContextLoader } = jsonldSignatures;
|
|
5
|
-
import
|
|
5
|
+
import { LdCredentialsContexts } from './ld-default-contexts.js';
|
|
6
6
|
const debug = Debug('veramo:w3c:ld-credential-module');
|
|
7
7
|
export class LdCredentialModule {
|
|
8
8
|
/**
|
|
@@ -26,8 +26,10 @@ export class LdCredentialModule {
|
|
|
26
26
|
if (url.toLowerCase().startsWith('did:')) {
|
|
27
27
|
const resolutionResult = await context.agent.resolveDid({ didUrl: url, options: resolutionOptions });
|
|
28
28
|
const didDoc = resolutionResult.didDocument;
|
|
29
|
-
if (!didDoc)
|
|
30
|
-
|
|
29
|
+
if (!didDoc) {
|
|
30
|
+
const reason = resolutionResult.didResolutionMetadata?.error ?? 'notFound';
|
|
31
|
+
throw new Error(`not_found: unable to resolve ${url} (${reason})`);
|
|
32
|
+
}
|
|
31
33
|
let result = didDoc;
|
|
32
34
|
// currently, Veramo LD suites can modify the resolution response for DIDs from
|
|
33
35
|
// the document Loader. This allows us to fix incompatibilities between DID Documents
|
|
@@ -58,7 +60,7 @@ export class LdCredentialModule {
|
|
|
58
60
|
// attempt to fetch the remote context!!!! MEGA FAIL for JSON-LD.
|
|
59
61
|
debug('WARNING: attempting to fetch the doc directly for ', url);
|
|
60
62
|
try {
|
|
61
|
-
const response = await fetch(url);
|
|
63
|
+
const response = await globalThis.fetch(url);
|
|
62
64
|
if (response.status === 200) {
|
|
63
65
|
const document = await response.json();
|
|
64
66
|
return {
|
|
@@ -73,8 +75,10 @@ export class LdCredentialModule {
|
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
if (LdCredentialsContexts.has(url)) {
|
|
79
|
+
return { contextUrl: null, documentUrl: url, document: LdCredentialsContexts.get(url) };
|
|
80
|
+
}
|
|
81
|
+
throw new Error(`Document loader unable to load URL "${url}".`);
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
84
|
async issueLDVerifiableCredential(credential, issuerDid, key, verificationMethodId, options, context) {
|
|
@@ -83,12 +87,10 @@ export class LdCredentialModule {
|
|
|
83
87
|
const documentLoader = this.getDocumentLoader(context, options);
|
|
84
88
|
// some suites can modify the incoming credential (e.g. add required contexts)
|
|
85
89
|
suite.preSigningCredModification(credential);
|
|
86
|
-
return await
|
|
90
|
+
return await issue(credential, {
|
|
87
91
|
...options,
|
|
88
|
-
credential,
|
|
89
92
|
suite: await suite.getSuiteForSigning(key, issuerDid, verificationMethodId, context),
|
|
90
93
|
documentLoader,
|
|
91
|
-
compactProof: false,
|
|
92
94
|
});
|
|
93
95
|
}
|
|
94
96
|
async signLDVerifiablePresentation(presentation, holderDid, key, verificationMethodId, challenge, domain, options, context) {
|
|
@@ -96,25 +98,21 @@ export class LdCredentialModule {
|
|
|
96
98
|
const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type, key.meta?.verificationMethod?.type ?? '')[0];
|
|
97
99
|
const documentLoader = this.getDocumentLoader(context, options);
|
|
98
100
|
suite.preSigningPresModification(presentation);
|
|
99
|
-
return await
|
|
101
|
+
return await signPresentation(presentation, {
|
|
100
102
|
...options,
|
|
101
|
-
presentation,
|
|
102
103
|
suite: await suite.getSuiteForSigning(key, holderDid, verificationMethodId, context),
|
|
103
104
|
challenge,
|
|
104
105
|
domain,
|
|
105
106
|
documentLoader,
|
|
106
|
-
compactProof: false,
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
async verifyCredential(credential, options, context) {
|
|
110
110
|
const fetchRemoteContexts = options.fetchRemoteContexts ?? false;
|
|
111
|
-
|
|
111
|
+
// credential status is checked by @veramo/credential-w3c, not here
|
|
112
|
+
const result = await verifyCredential(credential, {
|
|
112
113
|
...options,
|
|
113
|
-
credential,
|
|
114
114
|
suite: this.ldSuiteLoader.getAllSignatureSuites().map((x) => x.getSuiteForVerification()),
|
|
115
115
|
documentLoader: this.getDocumentLoader(context, { ...options, fetchRemoteContexts }),
|
|
116
|
-
compactProof: false,
|
|
117
|
-
checkStatus: async () => Promise.resolve({ verified: true }), // Fake method
|
|
118
116
|
});
|
|
119
117
|
if (!result.verified) {
|
|
120
118
|
// result can include raw Error
|
|
@@ -124,14 +122,12 @@ export class LdCredentialModule {
|
|
|
124
122
|
}
|
|
125
123
|
async verifyPresentation(presentation, challenge, domain, options, context) {
|
|
126
124
|
const fetchRemoteContexts = options.fetchRemoteContexts ?? false;
|
|
127
|
-
const result = await
|
|
125
|
+
const result = await verifyPresentation(presentation, {
|
|
128
126
|
...options,
|
|
129
|
-
presentation,
|
|
130
127
|
suite: this.ldSuiteLoader.getAllSignatureSuites().map((x) => x.getSuiteForVerification()),
|
|
131
128
|
documentLoader: this.getDocumentLoader(context, { ...options, fetchRemoteContexts }),
|
|
132
129
|
challenge,
|
|
133
130
|
domain,
|
|
134
|
-
compactProof: false,
|
|
135
131
|
});
|
|
136
132
|
if (!result.verified) {
|
|
137
133
|
// result can include raw Error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ld-credential-module.js","sourceRoot":"","sources":["../src/ld-credential-module.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"ld-credential-module.js","sourceRoot":"","sources":["../src/ld-credential-module.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,gBAAgB,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEvF,MAAM,EAAE,mBAAmB,EAAE,GAAG,gBAAgB,CAAA;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAIhE,MAAM,KAAK,GAAG,KAAK,CAAC,iCAAiC,CAAC,CAAA;AAOtD,MAAM,OAAO,kBAAkB;IAC7B;;;;;;OAMG;IAEK,eAAe,CAAiB;IACxC,aAAa,CAAe;IAE5B,YAAY,OAA2E;QACrF,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAA;QAC9C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAA;IAC5C,CAAC;IAED,iBAAiB,CAAC,OAAiC,EAAE,OAA0B;QAC7E,OAAO,mBAAmB,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;YAC/C,MAAM,iBAAiB,GAAG,EAAE,MAAM,EAAE,yBAAyB,EAAE,GAAG,OAAO,EAAE,iBAAiB,EAAE,CAAA;YAC9F,MAAM,sBAAsB,GAAG,OAAO,EAAE,mBAAmB,IAAI,KAAK,CAAA;YAEpE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CHANGE notice.
|
|
9
9
|
*/
|
|
10
10
|
export declare const LdDefaultContexts: Map<string, ContextDoc>;
|
|
11
|
+
/**
|
|
12
|
+
* The credentials contexts the document loader always serves, even when they are not in the configured context maps
|
|
13
|
+
* (as `@digitalbazaar/vc`'s default document loader did).
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const LdCredentialsContexts: Map<string, ContextDoc>;
|
|
11
18
|
//# sourceMappingURL=ld-default-contexts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ld-default-contexts.d.ts","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"ld-default-contexts.d.ts","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAqBvC;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,yBA8B5B,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,yBAMjC,CAAA"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import contextCredentialV1 from './contexts/www.w3.org_2018_credentials_v1.json' with { type: 'json' };
|
|
2
|
+
import contextCredentialV2 from './contexts/www.w3.org_ns_credentials_v2.json' with { type: 'json' };
|
|
3
|
+
import contextUndefinedTermsV2 from './contexts/www.w3.org_ns_credentials_undefined-terms_v2.json' with { type: 'json' };
|
|
2
4
|
import contextCredentialExamplesV1 from './contexts/www.w3.org_2018_credentials_examples_v1.json' with { type: 'json' };
|
|
3
5
|
import contextDidV1 from './contexts/www.w3.org_ns_did_v1.json' with { type: 'json' };
|
|
4
6
|
import contextSecurityV1 from './contexts/w3id.org_security_v1.json' with { type: 'json' };
|
|
@@ -25,6 +27,8 @@ import schema_org from './contexts/schema.org.json' with { type: 'json' };
|
|
|
25
27
|
*/
|
|
26
28
|
export const LdDefaultContexts = new Map([
|
|
27
29
|
['https://www.w3.org/2018/credentials/v1', contextCredentialV1],
|
|
30
|
+
['https://www.w3.org/ns/credentials/v2', contextCredentialV2],
|
|
31
|
+
['https://www.w3.org/ns/credentials/undefined-terms/v2', contextUndefinedTermsV2],
|
|
28
32
|
['https://www.w3.org/2018/credentials/examples/v1', contextCredentialExamplesV1],
|
|
29
33
|
['https://www.w3.org/ns/did/v1', contextDidV1],
|
|
30
34
|
['https://w3id.org/did/v1', contextDidV1], //legacy
|
|
@@ -52,4 +56,15 @@ export const LdDefaultContexts = new Map([
|
|
|
52
56
|
['https://w3id.org/security/suites/eip712sig-2021/v1', contextSuiteEip712],
|
|
53
57
|
['https://schema.org', schema_org],
|
|
54
58
|
]);
|
|
59
|
+
/**
|
|
60
|
+
* The credentials contexts the document loader always serves, even when they are not in the configured context maps
|
|
61
|
+
* (as `@digitalbazaar/vc`'s default document loader did).
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export const LdCredentialsContexts = new Map([
|
|
66
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
67
|
+
'https://www.w3.org/ns/credentials/v2',
|
|
68
|
+
'https://www.w3.org/ns/credentials/undefined-terms/v2',
|
|
69
|
+
].map((url) => [url, LdDefaultContexts.get(url)]));
|
|
55
70
|
//# sourceMappingURL=ld-default-contexts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ld-default-contexts.js","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":"AACA,OAAO,mBAAmB,MAAM,gDAAgD,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACtG,OAAO,2BAA2B,MAAM,yDAAyD,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACvH,OAAO,YAAY,MAAM,sCAAsC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrF,OAAO,i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-suites.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ld-suites.d.ts","sourceRoot":"","sources":["../src/ld-suites.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,IAAI,EACJ,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACT,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,GAAG,gBAAgB,CAAC,CAAA;AAEpG;;;;GAIG;AACH,8BAAsB,iBAAiB;IAMrC,QAAQ,CAAC,4BAA4B,IAAI,MAAM,GAAG,MAAM,EAAE,CAAA;IAE1D,QAAQ,CAAC,qBAAqB,IAAI,MAAM,CAAA;IAExC,QAAQ,CAAC,yBAAyB,IAAI,QAAQ,CAAA;IAE9C,QAAQ,CAAC,kBAAkB,CACzB,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAC3C,GAAG,CAAA;IAEN,QAAQ,CAAC,uBAAuB,IAAI,GAAG,CAAA;IAEvC,QAAQ,CAAC,4BAA4B,
|
|
1
|
+
{"version":3,"file":"ld-suites.d.ts","sourceRoot":"","sources":["../src/ld-suites.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,IAAI,EACJ,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACT,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,GAAG,gBAAgB,CAAC,CAAA;AAEpG;;;;GAIG;AACH,8BAAsB,iBAAiB;IAMrC,QAAQ,CAAC,4BAA4B,IAAI,MAAM,GAAG,MAAM,EAAE,CAAA;IAE1D,QAAQ,CAAC,qBAAqB,IAAI,MAAM,CAAA;IAExC,QAAQ,CAAC,yBAAyB,IAAI,QAAQ,CAAA;IAE9C,QAAQ,CAAC,kBAAkB,CACzB,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAC3C,GAAG,CAAA;IAEN,QAAQ,CAAC,uBAAuB,IAAI,GAAG,CAAA;IAEvC,QAAQ,CAAC,4BAA4B,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,GAAG,eAAe,EACrC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,GAChC,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC,CAAA;IAEzC,QAAQ,CAAC,0BAA0B,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAExE,0BAA0B,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAIlE;CACF"}
|
package/build/ld-suites.js
CHANGED
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export class VeramoLdSignature {
|
|
7
7
|
preSigningPresModification(presentation) {
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
if (sanitizedPresentation?.verifier?.length == 0) {
|
|
12
|
-
delete sanitizedPresentation.verifier;
|
|
13
|
-
}
|
|
8
|
+
// `verifier` is Veramo-only (JWT `aud`); no credentials context defines it, so safe mode would throw.
|
|
9
|
+
// LD proofs bind the audience through `domain` and `challenge` instead.
|
|
10
|
+
delete presentation.verifier;
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
13
|
//# sourceMappingURL=ld-suites.js.map
|
package/build/ld-suites.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ld-suites.js","sourceRoot":"","sources":["../src/ld-suites.ts"],"names":[],"mappings":"AAcA;;;;GAIG;AACH,MAAM,OAAgB,iBAAiB;
|
|
1
|
+
{"version":3,"file":"ld-suites.js","sourceRoot":"","sources":["../src/ld-suites.ts"],"names":[],"mappings":"AAcA;;;;GAIG;AACH,MAAM,OAAgB,iBAAiB;IA6BrC,0BAA0B,CAAC,YAAiC;QAC1D,sGAAsG;QACtG,wEAAwE;QACxE,OAAQ,YAAoB,CAAC,QAAQ,CAAA;IACvC,CAAC;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js';
|
|
2
2
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core-types';
|
|
3
3
|
/**
|
|
4
|
-
* Veramo wrapper for the EcdsaSecp256k1RecoverySignature2020 suite
|
|
4
|
+
* Veramo wrapper for the EcdsaSecp256k1RecoverySignature2020 suite
|
|
5
5
|
*
|
|
6
6
|
* @alpha This API is experimental and is very likely to change or disappear in future releases without notice.
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EcdsaSecp256k1RecoverySignature2020.d.ts","sourceRoot":"","sources":["../../src/suites/EcdsaSecp256k1RecoverySignature2020.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"EcdsaSecp256k1RecoverySignature2020.d.ts","sourceRoot":"","sources":["../../src/suites/EcdsaSecp256k1RecoverySignature2020.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAuBlG;;;;GAIG;AACH,qBAAa,yCAA0C,SAAQ,iBAAiB;IAC9E,4BAA4B,IAAI,MAAM,CAIrC;IAED,qBAAqB,IAAI,MAAM,CAE9B;IAED,yBAAyB,IAAI,QAAQ,CAEpC;IAED,kBAAkB,CAChB,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,MAAM,EACX,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAC3C,GAAG,CAML;IAED,uBAAuB,IAAI,GAAG,CAE7B;IAED,0BAA0B,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAG;IAE5D,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAgC5F;IAED,UAAU,IAAI,MAAM,CAEnB;CACF"}
|