@veramo/credential-ld 6.0.1-next.4 → 6.0.1-next.40

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 (55) hide show
  1. package/build/CredentialProviderLD.d.ts +42 -0
  2. package/build/CredentialProviderLD.d.ts.map +1 -0
  3. package/build/{action-handler.js → CredentialProviderLD.js} +38 -25
  4. package/build/CredentialProviderLD.js.map +1 -0
  5. package/build/index.d.ts +3 -4
  6. package/build/index.d.ts.map +1 -1
  7. package/build/index.js +3 -4
  8. package/build/index.js.map +1 -1
  9. package/build/ld-credential-module.d.ts +4 -4
  10. package/build/ld-credential-module.d.ts.map +1 -1
  11. package/build/ld-credential-module.js.map +1 -1
  12. package/build/ld-default-contexts.d.ts +1 -1
  13. package/build/ld-default-contexts.js +1 -1
  14. package/build/ld-suites.d.ts +1 -0
  15. package/build/ld-suites.d.ts.map +1 -1
  16. package/build/ld-suites.js.map +1 -1
  17. package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +1 -0
  18. package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
  19. package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +3 -0
  20. package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
  21. package/build/suites/Ed25519Signature2018.d.ts +1 -0
  22. package/build/suites/Ed25519Signature2018.d.ts.map +1 -1
  23. package/build/suites/Ed25519Signature2018.js +3 -0
  24. package/build/suites/Ed25519Signature2018.js.map +1 -1
  25. package/build/suites/Ed25519Signature2020.d.ts +1 -0
  26. package/build/suites/Ed25519Signature2020.d.ts.map +1 -1
  27. package/build/suites/Ed25519Signature2020.js +3 -0
  28. package/build/suites/Ed25519Signature2020.js.map +1 -1
  29. package/build/suites/JsonWebSignature2020.d.ts +1 -0
  30. package/build/suites/JsonWebSignature2020.d.ts.map +1 -1
  31. package/build/suites/JsonWebSignature2020.js +3 -0
  32. package/build/suites/JsonWebSignature2020.js.map +1 -1
  33. package/build/types.d.ts +0 -220
  34. package/build/types.d.ts.map +1 -1
  35. package/package.json +8 -12
  36. package/src/{action-handler.ts → CredentialProviderLD.ts} +61 -40
  37. package/src/__tests__/issue-verify-ed25519-2020.test.ts +122 -122
  38. package/src/__tests__/{issue-verify-flow.test.ts → issue-verify-flow-ld.test.ts} +7 -6
  39. package/src/index.ts +3 -4
  40. package/src/ld-credential-module.ts +4 -3
  41. package/src/ld-default-contexts.ts +1 -1
  42. package/src/ld-suites.ts +2 -0
  43. package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +6 -1
  44. package/src/suites/Ed25519Signature2018.ts +5 -0
  45. package/src/suites/Ed25519Signature2020.ts +5 -1
  46. package/src/suites/JsonWebSignature2020.ts +5 -1
  47. package/src/types.ts +0 -265
  48. package/build/action-handler.d.ts +0 -461
  49. package/build/action-handler.d.ts.map +0 -1
  50. package/build/action-handler.js.map +0 -1
  51. package/build/plugin.schema.d.ts +0 -430
  52. package/build/plugin.schema.d.ts.map +0 -1
  53. package/build/plugin.schema.js +0 -477
  54. package/build/plugin.schema.js.map +0 -1
  55. package/src/plugin.schema.ts +0 -476
package/src/types.ts CHANGED
@@ -1,268 +1,3 @@
1
- import {
2
- CredentialPayload,
3
- IAgentContext,
4
- IDIDManager,
5
- IKey,
6
- IKeyManager,
7
- IPluginMethodMap,
8
- IResolver,
9
- PresentationPayload,
10
- UsingResolutionOptions,
11
- VerifiableCredential,
12
- VerifiablePresentation,
13
- } from '@veramo/core-types'
14
-
15
- /**
16
- * The interface definition for a plugin that can issue and verify Verifiable Credentials and Presentations
17
- * that use JSON-LD format (also called Data Integrity Proofs).
18
- *
19
- * @remarks Please see {@link https://www.w3.org/TR/vc-data-model | W3C Verifiable Credentials data model}
20
- * @see {@link https://www.w3.org/TR/vc-data-model/#data-integrity-proofs | Data Integrity proofs}
21
- *
22
- * @beta This API may change without a BREAKING CHANGE notice.
23
- */
24
- export interface ICredentialIssuerLD extends IPluginMethodMap {
25
- /**
26
- * Creates a Verifiable Presentation.
27
- * The payload, signer and format are chosen based on the `args` parameter.
28
- *
29
- * @param args - Arguments necessary to create the Presentation.
30
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
31
- *
32
- * @returns - a promise that resolves to the {@link @veramo/core-types#VerifiablePresentation} that was requested or
33
- * rejects with an error if there was a problem with the input or while getting the key to sign
34
- *
35
- * @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#presentations | Verifiable Presentation data model
36
- * }
37
- *
38
- * @beta This API may change without a BREAKING CHANGE notice.
39
- */
40
- createVerifiablePresentationLD(
41
- args: ICreateVerifiablePresentationLDArgs,
42
- context: IRequiredContext,
43
- ): Promise<VerifiablePresentation>
44
-
45
- /**
46
- * Creates a Verifiable Credential.
47
- * The payload, signer and format are chosen based on the `args` parameter.
48
- *
49
- * @param args - Arguments necessary to create the Presentation.
50
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
51
- *
52
- * @returns - a promise that resolves to the {@link @veramo/core-types#VerifiableCredential} that was requested or
53
- * rejects with an error if there was a problem with the input or while getting the key to sign
54
- *
55
- * @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#credentials | Verifiable Credential data model}
56
- *
57
- * @beta This API may change without a BREAKING CHANGE notice.
58
- */
59
- createVerifiableCredentialLD(
60
- args: ICreateVerifiableCredentialLDArgs,
61
- context: IRequiredContext,
62
- ): Promise<VerifiableCredential>
63
-
64
- /**
65
- * Verifies a Verifiable Credential JWT or LDS Format.
66
- *
67
- * @param args - Arguments necessary to verify a VerifiableCredential
68
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
69
- *
70
- * @returns - a promise that resolves to the boolean true on successful verification or rejects on error
71
- *
72
- * @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#credentials | Verifiable Credential data model}
73
- *
74
- * @beta This API may change without a BREAKING CHANGE notice.
75
- */
76
- verifyCredentialLD(args: IVerifyCredentialLDArgs, context: IRequiredContext): Promise<boolean>
77
-
78
- /**
79
- * Verifies a Verifiable Presentation JWT or LDS Format.
80
- *
81
- * @param args - Arguments necessary to verify a VerifiableCredential
82
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
83
- *
84
- * @returns - a promise that resolves to the boolean true on successful verification or rejects on error
85
- *
86
- * @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#presentations | Verifiable Credential data model}
87
- *
88
- * @beta This API may change without a BREAKING CHANGE notice.
89
- */
90
- verifyPresentationLD(args: IVerifyPresentationLDArgs, context: IRequiredContext): Promise<boolean>
91
-
92
- /**
93
- * Returns true if the key is supported by any of the installed LD Signature suites
94
- * @param key - the key to verify
95
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
96
- *
97
- * @internal
98
- */
99
- matchKeyForLDSuite(key: IKey, context: IAgentContext<{}>): Promise<boolean>
100
- }
101
-
102
- /**
103
- * Encapsulates the parameters required to create a
104
- * {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Verifiable Presentation}
105
- *
106
- * @beta This API may change without a BREAKING CHANGE notice.
107
- */
108
- export interface ICreateVerifiablePresentationLDArgs extends UsingResolutionOptions {
109
- /**
110
- * The json payload of the Presentation according to the
111
- * {@link https://www.w3.org/TR/vc-data-model/#presentations | canonical model}.
112
- *
113
- * The signer of the Presentation is chosen based on the `holder` property
114
- * of the `presentation`
115
- *
116
- * `@context`, `type` and `issuanceDate` will be added automatically if omitted.
117
- */
118
- presentation: PresentationPayload
119
-
120
- /**
121
- * Optional (only JWT) string challenge parameter to add to the verifiable presentation.
122
- */
123
- challenge?: string
124
-
125
- /**
126
- * Optional string domain parameter to add to the verifiable presentation.
127
- */
128
- domain?: string
129
-
130
- /**
131
- * Optional. The key handle ({@link @veramo/core-types#IKey.kid | IKey.kid}) from the internal database.
132
- */
133
- keyRef?: string
134
-
135
- /**
136
- * Set this to true if you want the `@context` URLs to be fetched in case they are not preloaded.
137
- *
138
- * Defaults to `false`
139
- */
140
- fetchRemoteContexts?: boolean
141
-
142
- /**
143
- * Any other options that can be forwarded to the lower level libraries
144
- */
145
- [x: string]: any
146
- }
147
-
148
- /**
149
- * Encapsulates the parameters required to create a
150
- * {@link https://www.w3.org/TR/vc-data-model/#credentials | W3C Verifiable Credential}
151
- *
152
- * @beta This API may change without a BREAKING CHANGE notice.
153
- */
154
- export interface ICreateVerifiableCredentialLDArgs extends UsingResolutionOptions {
155
- /**
156
- * The json payload of the Credential according to the
157
- * {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model}
158
- *
159
- * The signer of the Credential is chosen based on the `issuer.id` property
160
- * of the `credential`
161
- *
162
- * `@context`, `type` and `issuanceDate` will be added automatically if omitted
163
- */
164
- credential: CredentialPayload
165
-
166
- /**
167
- * Optional. The key handle ({@link @veramo/core-types#IKey.kid | IKey.kid}) from the internal database.
168
- */
169
- keyRef?: string
170
-
171
- /**
172
- * Set this to true if you want the `@context` URLs to be fetched in case they are not preloaded.
173
- *
174
- * Defaults to `false`
175
- */
176
- fetchRemoteContexts?: boolean
177
-
178
- /**
179
- * Any other options that can be forwarded to the lower level libraries
180
- */
181
- [x: string]: any
182
- }
183
-
184
- /**
185
- * Encapsulates the parameters required to verify a
186
- * {@link https://www.w3.org/TR/vc-data-model/#credentials | W3C Verifiable Credential}
187
- *
188
- * @beta This API may change without a BREAKING CHANGE notice
189
- */
190
- export interface IVerifyCredentialLDArgs extends UsingResolutionOptions {
191
- /**
192
- * The json payload of the Credential according to the
193
- * {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model}
194
- *
195
- * The signer of the Credential is chosen based on the `issuer.id` property
196
- * of the `credential`
197
- *
198
- */
199
- credential: VerifiableCredential
200
-
201
- /**
202
- * Set this to true if you want the `@context` URLs to be fetched in case they are not preloaded.
203
- *
204
- * Defaults to `false`
205
- */
206
- fetchRemoteContexts?: boolean
207
-
208
- /**
209
- * Any other options that can be forwarded to the lower level libraries
210
- */
211
- [x: string]: any
212
- }
213
-
214
- /**
215
- * Encapsulates the parameters required to verify a
216
- * {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Verifiable Presentation}
217
- *
218
- * @beta This API may change without a BREAKING CHANGE notice.
219
- */
220
- export interface IVerifyPresentationLDArgs extends UsingResolutionOptions {
221
- /**
222
- * The json payload of the Credential according to the
223
- * {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model}
224
- *
225
- * The signer of the Credential is chosen based on the `issuer.id` property
226
- * of the `credential`
227
- *
228
- */
229
- presentation: VerifiablePresentation
230
-
231
- /**
232
- * Optional (only for JWT) string challenge parameter to verify the verifiable presentation against
233
- */
234
- challenge?: string
235
-
236
- /**
237
- * Optional (only for JWT) string domain parameter to verify the verifiable presentation against
238
- */
239
- domain?: string
240
-
241
- /**
242
- * Set this to true if you want the `@context` URLs to be fetched in case they are not preloaded.
243
- *
244
- * Defaults to `false`
245
- */
246
- fetchRemoteContexts?: boolean
247
-
248
- /**
249
- * Any other options that can be forwarded to the lower level libraries
250
- */
251
- [x: string]: any
252
- }
253
-
254
- /**
255
- * Represents the requirements that this plugin has.
256
- * The agent that is using this plugin is expected to provide these methods.
257
- *
258
- * This interface can be used for static type checks, to make sure your application is properly initialized.
259
- *
260
- * @beta This API may change without a BREAKING CHANGE notice.
261
- */
262
- export type IRequiredContext = IAgentContext<
263
- IResolver & Pick<IDIDManager, 'didManagerGet'> & Pick<IKeyManager, 'keyManagerGet' | 'keyManagerSign'>
264
- >
265
-
266
1
  /**
267
2
  * Describes a document with a `@context` property.
268
3
  *