@twin.org/identity-models 0.0.1-next.14 → 0.0.1-next.16
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
|
-
import type { IJsonLdContextDefinitionRoot,
|
|
2
|
+
import type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
3
3
|
import type { DidVerificationMethodType, IDidDocument, IDidDocumentVerificationMethod, IDidProof, IDidService, IDidVerifiableCredential, IDidVerifiablePresentation } from "@twin.org/standards-w3c-did";
|
|
4
4
|
/**
|
|
5
5
|
* Interface describing an identity connector.
|
|
@@ -67,8 +67,8 @@ export interface IIdentityConnector extends IComponent {
|
|
|
67
67
|
* @returns The created verifiable credential and its token.
|
|
68
68
|
* @throws NotFoundError if the id can not be resolved.
|
|
69
69
|
*/
|
|
70
|
-
createVerifiableCredential
|
|
71
|
-
verifiableCredential: IDidVerifiableCredential
|
|
70
|
+
createVerifiableCredential(controller: string, verificationMethodId: string, id: string | undefined, credential: IJsonLdNodeObject, revocationIndex?: number): Promise<{
|
|
71
|
+
verifiableCredential: IDidVerifiableCredential;
|
|
72
72
|
jwt: string;
|
|
73
73
|
}>;
|
|
74
74
|
/**
|
|
@@ -76,9 +76,9 @@ export interface IIdentityConnector extends IComponent {
|
|
|
76
76
|
* @param credentialJwt The credential to verify.
|
|
77
77
|
* @returns The credential stored in the jwt and the revocation status.
|
|
78
78
|
*/
|
|
79
|
-
checkVerifiableCredential
|
|
79
|
+
checkVerifiableCredential(credentialJwt: string): Promise<{
|
|
80
80
|
revoked: boolean;
|
|
81
|
-
verifiableCredential?: IDidVerifiableCredential
|
|
81
|
+
verifiableCredential?: IDidVerifiableCredential;
|
|
82
82
|
}>;
|
|
83
83
|
/**
|
|
84
84
|
* Revoke verifiable credential(s).
|
|
@@ -108,8 +108,8 @@ export interface IIdentityConnector extends IComponent {
|
|
|
108
108
|
* @returns The created verifiable presentation and its token.
|
|
109
109
|
* @throws NotFoundError if the id can not be resolved.
|
|
110
110
|
*/
|
|
111
|
-
createVerifiablePresentation
|
|
112
|
-
verifiablePresentation: IDidVerifiablePresentation
|
|
111
|
+
createVerifiablePresentation(controller: string, presentationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential)[], expiresInMinutes?: number): Promise<{
|
|
112
|
+
verifiablePresentation: IDidVerifiablePresentation;
|
|
113
113
|
jwt: string;
|
|
114
114
|
}>;
|
|
115
115
|
/**
|
|
@@ -117,9 +117,9 @@ export interface IIdentityConnector extends IComponent {
|
|
|
117
117
|
* @param presentationJwt The presentation to verify.
|
|
118
118
|
* @returns The presentation stored in the jwt and the revocation status.
|
|
119
119
|
*/
|
|
120
|
-
checkVerifiablePresentation
|
|
120
|
+
checkVerifiablePresentation(presentationJwt: string): Promise<{
|
|
121
121
|
revoked: boolean;
|
|
122
|
-
verifiablePresentation?: IDidVerifiablePresentation
|
|
122
|
+
verifiablePresentation?: IDidVerifiablePresentation;
|
|
123
123
|
issuers?: IDidDocument[];
|
|
124
124
|
}>;
|
|
125
125
|
/**
|
package/docs/changelog.md
CHANGED
|
@@ -194,14 +194,10 @@ NotFoundError if the id can not be resolved.
|
|
|
194
194
|
|
|
195
195
|
### createVerifiableCredential()
|
|
196
196
|
|
|
197
|
-
> **createVerifiableCredential
|
|
197
|
+
> **createVerifiableCredential**(`controller`, `verificationMethodId`, `id`, `credential`, `revocationIndex`?): `Promise`\<`object`\>
|
|
198
198
|
|
|
199
199
|
Create a verifiable credential for a verification method.
|
|
200
200
|
|
|
201
|
-
#### Type Parameters
|
|
202
|
-
|
|
203
|
-
• **T** *extends* `IJsonLdObject`
|
|
204
|
-
|
|
205
201
|
#### Parameters
|
|
206
202
|
|
|
207
203
|
• **controller**: `string`
|
|
@@ -216,7 +212,7 @@ The verification method id to use.
|
|
|
216
212
|
|
|
217
213
|
The id of the credential.
|
|
218
214
|
|
|
219
|
-
• **credential**: `
|
|
215
|
+
• **credential**: `IJsonLdNodeObject`
|
|
220
216
|
|
|
221
217
|
The credential to store in the verifiable credential.
|
|
222
218
|
|
|
@@ -232,7 +228,7 @@ The created verifiable credential and its token.
|
|
|
232
228
|
|
|
233
229
|
##### verifiableCredential
|
|
234
230
|
|
|
235
|
-
> **verifiableCredential**: `IDidVerifiableCredential
|
|
231
|
+
> **verifiableCredential**: `IDidVerifiableCredential`
|
|
236
232
|
|
|
237
233
|
##### jwt
|
|
238
234
|
|
|
@@ -246,14 +242,10 @@ NotFoundError if the id can not be resolved.
|
|
|
246
242
|
|
|
247
243
|
### checkVerifiableCredential()
|
|
248
244
|
|
|
249
|
-
> **checkVerifiableCredential
|
|
245
|
+
> **checkVerifiableCredential**(`credentialJwt`): `Promise`\<`object`\>
|
|
250
246
|
|
|
251
247
|
Check a verifiable credential is valid.
|
|
252
248
|
|
|
253
|
-
#### Type Parameters
|
|
254
|
-
|
|
255
|
-
• **T** *extends* `IJsonLdObject`
|
|
256
|
-
|
|
257
249
|
#### Parameters
|
|
258
250
|
|
|
259
251
|
• **credentialJwt**: `string`
|
|
@@ -272,7 +264,7 @@ The credential stored in the jwt and the revocation status.
|
|
|
272
264
|
|
|
273
265
|
##### verifiableCredential?
|
|
274
266
|
|
|
275
|
-
> `optional` **verifiableCredential**: `IDidVerifiableCredential
|
|
267
|
+
> `optional` **verifiableCredential**: `IDidVerifiableCredential`
|
|
276
268
|
|
|
277
269
|
***
|
|
278
270
|
|
|
@@ -334,14 +326,10 @@ Nothing.
|
|
|
334
326
|
|
|
335
327
|
### createVerifiablePresentation()
|
|
336
328
|
|
|
337
|
-
> **createVerifiablePresentation
|
|
329
|
+
> **createVerifiablePresentation**(`controller`, `presentationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `expiresInMinutes`?): `Promise`\<`object`\>
|
|
338
330
|
|
|
339
331
|
Create a verifiable presentation from the supplied verifiable credentials.
|
|
340
332
|
|
|
341
|
-
#### Type Parameters
|
|
342
|
-
|
|
343
|
-
• **T** *extends* `IJsonLdObject`
|
|
344
|
-
|
|
345
333
|
#### Parameters
|
|
346
334
|
|
|
347
335
|
• **controller**: `string`
|
|
@@ -364,7 +352,7 @@ The contexts for the data stored in the verifiable credential.
|
|
|
364
352
|
|
|
365
353
|
The types for the data stored in the verifiable credential.
|
|
366
354
|
|
|
367
|
-
• **verifiableCredentials**: (`string` \| `IDidVerifiableCredential
|
|
355
|
+
• **verifiableCredentials**: (`string` \| `IDidVerifiableCredential`)[]
|
|
368
356
|
|
|
369
357
|
The credentials to use for creating the presentation in jwt format.
|
|
370
358
|
|
|
@@ -380,7 +368,7 @@ The created verifiable presentation and its token.
|
|
|
380
368
|
|
|
381
369
|
##### verifiablePresentation
|
|
382
370
|
|
|
383
|
-
> **verifiablePresentation**: `IDidVerifiablePresentation
|
|
371
|
+
> **verifiablePresentation**: `IDidVerifiablePresentation`
|
|
384
372
|
|
|
385
373
|
##### jwt
|
|
386
374
|
|
|
@@ -394,14 +382,10 @@ NotFoundError if the id can not be resolved.
|
|
|
394
382
|
|
|
395
383
|
### checkVerifiablePresentation()
|
|
396
384
|
|
|
397
|
-
> **checkVerifiablePresentation
|
|
385
|
+
> **checkVerifiablePresentation**(`presentationJwt`): `Promise`\<`object`\>
|
|
398
386
|
|
|
399
387
|
Check a verifiable presentation is valid.
|
|
400
388
|
|
|
401
|
-
#### Type Parameters
|
|
402
|
-
|
|
403
|
-
• **T** *extends* `IJsonLdObject`
|
|
404
|
-
|
|
405
389
|
#### Parameters
|
|
406
390
|
|
|
407
391
|
• **presentationJwt**: `string`
|
|
@@ -420,7 +404,7 @@ The presentation stored in the jwt and the revocation status.
|
|
|
420
404
|
|
|
421
405
|
##### verifiablePresentation?
|
|
422
406
|
|
|
423
|
-
> `optional` **verifiablePresentation**: `IDidVerifiablePresentation
|
|
407
|
+
> `optional` **verifiablePresentation**: `IDidVerifiablePresentation`
|
|
424
408
|
|
|
425
409
|
##### issuers?
|
|
426
410
|
|