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

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