@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.
- package/build/CredentialProviderLD.d.ts +42 -0
- package/build/CredentialProviderLD.d.ts.map +1 -0
- package/build/{action-handler.js → CredentialProviderLD.js} +38 -25
- package/build/CredentialProviderLD.js.map +1 -0
- package/build/index.d.ts +3 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -4
- package/build/index.js.map +1 -1
- package/build/ld-credential-module.d.ts +4 -4
- package/build/ld-credential-module.d.ts.map +1 -1
- package/build/ld-credential-module.js.map +1 -1
- package/build/ld-default-contexts.d.ts +1 -1
- package/build/ld-default-contexts.js +1 -1
- package/build/ld-suites.d.ts +1 -0
- package/build/ld-suites.d.ts.map +1 -1
- package/build/ld-suites.js.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +1 -0
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +3 -0
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
- package/build/suites/Ed25519Signature2018.d.ts +1 -0
- package/build/suites/Ed25519Signature2018.d.ts.map +1 -1
- package/build/suites/Ed25519Signature2018.js +3 -0
- package/build/suites/Ed25519Signature2018.js.map +1 -1
- package/build/suites/Ed25519Signature2020.d.ts +1 -0
- package/build/suites/Ed25519Signature2020.d.ts.map +1 -1
- package/build/suites/Ed25519Signature2020.js +3 -0
- package/build/suites/Ed25519Signature2020.js.map +1 -1
- package/build/suites/JsonWebSignature2020.d.ts +1 -0
- package/build/suites/JsonWebSignature2020.d.ts.map +1 -1
- package/build/suites/JsonWebSignature2020.js +3 -0
- package/build/suites/JsonWebSignature2020.js.map +1 -1
- package/build/types.d.ts +0 -220
- package/build/types.d.ts.map +1 -1
- package/package.json +8 -12
- package/src/{action-handler.ts → CredentialProviderLD.ts} +61 -40
- package/src/__tests__/issue-verify-ed25519-2020.test.ts +122 -122
- package/src/__tests__/{issue-verify-flow.test.ts → issue-verify-flow-ld.test.ts} +7 -6
- package/src/index.ts +3 -4
- package/src/ld-credential-module.ts +4 -3
- package/src/ld-default-contexts.ts +1 -1
- package/src/ld-suites.ts +2 -0
- package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +6 -1
- package/src/suites/Ed25519Signature2018.ts +5 -0
- package/src/suites/Ed25519Signature2020.ts +5 -1
- package/src/suites/JsonWebSignature2020.ts +5 -1
- package/src/types.ts +0 -265
- package/build/action-handler.d.ts +0 -461
- package/build/action-handler.d.ts.map +0 -1
- package/build/action-handler.js.map +0 -1
- package/build/plugin.schema.d.ts +0 -430
- package/build/plugin.schema.d.ts.map +0 -1
- package/build/plugin.schema.js +0 -477
- package/build/plugin.schema.js.map +0 -1
- package/src/plugin.schema.ts +0 -476
package/build/types.d.ts
CHANGED
|
@@ -1,223 +1,3 @@
|
|
|
1
|
-
import { CredentialPayload, IAgentContext, IDIDManager, IKey, IKeyManager, IPluginMethodMap, IResolver, PresentationPayload, UsingResolutionOptions, VerifiableCredential, VerifiablePresentation } from '@veramo/core-types';
|
|
2
|
-
/**
|
|
3
|
-
* The interface definition for a plugin that can issue and verify Verifiable Credentials and Presentations
|
|
4
|
-
* that use JSON-LD format (also called Data Integrity Proofs).
|
|
5
|
-
*
|
|
6
|
-
* @remarks Please see {@link https://www.w3.org/TR/vc-data-model | W3C Verifiable Credentials data model}
|
|
7
|
-
* @see {@link https://www.w3.org/TR/vc-data-model/#data-integrity-proofs | Data Integrity proofs}
|
|
8
|
-
*
|
|
9
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
10
|
-
*/
|
|
11
|
-
export interface ICredentialIssuerLD extends IPluginMethodMap {
|
|
12
|
-
/**
|
|
13
|
-
* Creates a Verifiable Presentation.
|
|
14
|
-
* The payload, signer and format are chosen based on the `args` parameter.
|
|
15
|
-
*
|
|
16
|
-
* @param args - Arguments necessary to create the Presentation.
|
|
17
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
18
|
-
*
|
|
19
|
-
* @returns - a promise that resolves to the {@link @veramo/core-types#VerifiablePresentation} that was requested or
|
|
20
|
-
* rejects with an error if there was a problem with the input or while getting the key to sign
|
|
21
|
-
*
|
|
22
|
-
* @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#presentations | Verifiable Presentation data model
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
26
|
-
*/
|
|
27
|
-
createVerifiablePresentationLD(args: ICreateVerifiablePresentationLDArgs, context: IRequiredContext): Promise<VerifiablePresentation>;
|
|
28
|
-
/**
|
|
29
|
-
* Creates a Verifiable Credential.
|
|
30
|
-
* The payload, signer and format are chosen based on the `args` parameter.
|
|
31
|
-
*
|
|
32
|
-
* @param args - Arguments necessary to create the Presentation.
|
|
33
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
34
|
-
*
|
|
35
|
-
* @returns - a promise that resolves to the {@link @veramo/core-types#VerifiableCredential} that was requested or
|
|
36
|
-
* rejects with an error if there was a problem with the input or while getting the key to sign
|
|
37
|
-
*
|
|
38
|
-
* @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#credentials | Verifiable Credential data model}
|
|
39
|
-
*
|
|
40
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
41
|
-
*/
|
|
42
|
-
createVerifiableCredentialLD(args: ICreateVerifiableCredentialLDArgs, context: IRequiredContext): Promise<VerifiableCredential>;
|
|
43
|
-
/**
|
|
44
|
-
* Verifies a Verifiable Credential JWT or LDS Format.
|
|
45
|
-
*
|
|
46
|
-
* @param args - Arguments necessary to verify a VerifiableCredential
|
|
47
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
48
|
-
*
|
|
49
|
-
* @returns - a promise that resolves to the boolean true on successful verification or rejects on error
|
|
50
|
-
*
|
|
51
|
-
* @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#credentials | Verifiable Credential data model}
|
|
52
|
-
*
|
|
53
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
54
|
-
*/
|
|
55
|
-
verifyCredentialLD(args: IVerifyCredentialLDArgs, context: IRequiredContext): Promise<boolean>;
|
|
56
|
-
/**
|
|
57
|
-
* Verifies a Verifiable Presentation JWT or LDS Format.
|
|
58
|
-
*
|
|
59
|
-
* @param args - Arguments necessary to verify a VerifiableCredential
|
|
60
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
61
|
-
*
|
|
62
|
-
* @returns - a promise that resolves to the boolean true on successful verification or rejects on error
|
|
63
|
-
*
|
|
64
|
-
* @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#presentations | Verifiable Credential data model}
|
|
65
|
-
*
|
|
66
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
67
|
-
*/
|
|
68
|
-
verifyPresentationLD(args: IVerifyPresentationLDArgs, context: IRequiredContext): Promise<boolean>;
|
|
69
|
-
/**
|
|
70
|
-
* Returns true if the key is supported by any of the installed LD Signature suites
|
|
71
|
-
* @param key - the key to verify
|
|
72
|
-
* @param context - This reserved param is automatically added and handled by the framework, *do not override*
|
|
73
|
-
*
|
|
74
|
-
* @internal
|
|
75
|
-
*/
|
|
76
|
-
matchKeyForLDSuite(key: IKey, context: IAgentContext<{}>): Promise<boolean>;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Encapsulates the parameters required to create a
|
|
80
|
-
* {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Verifiable Presentation}
|
|
81
|
-
*
|
|
82
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
83
|
-
*/
|
|
84
|
-
export interface ICreateVerifiablePresentationLDArgs extends UsingResolutionOptions {
|
|
85
|
-
/**
|
|
86
|
-
* The json payload of the Presentation according to the
|
|
87
|
-
* {@link https://www.w3.org/TR/vc-data-model/#presentations | canonical model}.
|
|
88
|
-
*
|
|
89
|
-
* The signer of the Presentation is chosen based on the `holder` property
|
|
90
|
-
* of the `presentation`
|
|
91
|
-
*
|
|
92
|
-
* `@context`, `type` and `issuanceDate` will be added automatically if omitted.
|
|
93
|
-
*/
|
|
94
|
-
presentation: PresentationPayload;
|
|
95
|
-
/**
|
|
96
|
-
* Optional (only JWT) string challenge parameter to add to the verifiable presentation.
|
|
97
|
-
*/
|
|
98
|
-
challenge?: string;
|
|
99
|
-
/**
|
|
100
|
-
* Optional string domain parameter to add to the verifiable presentation.
|
|
101
|
-
*/
|
|
102
|
-
domain?: string;
|
|
103
|
-
/**
|
|
104
|
-
* Optional. The key handle ({@link @veramo/core-types#IKey.kid | IKey.kid}) from the internal database.
|
|
105
|
-
*/
|
|
106
|
-
keyRef?: string;
|
|
107
|
-
/**
|
|
108
|
-
* Set this to true if you want the `@context` URLs to be fetched in case they are not preloaded.
|
|
109
|
-
*
|
|
110
|
-
* Defaults to `false`
|
|
111
|
-
*/
|
|
112
|
-
fetchRemoteContexts?: boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Any other options that can be forwarded to the lower level libraries
|
|
115
|
-
*/
|
|
116
|
-
[x: string]: any;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Encapsulates the parameters required to create a
|
|
120
|
-
* {@link https://www.w3.org/TR/vc-data-model/#credentials | W3C Verifiable Credential}
|
|
121
|
-
*
|
|
122
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
123
|
-
*/
|
|
124
|
-
export interface ICreateVerifiableCredentialLDArgs extends UsingResolutionOptions {
|
|
125
|
-
/**
|
|
126
|
-
* The json payload of the Credential according to the
|
|
127
|
-
* {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model}
|
|
128
|
-
*
|
|
129
|
-
* The signer of the Credential is chosen based on the `issuer.id` property
|
|
130
|
-
* of the `credential`
|
|
131
|
-
*
|
|
132
|
-
* `@context`, `type` and `issuanceDate` will be added automatically if omitted
|
|
133
|
-
*/
|
|
134
|
-
credential: CredentialPayload;
|
|
135
|
-
/**
|
|
136
|
-
* Optional. The key handle ({@link @veramo/core-types#IKey.kid | IKey.kid}) from the internal database.
|
|
137
|
-
*/
|
|
138
|
-
keyRef?: string;
|
|
139
|
-
/**
|
|
140
|
-
* Set this to true if you want the `@context` URLs to be fetched in case they are not preloaded.
|
|
141
|
-
*
|
|
142
|
-
* Defaults to `false`
|
|
143
|
-
*/
|
|
144
|
-
fetchRemoteContexts?: boolean;
|
|
145
|
-
/**
|
|
146
|
-
* Any other options that can be forwarded to the lower level libraries
|
|
147
|
-
*/
|
|
148
|
-
[x: string]: any;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Encapsulates the parameters required to verify a
|
|
152
|
-
* {@link https://www.w3.org/TR/vc-data-model/#credentials | W3C Verifiable Credential}
|
|
153
|
-
*
|
|
154
|
-
* @beta This API may change without a BREAKING CHANGE notice
|
|
155
|
-
*/
|
|
156
|
-
export interface IVerifyCredentialLDArgs extends UsingResolutionOptions {
|
|
157
|
-
/**
|
|
158
|
-
* The json payload of the Credential according to the
|
|
159
|
-
* {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model}
|
|
160
|
-
*
|
|
161
|
-
* The signer of the Credential is chosen based on the `issuer.id` property
|
|
162
|
-
* of the `credential`
|
|
163
|
-
*
|
|
164
|
-
*/
|
|
165
|
-
credential: VerifiableCredential;
|
|
166
|
-
/**
|
|
167
|
-
* Set this to true if you want the `@context` URLs to be fetched in case they are not preloaded.
|
|
168
|
-
*
|
|
169
|
-
* Defaults to `false`
|
|
170
|
-
*/
|
|
171
|
-
fetchRemoteContexts?: boolean;
|
|
172
|
-
/**
|
|
173
|
-
* Any other options that can be forwarded to the lower level libraries
|
|
174
|
-
*/
|
|
175
|
-
[x: string]: any;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Encapsulates the parameters required to verify a
|
|
179
|
-
* {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Verifiable Presentation}
|
|
180
|
-
*
|
|
181
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
182
|
-
*/
|
|
183
|
-
export interface IVerifyPresentationLDArgs extends UsingResolutionOptions {
|
|
184
|
-
/**
|
|
185
|
-
* The json payload of the Credential according to the
|
|
186
|
-
* {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model}
|
|
187
|
-
*
|
|
188
|
-
* The signer of the Credential is chosen based on the `issuer.id` property
|
|
189
|
-
* of the `credential`
|
|
190
|
-
*
|
|
191
|
-
*/
|
|
192
|
-
presentation: VerifiablePresentation;
|
|
193
|
-
/**
|
|
194
|
-
* Optional (only for JWT) string challenge parameter to verify the verifiable presentation against
|
|
195
|
-
*/
|
|
196
|
-
challenge?: string;
|
|
197
|
-
/**
|
|
198
|
-
* Optional (only for JWT) string domain parameter to verify the verifiable presentation against
|
|
199
|
-
*/
|
|
200
|
-
domain?: string;
|
|
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
|
-
* Any other options that can be forwarded to the lower level libraries
|
|
209
|
-
*/
|
|
210
|
-
[x: string]: any;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Represents the requirements that this plugin has.
|
|
214
|
-
* The agent that is using this plugin is expected to provide these methods.
|
|
215
|
-
*
|
|
216
|
-
* This interface can be used for static type checks, to make sure your application is properly initialized.
|
|
217
|
-
*
|
|
218
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
219
|
-
*/
|
|
220
|
-
export type IRequiredContext = IAgentContext<IResolver & Pick<IDIDManager, 'didManagerGet'> & Pick<IKeyManager, 'keyManagerGet' | 'keyManagerSign'>>;
|
|
221
1
|
/**
|
|
222
2
|
* Describes a document with a `@context` property.
|
|
223
3
|
*
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAChC,CAAA"}
|
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": "6.0.1-next.
|
|
4
|
+
"version": "6.0.1-next.40+f5e14b0b4",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./build/index.js"
|
|
@@ -9,12 +9,7 @@
|
|
|
9
9
|
"types": "build/index.d.ts",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
|
-
"
|
|
13
|
-
},
|
|
14
|
-
"veramo": {
|
|
15
|
-
"pluginInterfaces": {
|
|
16
|
-
"ICredentialIssuerLD": "./src/action-handler.ts"
|
|
17
|
-
}
|
|
12
|
+
"extract-api": "node ../cli/bin/veramo.js dev extract-api"
|
|
18
13
|
},
|
|
19
14
|
"dependencies": {
|
|
20
15
|
"@digitalcredentials/ed25519-signature-2020": "^4.0.0",
|
|
@@ -26,20 +21,21 @@
|
|
|
26
21
|
"@transmute/ed25519-signature-2018": "^0.7.0-unstable.81",
|
|
27
22
|
"@transmute/json-web-signature": "^0.7.0-unstable.81",
|
|
28
23
|
"@veramo-community/lds-ecdsa-secp256k1-recovery2020": "uport-project/EcdsaSecp256k1RecoverySignature2020",
|
|
29
|
-
"@veramo/core-types": "^6.0.1-next.
|
|
30
|
-
"@veramo/
|
|
24
|
+
"@veramo/core-types": "^6.0.1-next.40+f5e14b0b4",
|
|
25
|
+
"@veramo/credential-w3c": "^6.0.1-next.40+f5e14b0b4",
|
|
26
|
+
"@veramo/utils": "^6.0.1-next.40+f5e14b0b4",
|
|
31
27
|
"cross-fetch": "^4.0.0",
|
|
32
28
|
"debug": "^4.3.3",
|
|
33
29
|
"did-resolver": "^4.1.0"
|
|
34
30
|
},
|
|
35
31
|
"resolutions": {
|
|
36
|
-
"@types/react": "
|
|
32
|
+
"@types/react": "19.0.8",
|
|
37
33
|
"jsonld": "npm:@digitalcredentials/jsonld@^6.0.0"
|
|
38
34
|
},
|
|
39
35
|
"devDependencies": {
|
|
40
36
|
"@types/debug": "4.1.8",
|
|
41
37
|
"borc": "3.0.0",
|
|
42
|
-
"typescript": "5.
|
|
38
|
+
"typescript": "5.7.3"
|
|
43
39
|
},
|
|
44
40
|
"files": [
|
|
45
41
|
"build/**/*",
|
|
@@ -81,5 +77,5 @@
|
|
|
81
77
|
"node_modules",
|
|
82
78
|
"src"
|
|
83
79
|
],
|
|
84
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "f5e14b0b4523771b9018bce9b229217bfe505135"
|
|
85
81
|
}
|
|
@@ -2,15 +2,23 @@ import {
|
|
|
2
2
|
CredentialPayload,
|
|
3
3
|
IAgentContext,
|
|
4
4
|
IAgentPlugin,
|
|
5
|
+
ICanIssueCredentialTypeArgs,
|
|
6
|
+
ICreateVerifiableCredentialArgs,
|
|
7
|
+
ICreateVerifiablePresentationArgs,
|
|
5
8
|
IIdentifier,
|
|
6
9
|
IKey,
|
|
7
10
|
IResolver,
|
|
11
|
+
IssuerAgentContext,
|
|
12
|
+
IVerifyCredentialArgs,
|
|
13
|
+
IVerifyPresentationArgs,
|
|
14
|
+
IVerifyResult,
|
|
8
15
|
PresentationPayload,
|
|
9
16
|
VerifiableCredential,
|
|
10
17
|
VerifiablePresentation,
|
|
18
|
+
VerifierAgentContext,
|
|
19
|
+
ICanVerifyDocumentTypeArgs,
|
|
11
20
|
} from '@veramo/core-types'
|
|
12
21
|
import { VeramoLdSignature } from './index.js'
|
|
13
|
-
import { schema } from './plugin.schema.js'
|
|
14
22
|
import Debug from 'debug'
|
|
15
23
|
import { LdContextLoader } from './ld-context-loader.js'
|
|
16
24
|
import {
|
|
@@ -30,25 +38,19 @@ import { LdCredentialModule } from './ld-credential-module.js'
|
|
|
30
38
|
import { LdSuiteLoader } from './ld-suite-loader.js'
|
|
31
39
|
import {
|
|
32
40
|
ContextDoc,
|
|
33
|
-
ICreateVerifiableCredentialLDArgs,
|
|
34
|
-
ICreateVerifiablePresentationLDArgs,
|
|
35
|
-
ICredentialIssuerLD,
|
|
36
|
-
IRequiredContext,
|
|
37
|
-
IVerifyCredentialLDArgs,
|
|
38
|
-
IVerifyPresentationLDArgs,
|
|
39
41
|
} from './types.js'
|
|
40
42
|
import { DIDResolutionOptions } from 'did-resolver'
|
|
41
43
|
|
|
44
|
+
import { AbstractCredentialProvider } from '@veramo/credential-w3c'
|
|
45
|
+
|
|
42
46
|
const debug = Debug('veramo:credential-ld:action-handler')
|
|
43
47
|
|
|
44
48
|
/**
|
|
45
|
-
* A
|
|
49
|
+
* A handler that implements the {@link AbstractCredentialProvider} methods.
|
|
46
50
|
*
|
|
47
51
|
* @public
|
|
48
52
|
*/
|
|
49
|
-
export class
|
|
50
|
-
readonly methods: ICredentialIssuerLD
|
|
51
|
-
readonly schema = schema.ICredentialIssuerLD
|
|
53
|
+
export class CredentialProviderLD implements AbstractCredentialProvider {
|
|
52
54
|
|
|
53
55
|
private ldCredentialModule: LdCredentialModule
|
|
54
56
|
|
|
@@ -57,20 +59,40 @@ export class CredentialIssuerLD implements IAgentPlugin {
|
|
|
57
59
|
ldContextLoader: new LdContextLoader({ contextsPaths: options.contextMaps }),
|
|
58
60
|
ldSuiteLoader: new LdSuiteLoader({ veramoLdSignatures: options.suites }),
|
|
59
61
|
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** {@inheritdoc @veramo/credential-w3c#AbstractCredentialProvider.matchKeyForType} */
|
|
65
|
+
matchKeyForType(key: IKey): boolean {
|
|
66
|
+
return this.matchKeyForLDSuite(key)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** {@inheritdoc @veramo/credential-w3c#AbstractCredentialProvider.getTypeProofFormat} */
|
|
70
|
+
getTypeProofFormat(): string {
|
|
71
|
+
return 'lds'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** {@inheritdoc @veramo/credential-w3c#AbstractCredentialProvider.canIssueCredentialType} */
|
|
75
|
+
canIssueCredentialType(args: ICanIssueCredentialTypeArgs): boolean {
|
|
76
|
+
return (args.proofFormat === 'lds')
|
|
77
|
+
}
|
|
60
78
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
79
|
+
/** {@inheritdoc @veramo/credential-w3c#AbstractCredentialProvider.canVerifyDocumentType */
|
|
80
|
+
canVerifyDocumentType(args: ICanVerifyDocumentTypeArgs): boolean {
|
|
81
|
+
const { document } = args
|
|
82
|
+
|
|
83
|
+
for (const suite of this.ldCredentialModule.ldSuiteLoader.getAllSignatureSuites()) {
|
|
84
|
+
if (suite.getSupportedProofType() === (<VerifiableCredential>document)?.proof?.type || '') {
|
|
85
|
+
return true
|
|
86
|
+
}
|
|
67
87
|
}
|
|
88
|
+
|
|
89
|
+
return false
|
|
68
90
|
}
|
|
69
91
|
|
|
70
|
-
/** {@inheritdoc
|
|
71
|
-
|
|
72
|
-
args:
|
|
73
|
-
context:
|
|
92
|
+
/** {@inheritdoc ICredentialIssuer.createVerifiablePresentationLD} */
|
|
93
|
+
async createVerifiablePresentation(
|
|
94
|
+
args: ICreateVerifiablePresentationArgs,
|
|
95
|
+
context: IssuerAgentContext,
|
|
74
96
|
): Promise<VerifiablePresentation> {
|
|
75
97
|
const presentationContext = processEntryToArray(
|
|
76
98
|
args?.presentation?.['@context'],
|
|
@@ -139,10 +161,10 @@ export class CredentialIssuerLD implements IAgentPlugin {
|
|
|
139
161
|
}
|
|
140
162
|
}
|
|
141
163
|
|
|
142
|
-
/** {@inheritdoc
|
|
143
|
-
|
|
144
|
-
args:
|
|
145
|
-
context:
|
|
164
|
+
/** {@inheritdoc ICredentialIssuer.createVerifiableCredentialLD} */
|
|
165
|
+
async createVerifiableCredential(
|
|
166
|
+
args: ICreateVerifiableCredentialArgs,
|
|
167
|
+
context: IssuerAgentContext,
|
|
146
168
|
): Promise<VerifiableCredential> {
|
|
147
169
|
const credentialContext = processEntryToArray(
|
|
148
170
|
args?.credential?.['@context'],
|
|
@@ -193,27 +215,26 @@ export class CredentialIssuerLD implements IAgentPlugin {
|
|
|
193
215
|
}
|
|
194
216
|
}
|
|
195
217
|
|
|
196
|
-
/** {@inheritdoc
|
|
197
|
-
|
|
198
|
-
args
|
|
199
|
-
context: IRequiredContext,
|
|
200
|
-
): Promise<boolean> {
|
|
218
|
+
/** {@inheritdoc ICredentialIssuer.verifyCredentialLD} */
|
|
219
|
+
async verifyCredential(args: IVerifyCredentialArgs, context: VerifierAgentContext): Promise<IVerifyResult> {
|
|
220
|
+
args.credential = args.credential as VerifiableCredential
|
|
201
221
|
const credential = args.credential
|
|
202
222
|
|
|
203
|
-
let
|
|
204
|
-
|
|
205
|
-
|
|
223
|
+
let now = new Date()
|
|
224
|
+
|
|
225
|
+
if (args.policies?.now && typeof args.policies?.now === 'number') {
|
|
226
|
+
now = new Date(args.policies?.now * 1000)
|
|
206
227
|
}
|
|
207
228
|
|
|
208
229
|
return this.ldCredentialModule.verifyCredential(credential, { ...args, now }, context)
|
|
209
230
|
}
|
|
210
231
|
|
|
211
|
-
/** {@inheritdoc
|
|
212
|
-
|
|
213
|
-
args:
|
|
214
|
-
context:
|
|
215
|
-
): Promise<
|
|
216
|
-
const presentation = args.presentation
|
|
232
|
+
/** {@inheritdoc ICredentialVerifier.verifyPresentation} */
|
|
233
|
+
async verifyPresentation(
|
|
234
|
+
args: IVerifyPresentationArgs,
|
|
235
|
+
context: VerifierAgentContext,
|
|
236
|
+
): Promise<IVerifyResult> {
|
|
237
|
+
const presentation = args.presentation as VerifiablePresentation
|
|
217
238
|
let { now } = args
|
|
218
239
|
if (typeof now === 'number') {
|
|
219
240
|
now = new Date(now * 1000)
|
|
@@ -271,7 +292,7 @@ export class CredentialIssuerLD implements IAgentPlugin {
|
|
|
271
292
|
*
|
|
272
293
|
* @internal
|
|
273
294
|
*/
|
|
274
|
-
|
|
295
|
+
matchKeyForLDSuite(k: IKey): boolean {
|
|
275
296
|
// prefilter based on key algorithms
|
|
276
297
|
switch (k.type) {
|
|
277
298
|
case 'Ed25519':
|