@3sixty/identity-rest-client 0.0.0-stage → 0.20.0-next.0

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,717 @@
1
+ # Class: IdentityRestClient
2
+
3
+ Client for performing identity through to REST endpoints.
4
+
5
+ ## Extends
6
+
7
+ - `BaseRestClient`
8
+
9
+ ## Implements
10
+
11
+ - `IIdentityComponent`
12
+
13
+ ## Constructors
14
+
15
+ ### Constructor
16
+
17
+ > **new IdentityRestClient**(`config`): `IdentityRestClient`
18
+
19
+ Create a new instance of IdentityRestClient.
20
+
21
+ #### Parameters
22
+
23
+ ##### config
24
+
25
+ `IBaseRestClientConfig`
26
+
27
+ The configuration for the client.
28
+
29
+ #### Returns
30
+
31
+ `IdentityRestClient`
32
+
33
+ #### Overrides
34
+
35
+ `BaseRestClient.constructor`
36
+
37
+ ## Properties
38
+
39
+ ### CLASS\_NAME {#class_name}
40
+
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
+
43
+ Runtime name for the class.
44
+
45
+ ## Methods
46
+
47
+ ### className() {#classname}
48
+
49
+ > **className**(): `string`
50
+
51
+ Returns the class name of the component.
52
+
53
+ #### Returns
54
+
55
+ `string`
56
+
57
+ The class name of the component.
58
+
59
+ #### Implementation of
60
+
61
+ `IIdentityComponent.className`
62
+
63
+ ***
64
+
65
+ ### identityCreate() {#identitycreate}
66
+
67
+ > **identityCreate**(`namespace?`): `Promise`\<`IDidDocument`\>
68
+
69
+ Create a new identity.
70
+
71
+ #### Parameters
72
+
73
+ ##### namespace?
74
+
75
+ `string`
76
+
77
+ The namespace of the connector to use for the identity, defaults to service configured namespace.
78
+
79
+ #### Returns
80
+
81
+ `Promise`\<`IDidDocument`\>
82
+
83
+ The created identity document.
84
+
85
+ #### Implementation of
86
+
87
+ `IIdentityComponent.identityCreate`
88
+
89
+ ***
90
+
91
+ ### identityRemove() {#identityremove}
92
+
93
+ > **identityRemove**(`identity`, `options?`): `Promise`\<`void`\>
94
+
95
+ Remove an identity.
96
+
97
+ #### Parameters
98
+
99
+ ##### identity
100
+
101
+ `string`
102
+
103
+ The id of the document to remove.
104
+
105
+ ##### options?
106
+
107
+ Optional settings.
108
+
109
+ ###### removeKeys?
110
+
111
+ `boolean`
112
+
113
+ Also remove any associated private keys from the vault.
114
+
115
+ ###### removeDocumentKey?
116
+
117
+ `boolean`
118
+
119
+ Also remove the document key from the vault.
120
+
121
+ #### Returns
122
+
123
+ `Promise`\<`void`\>
124
+
125
+ A promise that resolves when the identity has been removed.
126
+
127
+ #### Implementation of
128
+
129
+ `IIdentityComponent.identityRemove`
130
+
131
+ ***
132
+
133
+ ### verificationMethodCreate() {#verificationmethodcreate}
134
+
135
+ > **verificationMethodCreate**(`identity`, `verificationMethodType`, `verificationMethodId?`): `Promise`\<`IDidDocumentVerificationMethod`\>
136
+
137
+ Add a verification method to the document in JSON Web key Format.
138
+
139
+ #### Parameters
140
+
141
+ ##### identity
142
+
143
+ `string`
144
+
145
+ The id of the document to add the verification method to.
146
+
147
+ ##### verificationMethodType
148
+
149
+ `DidVerificationMethodType`
150
+
151
+ The type of the verification method to add.
152
+
153
+ ##### verificationMethodId?
154
+
155
+ `string`
156
+
157
+ The id of the verification method, if undefined uses the kid of the generated JWK.
158
+
159
+ #### Returns
160
+
161
+ `Promise`\<`IDidDocumentVerificationMethod`\>
162
+
163
+ The verification method.
164
+
165
+ #### Throws
166
+
167
+ NotFoundError if the id can not be resolved.
168
+
169
+ #### Throws
170
+
171
+ NotSupportedError if the platform does not support multiple keys.
172
+
173
+ #### Implementation of
174
+
175
+ `IIdentityComponent.verificationMethodCreate`
176
+
177
+ ***
178
+
179
+ ### verificationMethodRemove() {#verificationmethodremove}
180
+
181
+ > **verificationMethodRemove**(`verificationMethodId`, `options?`, `controller?`): `Promise`\<`void`\>
182
+
183
+ Remove a verification method from the document.
184
+
185
+ #### Parameters
186
+
187
+ ##### verificationMethodId
188
+
189
+ `string`
190
+
191
+ The id of the verification method.
192
+
193
+ ##### options?
194
+
195
+ Optional settings.
196
+
197
+ ###### removeKeys?
198
+
199
+ `boolean`
200
+
201
+ Also remove any associated private key from the vault.
202
+
203
+ ##### controller?
204
+
205
+ `string`
206
+
207
+ Unused by the REST client; the controller is resolved server-side from the session context.
208
+
209
+ #### Returns
210
+
211
+ `Promise`\<`void`\>
212
+
213
+ A promise that resolves when the verification method has been removed.
214
+
215
+ #### Throws
216
+
217
+ NotFoundError if the id can not be resolved.
218
+
219
+ #### Throws
220
+
221
+ NotSupportedError if the platform does not support multiple revocable keys.
222
+
223
+ #### Implementation of
224
+
225
+ `IIdentityComponent.verificationMethodRemove`
226
+
227
+ ***
228
+
229
+ ### serviceCreate() {#servicecreate}
230
+
231
+ > **serviceCreate**(`identity`, `serviceId`, `serviceType`, `serviceEndpoint`): `Promise`\<`IDidService`\>
232
+
233
+ Add a service to the document.
234
+
235
+ #### Parameters
236
+
237
+ ##### identity
238
+
239
+ `string`
240
+
241
+ The id of the document to add the service to.
242
+
243
+ ##### serviceId
244
+
245
+ `string`
246
+
247
+ The id of the service.
248
+
249
+ ##### serviceType
250
+
251
+ `string` \| `string`[]
252
+
253
+ The type of the service.
254
+
255
+ ##### serviceEndpoint
256
+
257
+ `string` \| `string`[]
258
+
259
+ The endpoint for the service.
260
+
261
+ #### Returns
262
+
263
+ `Promise`\<`IDidService`\>
264
+
265
+ The service.
266
+
267
+ #### Throws
268
+
269
+ NotFoundError if the id can not be resolved.
270
+
271
+ #### Implementation of
272
+
273
+ `IIdentityComponent.serviceCreate`
274
+
275
+ ***
276
+
277
+ ### serviceRemove() {#serviceremove}
278
+
279
+ > **serviceRemove**(`serviceId`): `Promise`\<`void`\>
280
+
281
+ Remove a service from the document.
282
+
283
+ #### Parameters
284
+
285
+ ##### serviceId
286
+
287
+ `string`
288
+
289
+ The id of the service.
290
+
291
+ #### Returns
292
+
293
+ `Promise`\<`void`\>
294
+
295
+ A promise that resolves when the service has been removed.
296
+
297
+ #### Throws
298
+
299
+ NotFoundError if the id can not be resolved.
300
+
301
+ #### Implementation of
302
+
303
+ `IIdentityComponent.serviceRemove`
304
+
305
+ ***
306
+
307
+ ### alsoKnownAsAdd() {#alsoknownasadd}
308
+
309
+ > **alsoKnownAsAdd**(`documentId`, `alias`): `Promise`\<`void`\>
310
+
311
+ Add an alias to the alsoKnownAs property on the document.
312
+ If the alias is already present the operation is a no-op.
313
+
314
+ #### Parameters
315
+
316
+ ##### documentId
317
+
318
+ `string`
319
+
320
+ The id of the document to update.
321
+
322
+ ##### alias
323
+
324
+ `string`
325
+
326
+ The alias to add. Must be a Url or Urn (typically another DID).
327
+
328
+ #### Returns
329
+
330
+ `Promise`\<`void`\>
331
+
332
+ A promise that resolves when the alias has been added.
333
+
334
+ #### Throws
335
+
336
+ GeneralError if the alias is not a Url or Urn.
337
+
338
+ #### Throws
339
+
340
+ NotFoundError if the id can not be resolved.
341
+
342
+ #### Implementation of
343
+
344
+ `IIdentityComponent.alsoKnownAsAdd`
345
+
346
+ ***
347
+
348
+ ### alsoKnownAsRemove() {#alsoknownasremove}
349
+
350
+ > **alsoKnownAsRemove**(`documentId`, `alias`): `Promise`\<`void`\>
351
+
352
+ Remove an alias from the alsoKnownAs property on the document.
353
+ If the alias is not present the operation is a no-op.
354
+
355
+ #### Parameters
356
+
357
+ ##### documentId
358
+
359
+ `string`
360
+
361
+ The id of the document to update.
362
+
363
+ ##### alias
364
+
365
+ `string`
366
+
367
+ The alias to remove. Must be a Url or Urn.
368
+
369
+ #### Returns
370
+
371
+ `Promise`\<`void`\>
372
+
373
+ A promise that resolves when the alias has been removed.
374
+
375
+ #### Throws
376
+
377
+ GeneralError if the alias is not a Url or Urn.
378
+
379
+ #### Throws
380
+
381
+ NotFoundError if the id can not be resolved.
382
+
383
+ #### Implementation of
384
+
385
+ `IIdentityComponent.alsoKnownAsRemove`
386
+
387
+ ***
388
+
389
+ ### verifiableCredentialCreate() {#verifiablecredentialcreate}
390
+
391
+ > **verifiableCredentialCreate**(`verificationMethodId`, `id`, `subject`, `options?`): `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
392
+
393
+ Create a verifiable credential for a verification method.
394
+
395
+ #### Parameters
396
+
397
+ ##### verificationMethodId
398
+
399
+ `string`
400
+
401
+ The verification method id to use.
402
+
403
+ ##### id
404
+
405
+ `string` \| `undefined`
406
+
407
+ The id of the credential.
408
+
409
+ ##### subject
410
+
411
+ `IJsonLdNodeObject`
412
+
413
+ The credential subject to store in the verifiable credential.
414
+
415
+ ##### options?
416
+
417
+ Additional options for creating the verifiable credential.
418
+
419
+ ###### revocationIndex?
420
+
421
+ `number`
422
+
423
+ The bitmap revocation index of the credential, if undefined will not have revocation status.
424
+
425
+ ###### expirationDate?
426
+
427
+ `Date`
428
+
429
+ The date the verifiable credential is valid until.
430
+
431
+ ###### jwtHeaderFields?
432
+
433
+ \{\[`id`: `string`\]: `string`; \}
434
+
435
+ Additional fields to include in the JWT header when creating the verifiable credential in jwt format.
436
+
437
+ ###### jwtPayloadFields?
438
+
439
+ \{\[`id`: `string`\]: `string`; \}
440
+
441
+ Additional fields to include in the JWT payload when creating the verifiable credential in jwt format.
442
+
443
+ #### Returns
444
+
445
+ `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
446
+
447
+ The created verifiable credential and its token.
448
+
449
+ #### Throws
450
+
451
+ NotFoundError if the id can not be resolved.
452
+
453
+ #### Implementation of
454
+
455
+ `IIdentityComponent.verifiableCredentialCreate`
456
+
457
+ ***
458
+
459
+ ### verifiableCredentialVerify() {#verifiablecredentialverify}
460
+
461
+ > **verifiableCredentialVerify**(`credential`): `Promise`\<\{ `revoked`: `boolean`; `verifiableCredential?`: `IDidVerifiableCredential`; \}\>
462
+
463
+ Verify a verifiable credential is valid.
464
+
465
+ #### Parameters
466
+
467
+ ##### credential
468
+
469
+ `string` \| `IDidVerifiableCredential`
470
+
471
+ The credential to verify.
472
+
473
+ #### Returns
474
+
475
+ `Promise`\<\{ `revoked`: `boolean`; `verifiableCredential?`: `IDidVerifiableCredential`; \}\>
476
+
477
+ The credential stored in the jwt and the revocation status.
478
+
479
+ #### Implementation of
480
+
481
+ `IIdentityComponent.verifiableCredentialVerify`
482
+
483
+ ***
484
+
485
+ ### verifiableCredentialRevoke() {#verifiablecredentialrevoke}
486
+
487
+ > **verifiableCredentialRevoke**(`issuerId`, `credentialIndex`): `Promise`\<`void`\>
488
+
489
+ Revoke verifiable credential.
490
+
491
+ #### Parameters
492
+
493
+ ##### issuerId
494
+
495
+ `string`
496
+
497
+ The id of the document to update the revocation list for.
498
+
499
+ ##### credentialIndex
500
+
501
+ `number`
502
+
503
+ The revocation bitmap index to revoke.
504
+
505
+ #### Returns
506
+
507
+ `Promise`\<`void`\>
508
+
509
+ A promise that resolves when the credential has been revoked.
510
+
511
+ #### Implementation of
512
+
513
+ `IIdentityComponent.verifiableCredentialRevoke`
514
+
515
+ ***
516
+
517
+ ### verifiableCredentialUnrevoke() {#verifiablecredentialunrevoke}
518
+
519
+ > **verifiableCredentialUnrevoke**(`issuerId`, `credentialIndex`): `Promise`\<`void`\>
520
+
521
+ Unrevoke verifiable credential.
522
+
523
+ #### Parameters
524
+
525
+ ##### issuerId
526
+
527
+ `string`
528
+
529
+ The id of the document to update the revocation list for.
530
+
531
+ ##### credentialIndex
532
+
533
+ `number`
534
+
535
+ The revocation bitmap index to unrevoke.
536
+
537
+ #### Returns
538
+
539
+ `Promise`\<`void`\>
540
+
541
+ A promise that resolves when the credential has been unrevoked.
542
+
543
+ #### Implementation of
544
+
545
+ `IIdentityComponent.verifiableCredentialUnrevoke`
546
+
547
+ ***
548
+
549
+ ### verifiablePresentationCreate() {#verifiablepresentationcreate}
550
+
551
+ > **verifiablePresentationCreate**(`verificationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `options?`): `Promise`\<\{ `verifiablePresentation`: `IDidVerifiablePresentation`; `jwt`: `string`; \}\>
552
+
553
+ Create a verifiable presentation from the supplied verifiable credentials.
554
+
555
+ #### Parameters
556
+
557
+ ##### verificationMethodId
558
+
559
+ `string`
560
+
561
+ The method to associate with the presentation.
562
+
563
+ ##### presentationId
564
+
565
+ `string` \| `undefined`
566
+
567
+ The id of the presentation.
568
+
569
+ ##### contexts
570
+
571
+ `IJsonLdContextDefinitionRoot` \| `undefined`
572
+
573
+ The contexts for the data stored in the verifiable credential.
574
+
575
+ ##### types
576
+
577
+ `string` \| `string`[] \| `undefined`
578
+
579
+ The types for the data stored in the verifiable credential.
580
+
581
+ ##### verifiableCredentials
582
+
583
+ (`string` \| `IDidVerifiableCredential`)[]
584
+
585
+ The credentials to use for creating the presentation in jwt format.
586
+
587
+ ##### options?
588
+
589
+ Additional options for creating the verifiable presentation.
590
+
591
+ ###### expirationDate?
592
+
593
+ `Date`
594
+
595
+ The date the verifiable presentation is valid until.
596
+
597
+ ###### jwtHeaderFields?
598
+
599
+ \{\[`id`: `string`\]: `string`; \}
600
+
601
+ Additional fields to include in the JWT header when creating the verifiable presentation in jwt format.
602
+
603
+ ###### jwtPayloadFields?
604
+
605
+ \{\[`id`: `string`\]: `string`; \}
606
+
607
+ Additional fields to include in the JWT payload when creating the verifiable presentation in jwt format.
608
+
609
+ #### Returns
610
+
611
+ `Promise`\<\{ `verifiablePresentation`: `IDidVerifiablePresentation`; `jwt`: `string`; \}\>
612
+
613
+ The created verifiable presentation and its token.
614
+
615
+ #### Throws
616
+
617
+ NotFoundError if the id can not be resolved.
618
+
619
+ #### Implementation of
620
+
621
+ `IIdentityComponent.verifiablePresentationCreate`
622
+
623
+ ***
624
+
625
+ ### verifiablePresentationVerify() {#verifiablepresentationverify}
626
+
627
+ > **verifiablePresentationVerify**(`presentation`): `Promise`\<\{ `revoked`: `boolean`; `verifiablePresentation?`: `IDidVerifiablePresentation`; `issuers?`: `IDidDocument`[]; \}\>
628
+
629
+ Verify a verifiable presentation is valid.
630
+
631
+ #### Parameters
632
+
633
+ ##### presentation
634
+
635
+ `string` \| `IDidVerifiablePresentation`
636
+
637
+ The presentation to verify.
638
+
639
+ #### Returns
640
+
641
+ `Promise`\<\{ `revoked`: `boolean`; `verifiablePresentation?`: `IDidVerifiablePresentation`; `issuers?`: `IDidDocument`[]; \}\>
642
+
643
+ The presentation stored in the jwt and the revocation status.
644
+
645
+ #### Implementation of
646
+
647
+ `IIdentityComponent.verifiablePresentationVerify`
648
+
649
+ ***
650
+
651
+ ### proofCreate() {#proofcreate}
652
+
653
+ > **proofCreate**(`verificationMethodId`, `proofType`, `unsecureDocument`): `Promise`\<`IProof`\>
654
+
655
+ Create a proof for a document with the specified verification method.
656
+
657
+ #### Parameters
658
+
659
+ ##### verificationMethodId
660
+
661
+ `string`
662
+
663
+ The verification method id to use.
664
+
665
+ ##### proofType
666
+
667
+ `ProofTypes`
668
+
669
+ The type of proof to create.
670
+
671
+ ##### unsecureDocument
672
+
673
+ `IJsonLdNodeObject`
674
+
675
+ The unsecure document to create the proof for.
676
+
677
+ #### Returns
678
+
679
+ `Promise`\<`IProof`\>
680
+
681
+ The proof.
682
+
683
+ #### Implementation of
684
+
685
+ `IIdentityComponent.proofCreate`
686
+
687
+ ***
688
+
689
+ ### proofVerify() {#proofverify}
690
+
691
+ > **proofVerify**(`document`, `proof`): `Promise`\<`boolean`\>
692
+
693
+ Verify proof for a document with the specified verification method.
694
+
695
+ #### Parameters
696
+
697
+ ##### document
698
+
699
+ `IJsonLdNodeObject`
700
+
701
+ The document to verify.
702
+
703
+ ##### proof
704
+
705
+ `IProof`
706
+
707
+ The proof to verify.
708
+
709
+ #### Returns
710
+
711
+ `Promise`\<`boolean`\>
712
+
713
+ True if the proof is verified.
714
+
715
+ #### Implementation of
716
+
717
+ `IIdentityComponent.proofVerify`
@@ -0,0 +1,7 @@
1
+ # @3sixty/identity-rest-client
2
+
3
+ ## Classes
4
+
5
+ - [IdentityProfileRestClient](classes/IdentityProfileRestClient.md)
6
+ - [IdentityResolverRestClient](classes/IdentityResolverRestClient.md)
7
+ - [IdentityRestClient](classes/IdentityRestClient.md)
@@ -0,0 +1 @@
1
+ {}