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