@twin.org/identity-models 0.0.1-next.19 → 0.0.1-next.20

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 (30) hide show
  1. package/dist/cjs/index.cjs +40 -22
  2. package/dist/esm/index.mjs +41 -23
  3. package/dist/types/index.d.ts +11 -11
  4. package/dist/types/models/IIdentityComponent.d.ts +130 -3
  5. package/dist/types/models/api/{IIdentityResolveRequest.d.ts → identity/IIdentityResolveRequest.d.ts} +1 -1
  6. package/dist/types/utils/jwtHelper.d.ts +22 -0
  7. package/docs/changelog.md +1 -1
  8. package/docs/reference/classes/DocumentHelper.md +3 -1
  9. package/docs/reference/classes/JwtHelper.md +59 -0
  10. package/docs/reference/index.md +3 -7
  11. package/docs/reference/interfaces/IIdentityComponent.md +485 -3
  12. package/docs/reference/interfaces/IIdentityConnector.md +128 -84
  13. package/docs/reference/interfaces/IIdentityProfileComponent.md +52 -44
  14. package/docs/reference/interfaces/IIdentityProfileConnector.md +52 -40
  15. package/docs/reference/interfaces/IIdentityResolveRequest.md +1 -1
  16. package/docs/reference/variables/IdentityProfileConnectorFactory.md +1 -1
  17. package/locales/en.json +5 -4
  18. package/package.json +1 -1
  19. package/dist/types/models/identityRole.d.ts +0 -21
  20. package/docs/reference/type-aliases/IdentityRole.md +0 -5
  21. package/docs/reference/variables/IdentityRole.md +0 -25
  22. /package/dist/types/models/api/{IIdentityResolveResponse.d.ts → identity/IIdentityResolveResponse.d.ts} +0 -0
  23. /package/dist/types/models/api/{IIdentityProfileCreateRequest.d.ts → profile/IIdentityProfileCreateRequest.d.ts} +0 -0
  24. /package/dist/types/models/api/{IIdentityProfileGetPublicRequest.d.ts → profile/IIdentityProfileGetPublicRequest.d.ts} +0 -0
  25. /package/dist/types/models/api/{IIdentityProfileGetPublicResponse.d.ts → profile/IIdentityProfileGetPublicResponse.d.ts} +0 -0
  26. /package/dist/types/models/api/{IIdentityProfileGetRequest.d.ts → profile/IIdentityProfileGetRequest.d.ts} +0 -0
  27. /package/dist/types/models/api/{IIdentityProfileGetResponse.d.ts → profile/IIdentityProfileGetResponse.d.ts} +0 -0
  28. /package/dist/types/models/api/{IIdentityProfileListRequest.d.ts → profile/IIdentityProfileListRequest.d.ts} +0 -0
  29. /package/dist/types/models/api/{IIdentityProfileListResponse.d.ts → profile/IIdentityProfileListResponse.d.ts} +0 -0
  30. /package/dist/types/models/api/{IIdentityProfileUpdateRequest.d.ts → profile/IIdentityProfileUpdateRequest.d.ts} +0 -0
@@ -16,7 +16,9 @@ Create a new document.
16
16
 
17
17
  #### Parameters
18
18
 
19
- • **controller**: `string`
19
+ ##### controller
20
+
21
+ `string`
20
22
 
21
23
  The controller of the identity who can make changes.
22
24
 
@@ -36,7 +38,9 @@ Resolve a document from its id.
36
38
 
37
39
  #### Parameters
38
40
 
39
- • **documentId**: `string`
41
+ ##### documentId
42
+
43
+ `string`
40
44
 
41
45
  The id of the document to resolve.
42
46
 
@@ -60,19 +64,27 @@ Add a verification method to the document in JSON Web key Format.
60
64
 
61
65
  #### Parameters
62
66
 
63
- • **controller**: `string`
67
+ ##### controller
68
+
69
+ `string`
64
70
 
65
71
  The controller of the identity who can make changes.
66
72
 
67
- • **documentId**: `string`
73
+ ##### documentId
74
+
75
+ `string`
68
76
 
69
77
  The id of the document to add the verification method to.
70
78
 
71
- • **verificationMethodType**: `DidVerificationMethodType`
79
+ ##### verificationMethodType
80
+
81
+ `DidVerificationMethodType`
72
82
 
73
83
  The type of the verification method to add.
74
84
 
75
- • **verificationMethodId?**: `string`
85
+ ##### verificationMethodId?
86
+
87
+ `string`
76
88
 
77
89
  The id of the verification method, if undefined uses the kid of the generated JWK.
78
90
 
@@ -100,11 +112,15 @@ Remove a verification method from the document.
100
112
 
101
113
  #### Parameters
102
114
 
103
- • **controller**: `string`
115
+ ##### controller
116
+
117
+ `string`
104
118
 
105
119
  The controller of the identity who can make changes.
106
120
 
107
- • **verificationMethodId**: `string`
121
+ ##### verificationMethodId
122
+
123
+ `string`
108
124
 
109
125
  The id of the verification method.
110
126
 
@@ -132,23 +148,33 @@ Add a service to the document.
132
148
 
133
149
  #### Parameters
134
150
 
135
- • **controller**: `string`
151
+ ##### controller
152
+
153
+ `string`
136
154
 
137
155
  The controller of the identity who can make changes.
138
156
 
139
- • **documentId**: `string`
157
+ ##### documentId
158
+
159
+ `string`
140
160
 
141
161
  The id of the document to add the service to.
142
162
 
143
- • **serviceId**: `string`
163
+ ##### serviceId
164
+
165
+ `string`
144
166
 
145
167
  The id of the service.
146
168
 
147
- • **serviceType**: `string`
169
+ ##### serviceType
170
+
171
+ `string`
148
172
 
149
173
  The type of the service.
150
174
 
151
- • **serviceEndpoint**: `string`
175
+ ##### serviceEndpoint
176
+
177
+ `string`
152
178
 
153
179
  The endpoint for the service.
154
180
 
@@ -172,11 +198,15 @@ Remove a service from the document.
172
198
 
173
199
  #### Parameters
174
200
 
175
- • **controller**: `string`
201
+ ##### controller
202
+
203
+ `string`
176
204
 
177
205
  The controller of the identity who can make changes.
178
206
 
179
- • **serviceId**: `string`
207
+ ##### serviceId
208
+
209
+ `string`
180
210
 
181
211
  The id of the service.
182
212
 
@@ -194,46 +224,48 @@ NotFoundError if the id can not be resolved.
194
224
 
195
225
  ### createVerifiableCredential()
196
226
 
197
- > **createVerifiableCredential**(`controller`, `verificationMethodId`, `id`, `credential`, `revocationIndex`?): `Promise`\<`object`\>
227
+ > **createVerifiableCredential**(`controller`, `verificationMethodId`, `id`, `credential`, `revocationIndex`?): `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
198
228
 
199
229
  Create a verifiable credential for a verification method.
200
230
 
201
231
  #### Parameters
202
232
 
203
- • **controller**: `string`
233
+ ##### controller
234
+
235
+ `string`
204
236
 
205
237
  The controller of the identity who can make changes.
206
238
 
207
- • **verificationMethodId**: `string`
239
+ ##### verificationMethodId
240
+
241
+ `string`
208
242
 
209
243
  The verification method id to use.
210
244
 
211
- • **id**: `undefined` \| `string`
245
+ ##### id
212
246
 
213
247
  The id of the credential.
214
248
 
215
- • **credential**: `IJsonLdNodeObject`
249
+ `undefined` | `string`
250
+
251
+ ##### credential
252
+
253
+ `IJsonLdNodeObject`
216
254
 
217
255
  The credential to store in the verifiable credential.
218
256
 
219
- • **revocationIndex?**: `number`
257
+ ##### revocationIndex?
258
+
259
+ `number`
220
260
 
221
261
  The bitmap revocation index of the credential, if undefined will not have revocation status.
222
262
 
223
263
  #### Returns
224
264
 
225
- `Promise`\<`object`\>
265
+ `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
226
266
 
227
267
  The created verifiable credential and its token.
228
268
 
229
- ##### verifiableCredential
230
-
231
- > **verifiableCredential**: `IDidVerifiableCredential`
232
-
233
- ##### jwt
234
-
235
- > **jwt**: `string`
236
-
237
269
  #### Throws
238
270
 
239
271
  NotFoundError if the id can not be resolved.
@@ -242,30 +274,24 @@ NotFoundError if the id can not be resolved.
242
274
 
243
275
  ### checkVerifiableCredential()
244
276
 
245
- > **checkVerifiableCredential**(`credentialJwt`): `Promise`\<`object`\>
277
+ > **checkVerifiableCredential**(`credentialJwt`): `Promise`\<\{ `revoked`: `boolean`; `verifiableCredential`: `IDidVerifiableCredential`; \}\>
246
278
 
247
279
  Check a verifiable credential is valid.
248
280
 
249
281
  #### Parameters
250
282
 
251
- • **credentialJwt**: `string`
283
+ ##### credentialJwt
284
+
285
+ `string`
252
286
 
253
287
  The credential to verify.
254
288
 
255
289
  #### Returns
256
290
 
257
- `Promise`\<`object`\>
291
+ `Promise`\<\{ `revoked`: `boolean`; `verifiableCredential`: `IDidVerifiableCredential`; \}\>
258
292
 
259
293
  The credential stored in the jwt and the revocation status.
260
294
 
261
- ##### revoked
262
-
263
- > **revoked**: `boolean`
264
-
265
- ##### verifiableCredential?
266
-
267
- > `optional` **verifiableCredential**: `IDidVerifiableCredential`
268
-
269
295
  ***
270
296
 
271
297
  ### revokeVerifiableCredentials()
@@ -276,15 +302,21 @@ Revoke verifiable credential(s).
276
302
 
277
303
  #### Parameters
278
304
 
279
- • **controller**: `string`
305
+ ##### controller
306
+
307
+ `string`
280
308
 
281
309
  The controller of the identity who can make changes.
282
310
 
283
- • **issuerDocumentId**: `string`
311
+ ##### issuerDocumentId
312
+
313
+ `string`
284
314
 
285
315
  The id of the document to update the revocation list for.
286
316
 
287
- • **credentialIndices**: `number`[]
317
+ ##### credentialIndices
318
+
319
+ `number`[]
288
320
 
289
321
  The revocation bitmap index or indices to revoke.
290
322
 
@@ -304,15 +336,21 @@ Unrevoke verifiable credential(s).
304
336
 
305
337
  #### Parameters
306
338
 
307
- • **controller**: `string`
339
+ ##### controller
340
+
341
+ `string`
308
342
 
309
343
  The controller of the identity who can make changes.
310
344
 
311
- • **issuerDocumentId**: `string`
345
+ ##### issuerDocumentId
346
+
347
+ `string`
312
348
 
313
349
  The id of the document to update the revocation list for.
314
350
 
315
- • **credentialIndices**: `number`[]
351
+ ##### credentialIndices
352
+
353
+ `number`[]
316
354
 
317
355
  The revocation bitmap index or indices to un revoke.
318
356
 
@@ -326,54 +364,60 @@ Nothing.
326
364
 
327
365
  ### createVerifiablePresentation()
328
366
 
329
- > **createVerifiablePresentation**(`controller`, `presentationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `expiresInMinutes`?): `Promise`\<`object`\>
367
+ > **createVerifiablePresentation**(`controller`, `presentationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `expiresInMinutes`?): `Promise`\<\{ `verifiablePresentation`: `IDidVerifiablePresentation`; `jwt`: `string`; \}\>
330
368
 
331
369
  Create a verifiable presentation from the supplied verifiable credentials.
332
370
 
333
371
  #### Parameters
334
372
 
335
- • **controller**: `string`
373
+ ##### controller
374
+
375
+ `string`
336
376
 
337
377
  The controller of the identity who can make changes.
338
378
 
339
- • **presentationMethodId**: `string`
379
+ ##### presentationMethodId
380
+
381
+ `string`
340
382
 
341
383
  The method to associate with the presentation.
342
384
 
343
- • **presentationId**: `undefined` \| `string`
385
+ ##### presentationId
344
386
 
345
387
  The id of the presentation.
346
388
 
347
- • **contexts**: `undefined` \| `IJsonLdContextDefinitionRoot`
389
+ `undefined` | `string`
390
+
391
+ ##### contexts
348
392
 
349
393
  The contexts for the data stored in the verifiable credential.
350
394
 
351
- • **types**: `undefined` \| `string` \| `string`[]
395
+ `undefined` | `IJsonLdContextDefinitionRoot`
396
+
397
+ ##### types
352
398
 
353
399
  The types for the data stored in the verifiable credential.
354
400
 
355
- • **verifiableCredentials**: (`string` \| `IDidVerifiableCredential`)[]
401
+ `undefined` | `string` | `string`[]
402
+
403
+ ##### verifiableCredentials
404
+
405
+ (`string` \| `IDidVerifiableCredential`)[]
356
406
 
357
407
  The credentials to use for creating the presentation in jwt format.
358
408
 
359
- • **expiresInMinutes?**: `number`
409
+ ##### expiresInMinutes?
410
+
411
+ `number`
360
412
 
361
413
  The time in minutes for the presentation to expire.
362
414
 
363
415
  #### Returns
364
416
 
365
- `Promise`\<`object`\>
417
+ `Promise`\<\{ `verifiablePresentation`: `IDidVerifiablePresentation`; `jwt`: `string`; \}\>
366
418
 
367
419
  The created verifiable presentation and its token.
368
420
 
369
- ##### verifiablePresentation
370
-
371
- > **verifiablePresentation**: `IDidVerifiablePresentation`
372
-
373
- ##### jwt
374
-
375
- > **jwt**: `string`
376
-
377
421
  #### Throws
378
422
 
379
423
  NotFoundError if the id can not be resolved.
@@ -382,34 +426,24 @@ NotFoundError if the id can not be resolved.
382
426
 
383
427
  ### checkVerifiablePresentation()
384
428
 
385
- > **checkVerifiablePresentation**(`presentationJwt`): `Promise`\<`object`\>
429
+ > **checkVerifiablePresentation**(`presentationJwt`): `Promise`\<\{ `revoked`: `boolean`; `verifiablePresentation`: `IDidVerifiablePresentation`; `issuers`: `IDidDocument`[]; \}\>
386
430
 
387
431
  Check a verifiable presentation is valid.
388
432
 
389
433
  #### Parameters
390
434
 
391
- • **presentationJwt**: `string`
435
+ ##### presentationJwt
436
+
437
+ `string`
392
438
 
393
439
  The presentation to verify.
394
440
 
395
441
  #### Returns
396
442
 
397
- `Promise`\<`object`\>
443
+ `Promise`\<\{ `revoked`: `boolean`; `verifiablePresentation`: `IDidVerifiablePresentation`; `issuers`: `IDidDocument`[]; \}\>
398
444
 
399
445
  The presentation stored in the jwt and the revocation status.
400
446
 
401
- ##### revoked
402
-
403
- > **revoked**: `boolean`
404
-
405
- ##### verifiablePresentation?
406
-
407
- > `optional` **verifiablePresentation**: `IDidVerifiablePresentation`
408
-
409
- ##### issuers?
410
-
411
- > `optional` **issuers**: `IDidDocument`[]
412
-
413
447
  ***
414
448
 
415
449
  ### createProof()
@@ -420,15 +454,21 @@ Create a proof for arbitrary data with the specified verification method.
420
454
 
421
455
  #### Parameters
422
456
 
423
- • **controller**: `string`
457
+ ##### controller
458
+
459
+ `string`
424
460
 
425
461
  The controller of the identity who can make changes.
426
462
 
427
- • **verificationMethodId**: `string`
463
+ ##### verificationMethodId
464
+
465
+ `string`
428
466
 
429
467
  The verification method id to use.
430
468
 
431
- • **bytes**: `Uint8Array`
469
+ ##### bytes
470
+
471
+ `Uint8Array`
432
472
 
433
473
  The data bytes to sign.
434
474
 
@@ -448,11 +488,15 @@ Verify proof for arbitrary data with the specified verification method.
448
488
 
449
489
  #### Parameters
450
490
 
451
- • **bytes**: `Uint8Array`
491
+ ##### bytes
492
+
493
+ `Uint8Array`
452
494
 
453
495
  The data bytes to verify.
454
496
 
455
- • **proof**: `IDidProof`
497
+ ##### proof
498
+
499
+ `IDidProof`
456
500
 
457
501
  The proof to verify.
458
502
 
@@ -22,15 +22,21 @@ Create the profile properties for an identity.
22
22
 
23
23
  #### Parameters
24
24
 
25
- • **publicProfile?**: `T`
25
+ ##### publicProfile?
26
+
27
+ `T`
26
28
 
27
29
  The public profile data as JSON-LD.
28
30
 
29
- • **privateProfile?**: `U`
31
+ ##### privateProfile?
32
+
33
+ `U`
30
34
 
31
35
  The private profile data as JSON-LD.
32
36
 
33
- • **identity?**: `string`
37
+ ##### identity?
38
+
39
+ `string`
34
40
 
35
41
  The identity to perform the profile operation on.
36
42
 
@@ -44,42 +50,36 @@ Nothing.
44
50
 
45
51
  ### get()
46
52
 
47
- > **get**(`publicPropertyNames`?, `privatePropertyNames`?, `identity`?): `Promise`\<`object`\>
53
+ > **get**(`publicPropertyNames`?, `privatePropertyNames`?, `identity`?): `Promise`\<\{ `identity`: `string`; `publicProfile`: `Partial`\<`T`\>; `privateProfile`: `Partial`\<`U`\>; \}\>
48
54
 
49
55
  Get the profile properties for an identity.
50
56
 
51
57
  #### Parameters
52
58
 
53
- • **publicPropertyNames?**: keyof `T`[]
59
+ ##### publicPropertyNames?
60
+
61
+ keyof `T`[]
54
62
 
55
63
  The public properties to get for the profile, defaults to all.
56
64
 
57
- • **privatePropertyNames?**: keyof `U`[]
65
+ ##### privatePropertyNames?
66
+
67
+ keyof `U`[]
58
68
 
59
69
  The private properties to get for the profile, defaults to all.
60
70
 
61
- • **identity?**: `string`
71
+ ##### identity?
72
+
73
+ `string`
62
74
 
63
75
  The identity to perform the profile operation on.
64
76
 
65
77
  #### Returns
66
78
 
67
- `Promise`\<`object`\>
79
+ `Promise`\<\{ `identity`: `string`; `publicProfile`: `Partial`\<`T`\>; `privateProfile`: `Partial`\<`U`\>; \}\>
68
80
 
69
81
  The items identity and the properties.
70
82
 
71
- ##### identity
72
-
73
- > **identity**: `string`
74
-
75
- ##### publicProfile?
76
-
77
- > `optional` **publicProfile**: `Partial`\<`T`\>
78
-
79
- ##### privateProfile?
80
-
81
- > `optional` **privateProfile**: `Partial`\<`U`\>
82
-
83
83
  ***
84
84
 
85
85
  ### getPublic()
@@ -90,11 +90,15 @@ Get the public profile properties for an identity.
90
90
 
91
91
  #### Parameters
92
92
 
93
- • **identity**: `string`
93
+ ##### identity
94
+
95
+ `string`
94
96
 
95
97
  The identity to perform the profile operation on.
96
98
 
97
- • **propertyNames?**: keyof `T`[]
99
+ ##### propertyNames?
100
+
101
+ keyof `T`[]
98
102
 
99
103
  The public properties to get for the profile, defaults to all.
100
104
 
@@ -114,15 +118,21 @@ Update the profile properties of an identity.
114
118
 
115
119
  #### Parameters
116
120
 
117
- • **publicProfile?**: `T`
121
+ ##### publicProfile?
122
+
123
+ `T`
118
124
 
119
125
  The public profile data as JSON-LD.
120
126
 
121
- • **privateProfile?**: `U`
127
+ ##### privateProfile?
128
+
129
+ `U`
122
130
 
123
131
  The private profile data as JSON-LD.
124
132
 
125
- • **identity?**: `string`
133
+ ##### identity?
134
+
135
+ `string`
126
136
 
127
137
  The identity to perform the profile operation on.
128
138
 
@@ -142,7 +152,9 @@ Delete the profile for an identity.
142
152
 
143
153
  #### Parameters
144
154
 
145
- • **identity?**: `string`
155
+ ##### identity?
156
+
157
+ `string`
146
158
 
147
159
  The identity to perform the profile operation on.
148
160
 
@@ -156,42 +168,38 @@ Nothing.
156
168
 
157
169
  ### list()
158
170
 
159
- > **list**(`publicFilters`?, `publicPropertyNames`?, `cursor`?, `pageSize`?): `Promise`\<`object`\>
171
+ > **list**(`publicFilters`?, `publicPropertyNames`?, `cursor`?, `pageSize`?): `Promise`\<\{ `items`: `object`[]; `cursor`: `string`; \}\>
160
172
 
161
173
  Get a list of the requested identities.
162
174
 
163
175
  #### Parameters
164
176
 
165
- • **publicFilters?**: `object`[]
177
+ ##### publicFilters?
178
+
179
+ `object`[]
166
180
 
167
181
  The filters to apply to the identities public profiles.
168
182
 
169
- • **publicPropertyNames?**: keyof `T`[]
183
+ ##### publicPropertyNames?
184
+
185
+ keyof `T`[]
170
186
 
171
187
  The public properties to get for the profile, defaults to all.
172
188
 
173
- • **cursor?**: `string`
189
+ ##### cursor?
190
+
191
+ `string`
174
192
 
175
193
  The cursor for paged requests.
176
194
 
177
- • **pageSize?**: `number`
195
+ ##### pageSize?
196
+
197
+ `number`
178
198
 
179
199
  The maximum number of items in a page.
180
200
 
181
201
  #### Returns
182
202
 
183
- `Promise`\<`object`\>
203
+ `Promise`\<\{ `items`: `object`[]; `cursor`: `string`; \}\>
184
204
 
185
205
  The list of items and cursor for paging.
186
-
187
- ##### items
188
-
189
- > **items**: `object`[]
190
-
191
- The identities.
192
-
193
- ##### cursor?
194
-
195
- > `optional` **cursor**: `string`
196
-
197
- An optional cursor, when defined can be used to call find to get more entities.