@twin.org/identity-connector-entity-storage 0.0.1-next.10

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.
@@ -0,0 +1,597 @@
1
+ # Class: EntityStorageIdentityConnector
2
+
3
+ Class for performing identity operations using entity storage.
4
+
5
+ ## Implements
6
+
7
+ - `IIdentityConnector`
8
+
9
+ ## Constructors
10
+
11
+ ### new EntityStorageIdentityConnector()
12
+
13
+ > **new EntityStorageIdentityConnector**(`options`?): [`EntityStorageIdentityConnector`](EntityStorageIdentityConnector.md)
14
+
15
+ Create a new instance of EntityStorageIdentityConnector.
16
+
17
+ #### Parameters
18
+
19
+ • **options?**
20
+
21
+ The dependencies for the identity connector.
22
+
23
+ • **options.didDocumentEntityStorageType?**: `string`
24
+
25
+ The entity storage for the did documents, defaults to "identity-document".
26
+
27
+ • **options.vaultConnectorType?**: `string`
28
+
29
+ The vault for the private keys, defaults to "vault".
30
+
31
+ #### Returns
32
+
33
+ [`EntityStorageIdentityConnector`](EntityStorageIdentityConnector.md)
34
+
35
+ ## Properties
36
+
37
+ ### NAMESPACE
38
+
39
+ > `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
40
+
41
+ The namespace supported by the identity connector.
42
+
43
+ ***
44
+
45
+ ### CLASS\_NAME
46
+
47
+ > `readonly` **CLASS\_NAME**: `string`
48
+
49
+ Runtime name for the class.
50
+
51
+ #### Implementation of
52
+
53
+ `IIdentityConnector.CLASS_NAME`
54
+
55
+ ## Methods
56
+
57
+ ### createDocument()
58
+
59
+ > **createDocument**(`controller`): `Promise`\<`IDidDocument`\>
60
+
61
+ Create a new document.
62
+
63
+ #### Parameters
64
+
65
+ • **controller**: `string`
66
+
67
+ The controller of the identity who can make changes.
68
+
69
+ #### Returns
70
+
71
+ `Promise`\<`IDidDocument`\>
72
+
73
+ The created document.
74
+
75
+ #### Implementation of
76
+
77
+ `IIdentityConnector.createDocument`
78
+
79
+ ***
80
+
81
+ ### resolveDocument()
82
+
83
+ > **resolveDocument**(`documentId`): `Promise`\<`IDidDocument`\>
84
+
85
+ Resolve a document from its id.
86
+
87
+ #### Parameters
88
+
89
+ • **documentId**: `string`
90
+
91
+ The id of the document to resolve.
92
+
93
+ #### Returns
94
+
95
+ `Promise`\<`IDidDocument`\>
96
+
97
+ The resolved document.
98
+
99
+ #### Throws
100
+
101
+ NotFoundError if the id can not be resolved.
102
+
103
+ #### Implementation of
104
+
105
+ `IIdentityConnector.resolveDocument`
106
+
107
+ ***
108
+
109
+ ### addVerificationMethod()
110
+
111
+ > **addVerificationMethod**(`controller`, `documentId`, `verificationMethodType`, `verificationMethodId`?): `Promise`\<`IDidDocumentVerificationMethod`\>
112
+
113
+ Add a verification method to the document in JSON Web key Format.
114
+
115
+ #### Parameters
116
+
117
+ • **controller**: `string`
118
+
119
+ The controller of the identity who can make changes.
120
+
121
+ • **documentId**: `string`
122
+
123
+ The id of the document to add the verification method to.
124
+
125
+ • **verificationMethodType**: `DidVerificationMethodType`
126
+
127
+ The type of the verification method to add.
128
+
129
+ • **verificationMethodId?**: `string`
130
+
131
+ The id of the verification method, if undefined uses the kid of the generated JWK.
132
+
133
+ #### Returns
134
+
135
+ `Promise`\<`IDidDocumentVerificationMethod`\>
136
+
137
+ The verification method.
138
+
139
+ #### Throws
140
+
141
+ NotFoundError if the id can not be resolved.
142
+
143
+ #### Throws
144
+
145
+ NotSupportedError if the platform does not support multiple keys.
146
+
147
+ #### Implementation of
148
+
149
+ `IIdentityConnector.addVerificationMethod`
150
+
151
+ ***
152
+
153
+ ### removeVerificationMethod()
154
+
155
+ > **removeVerificationMethod**(`controller`, `verificationMethodId`): `Promise`\<`void`\>
156
+
157
+ Remove a verification method from the document.
158
+
159
+ #### Parameters
160
+
161
+ • **controller**: `string`
162
+
163
+ The controller of the identity who can make changes.
164
+
165
+ • **verificationMethodId**: `string`
166
+
167
+ The id of the verification method.
168
+
169
+ #### Returns
170
+
171
+ `Promise`\<`void`\>
172
+
173
+ Nothing.
174
+
175
+ #### Throws
176
+
177
+ NotFoundError if the id can not be resolved.
178
+
179
+ #### Throws
180
+
181
+ NotSupportedError if the platform does not support multiple revocable keys.
182
+
183
+ #### Implementation of
184
+
185
+ `IIdentityConnector.removeVerificationMethod`
186
+
187
+ ***
188
+
189
+ ### addService()
190
+
191
+ > **addService**(`controller`, `documentId`, `serviceId`, `serviceType`, `serviceEndpoint`): `Promise`\<`IDidService`\>
192
+
193
+ Add a service to the document.
194
+
195
+ #### Parameters
196
+
197
+ • **controller**: `string`
198
+
199
+ The controller of the identity who can make changes.
200
+
201
+ • **documentId**: `string`
202
+
203
+ The id of the document to add the service to.
204
+
205
+ • **serviceId**: `string`
206
+
207
+ The id of the service.
208
+
209
+ • **serviceType**: `string`
210
+
211
+ The type of the service.
212
+
213
+ • **serviceEndpoint**: `string`
214
+
215
+ The endpoint for the service.
216
+
217
+ #### Returns
218
+
219
+ `Promise`\<`IDidService`\>
220
+
221
+ The service.
222
+
223
+ #### Throws
224
+
225
+ NotFoundError if the id can not be resolved.
226
+
227
+ #### Implementation of
228
+
229
+ `IIdentityConnector.addService`
230
+
231
+ ***
232
+
233
+ ### removeService()
234
+
235
+ > **removeService**(`controller`, `serviceId`): `Promise`\<`void`\>
236
+
237
+ Remove a service from the document.
238
+
239
+ #### Parameters
240
+
241
+ • **controller**: `string`
242
+
243
+ The controller of the identity who can make changes.
244
+
245
+ • **serviceId**: `string`
246
+
247
+ The id of the service.
248
+
249
+ #### Returns
250
+
251
+ `Promise`\<`void`\>
252
+
253
+ Nothing.
254
+
255
+ #### Throws
256
+
257
+ NotFoundError if the id can not be resolved.
258
+
259
+ #### Implementation of
260
+
261
+ `IIdentityConnector.removeService`
262
+
263
+ ***
264
+
265
+ ### createVerifiableCredential()
266
+
267
+ > **createVerifiableCredential**\<`T`\>(`controller`, `verificationMethodId`, `id`, `credential`, `revocationIndex`?): `Promise`\<`object`\>
268
+
269
+ Create a verifiable credential for a verification method.
270
+
271
+ #### Type Parameters
272
+
273
+ • **T** *extends* `IJsonLdObject` = `IJsonLdObject`
274
+
275
+ #### Parameters
276
+
277
+ • **controller**: `string`
278
+
279
+ The controller of the identity who can make changes.
280
+
281
+ • **verificationMethodId**: `string`
282
+
283
+ The verification method id to use.
284
+
285
+ • **id**: `undefined` \| `string`
286
+
287
+ The id of the credential.
288
+
289
+ • **credential**: `T`
290
+
291
+ The credential to store in the verifiable credential.
292
+
293
+ • **revocationIndex?**: `number`
294
+
295
+ The bitmap revocation index of the credential, if undefined will not have revocation status.
296
+
297
+ #### Returns
298
+
299
+ `Promise`\<`object`\>
300
+
301
+ The created verifiable credential and its token.
302
+
303
+ ##### verifiableCredential
304
+
305
+ > **verifiableCredential**: `IDidVerifiableCredential`\<`T`\>
306
+
307
+ ##### jwt
308
+
309
+ > **jwt**: `string`
310
+
311
+ #### Throws
312
+
313
+ NotFoundError if the id can not be resolved.
314
+
315
+ #### Implementation of
316
+
317
+ `IIdentityConnector.createVerifiableCredential`
318
+
319
+ ***
320
+
321
+ ### checkVerifiableCredential()
322
+
323
+ > **checkVerifiableCredential**\<`T`\>(`credentialJwt`): `Promise`\<`object`\>
324
+
325
+ Check a verifiable credential is valid.
326
+
327
+ #### Type Parameters
328
+
329
+ • **T** *extends* `IJsonLdObject` = `IJsonLdObject`
330
+
331
+ #### Parameters
332
+
333
+ • **credentialJwt**: `string`
334
+
335
+ The credential to verify.
336
+
337
+ #### Returns
338
+
339
+ `Promise`\<`object`\>
340
+
341
+ The credential stored in the jwt and the revocation status.
342
+
343
+ ##### revoked
344
+
345
+ > **revoked**: `boolean`
346
+
347
+ ##### verifiableCredential?
348
+
349
+ > `optional` **verifiableCredential**: `IDidVerifiableCredential`\<`T`\>
350
+
351
+ #### Implementation of
352
+
353
+ `IIdentityConnector.checkVerifiableCredential`
354
+
355
+ ***
356
+
357
+ ### revokeVerifiableCredentials()
358
+
359
+ > **revokeVerifiableCredentials**(`controller`, `issuerDocumentId`, `credentialIndices`): `Promise`\<`void`\>
360
+
361
+ Revoke verifiable credential(s).
362
+
363
+ #### Parameters
364
+
365
+ • **controller**: `string`
366
+
367
+ The controller of the identity who can make changes.
368
+
369
+ • **issuerDocumentId**: `string`
370
+
371
+ The id of the document to update the revocation list for.
372
+
373
+ • **credentialIndices**: `number`[]
374
+
375
+ The revocation bitmap index or indices to revoke.
376
+
377
+ #### Returns
378
+
379
+ `Promise`\<`void`\>
380
+
381
+ Nothing.
382
+
383
+ #### Implementation of
384
+
385
+ `IIdentityConnector.revokeVerifiableCredentials`
386
+
387
+ ***
388
+
389
+ ### unrevokeVerifiableCredentials()
390
+
391
+ > **unrevokeVerifiableCredentials**(`controller`, `issuerDocumentId`, `credentialIndices`): `Promise`\<`void`\>
392
+
393
+ Unrevoke verifiable credential(s).
394
+
395
+ #### Parameters
396
+
397
+ • **controller**: `string`
398
+
399
+ The controller of the identity who can make changes.
400
+
401
+ • **issuerDocumentId**: `string`
402
+
403
+ The id of the document to update the revocation list for.
404
+
405
+ • **credentialIndices**: `number`[]
406
+
407
+ The revocation bitmap index or indices to un revoke.
408
+
409
+ #### Returns
410
+
411
+ `Promise`\<`void`\>
412
+
413
+ Nothing.
414
+
415
+ #### Implementation of
416
+
417
+ `IIdentityConnector.unrevokeVerifiableCredentials`
418
+
419
+ ***
420
+
421
+ ### createVerifiablePresentation()
422
+
423
+ > **createVerifiablePresentation**\<`T`\>(`controller`, `presentationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `expiresInMinutes`?): `Promise`\<`object`\>
424
+
425
+ Create a verifiable presentation from the supplied verifiable credentials.
426
+
427
+ #### Type Parameters
428
+
429
+ • **T** *extends* `IJsonLdObject` = `IJsonLdObject`
430
+
431
+ #### Parameters
432
+
433
+ • **controller**: `string`
434
+
435
+ The controller of the identity who can make changes.
436
+
437
+ • **presentationMethodId**: `string`
438
+
439
+ The method to associate with the presentation.
440
+
441
+ • **presentationId**: `undefined` \| `string`
442
+
443
+ The id of the presentation.
444
+
445
+ • **contexts**: `undefined` \| `IJsonLdContextDefinitionRoot`
446
+
447
+ The contexts for the data stored in the verifiable credential.
448
+
449
+ • **types**: `undefined` \| `string` \| `string`[]
450
+
451
+ The types for the data stored in the verifiable credential.
452
+
453
+ • **verifiableCredentials**: (`string` \| `IDidVerifiableCredential`\<`T`\>)[]
454
+
455
+ The credentials to use for creating the presentation in jwt format.
456
+
457
+ • **expiresInMinutes?**: `number`
458
+
459
+ The time in minutes for the presentation to expire.
460
+
461
+ #### Returns
462
+
463
+ `Promise`\<`object`\>
464
+
465
+ The created verifiable presentation and its token.
466
+
467
+ ##### verifiablePresentation
468
+
469
+ > **verifiablePresentation**: `IDidVerifiablePresentation`\<`T`\>
470
+
471
+ ##### jwt
472
+
473
+ > **jwt**: `string`
474
+
475
+ #### Throws
476
+
477
+ NotFoundError if the id can not be resolved.
478
+
479
+ #### Implementation of
480
+
481
+ `IIdentityConnector.createVerifiablePresentation`
482
+
483
+ ***
484
+
485
+ ### checkVerifiablePresentation()
486
+
487
+ > **checkVerifiablePresentation**\<`T`\>(`presentationJwt`): `Promise`\<`object`\>
488
+
489
+ Check a verifiable presentation is valid.
490
+
491
+ #### Type Parameters
492
+
493
+ • **T** *extends* `IJsonLdObject` = `IJsonLdObject`
494
+
495
+ #### Parameters
496
+
497
+ • **presentationJwt**: `string`
498
+
499
+ The presentation to verify.
500
+
501
+ #### Returns
502
+
503
+ `Promise`\<`object`\>
504
+
505
+ The presentation stored in the jwt and the revocation status.
506
+
507
+ ##### revoked
508
+
509
+ > **revoked**: `boolean`
510
+
511
+ ##### verifiablePresentation?
512
+
513
+ > `optional` **verifiablePresentation**: `IDidVerifiablePresentation`\<`T`\>
514
+
515
+ ##### issuers?
516
+
517
+ > `optional` **issuers**: `IDidDocument`[]
518
+
519
+ #### Implementation of
520
+
521
+ `IIdentityConnector.checkVerifiablePresentation`
522
+
523
+ ***
524
+
525
+ ### createProof()
526
+
527
+ > **createProof**(`controller`, `verificationMethodId`, `bytes`): `Promise`\<`object`\>
528
+
529
+ Create a proof for arbitrary data with the specified verification method.
530
+
531
+ #### Parameters
532
+
533
+ • **controller**: `string`
534
+
535
+ The controller of the identity who can make changes.
536
+
537
+ • **verificationMethodId**: `string`
538
+
539
+ The verification method id to use.
540
+
541
+ • **bytes**: `Uint8Array`
542
+
543
+ The data bytes to sign.
544
+
545
+ #### Returns
546
+
547
+ `Promise`\<`object`\>
548
+
549
+ The proof signature type and value.
550
+
551
+ ##### type
552
+
553
+ > **type**: `string`
554
+
555
+ ##### value
556
+
557
+ > **value**: `Uint8Array`
558
+
559
+ #### Implementation of
560
+
561
+ `IIdentityConnector.createProof`
562
+
563
+ ***
564
+
565
+ ### verifyProof()
566
+
567
+ > **verifyProof**(`verificationMethodId`, `bytes`, `signatureType`, `signatureValue`): `Promise`\<`boolean`\>
568
+
569
+ Verify proof for arbitrary data with the specified verification method.
570
+
571
+ #### Parameters
572
+
573
+ • **verificationMethodId**: `string`
574
+
575
+ The verification method id to use.
576
+
577
+ • **bytes**: `Uint8Array`
578
+
579
+ The data bytes to verify.
580
+
581
+ • **signatureType**: `string`
582
+
583
+ The type of the signature for the proof.
584
+
585
+ • **signatureValue**: `Uint8Array`
586
+
587
+ The value of the signature for the proof.
588
+
589
+ #### Returns
590
+
591
+ `Promise`\<`boolean`\>
592
+
593
+ True if the signature is valid.
594
+
595
+ #### Implementation of
596
+
597
+ `IIdentityConnector.verifyProof`