@twin.org/identity-models 0.0.1-next.7 → 0.0.1-next.9

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.
@@ -67,8 +67,8 @@ export interface IIdentityConnector extends IComponent {
67
67
  * @returns The created verifiable credential and its token.
68
68
  * @throws NotFoundError if the id can not be resolved.
69
69
  */
70
- createVerifiableCredential(controller: string, verificationMethodId: string, id: string | undefined, credential: IJsonLdNodeObject, revocationIndex?: number): Promise<{
71
- verifiableCredential: IDidVerifiableCredential;
70
+ createVerifiableCredential<T extends IJsonLdNodeObject = IJsonLdNodeObject>(controller: string, verificationMethodId: string, id: string | undefined, credential: T, revocationIndex?: number): Promise<{
71
+ verifiableCredential: IDidVerifiableCredential<T>;
72
72
  jwt: string;
73
73
  }>;
74
74
  /**
@@ -76,9 +76,9 @@ export interface IIdentityConnector extends IComponent {
76
76
  * @param credentialJwt The credential to verify.
77
77
  * @returns The credential stored in the jwt and the revocation status.
78
78
  */
79
- checkVerifiableCredential(credentialJwt: string): Promise<{
79
+ checkVerifiableCredential<T extends IJsonLdNodeObject = IJsonLdNodeObject>(credentialJwt: string): Promise<{
80
80
  revoked: boolean;
81
- verifiableCredential?: IDidVerifiableCredential;
81
+ verifiableCredential?: IDidVerifiableCredential<T>;
82
82
  }>;
83
83
  /**
84
84
  * Revoke verifiable credential(s).
@@ -108,8 +108,8 @@ export interface IIdentityConnector extends IComponent {
108
108
  * @returns The created verifiable presentation and its token.
109
109
  * @throws NotFoundError if the id can not be resolved.
110
110
  */
111
- createVerifiablePresentation(controller: string, presentationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential)[], expiresInMinutes?: number): Promise<{
112
- verifiablePresentation: IDidVerifiablePresentation;
111
+ createVerifiablePresentation<T extends IJsonLdNodeObject = IJsonLdNodeObject>(controller: string, presentationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential<T>)[], expiresInMinutes?: number): Promise<{
112
+ verifiablePresentation: IDidVerifiablePresentation<T>;
113
113
  jwt: string;
114
114
  }>;
115
115
  /**
@@ -117,9 +117,9 @@ export interface IIdentityConnector extends IComponent {
117
117
  * @param presentationJwt The presentation to verify.
118
118
  * @returns The presentation stored in the jwt and the revocation status.
119
119
  */
120
- checkVerifiablePresentation(presentationJwt: string): Promise<{
120
+ checkVerifiablePresentation<T extends IJsonLdNodeObject = IJsonLdNodeObject>(presentationJwt: string): Promise<{
121
121
  revoked: boolean;
122
- verifiablePresentation?: IDidVerifiablePresentation;
122
+ verifiablePresentation?: IDidVerifiablePresentation<T>;
123
123
  issuers?: IDidDocument[];
124
124
  }>;
125
125
  /**
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/identity-service-models - Changelog
2
2
 
3
- ## v0.0.1-next.7
3
+ ## v0.0.1-next.9
4
4
 
5
5
  - Initial Release
@@ -194,10 +194,14 @@ NotFoundError if the id can not be resolved.
194
194
 
195
195
  ### createVerifiableCredential()
196
196
 
197
- > **createVerifiableCredential**(`controller`, `verificationMethodId`, `id`, `credential`, `revocationIndex`?): `Promise`\<`object`\>
197
+ > **createVerifiableCredential**\<`T`\>(`controller`, `verificationMethodId`, `id`, `credential`, `revocationIndex`?): `Promise`\<`object`\>
198
198
 
199
199
  Create a verifiable credential for a verification method.
200
200
 
201
+ #### Type Parameters
202
+
203
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
204
+
201
205
  #### Parameters
202
206
 
203
207
  • **controller**: `string`
@@ -212,7 +216,7 @@ The verification method id to use.
212
216
 
213
217
  The id of the credential.
214
218
 
215
- • **credential**: `IJsonLdNodeObject`
219
+ • **credential**: `T`
216
220
 
217
221
  The credential to store in the verifiable credential.
218
222
 
@@ -228,7 +232,7 @@ The created verifiable credential and its token.
228
232
 
229
233
  ##### verifiableCredential
230
234
 
231
- > **verifiableCredential**: `IDidVerifiableCredential`
235
+ > **verifiableCredential**: `IDidVerifiableCredential`\<`T`\>
232
236
 
233
237
  ##### jwt
234
238
 
@@ -242,10 +246,14 @@ NotFoundError if the id can not be resolved.
242
246
 
243
247
  ### checkVerifiableCredential()
244
248
 
245
- > **checkVerifiableCredential**(`credentialJwt`): `Promise`\<`object`\>
249
+ > **checkVerifiableCredential**\<`T`\>(`credentialJwt`): `Promise`\<`object`\>
246
250
 
247
251
  Check a verifiable credential is valid.
248
252
 
253
+ #### Type Parameters
254
+
255
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
256
+
249
257
  #### Parameters
250
258
 
251
259
  • **credentialJwt**: `string`
@@ -264,7 +272,7 @@ The credential stored in the jwt and the revocation status.
264
272
 
265
273
  ##### verifiableCredential?
266
274
 
267
- > `optional` **verifiableCredential**: `IDidVerifiableCredential`
275
+ > `optional` **verifiableCredential**: `IDidVerifiableCredential`\<`T`\>
268
276
 
269
277
  ***
270
278
 
@@ -326,10 +334,14 @@ Nothing.
326
334
 
327
335
  ### createVerifiablePresentation()
328
336
 
329
- > **createVerifiablePresentation**(`controller`, `presentationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `expiresInMinutes`?): `Promise`\<`object`\>
337
+ > **createVerifiablePresentation**\<`T`\>(`controller`, `presentationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `expiresInMinutes`?): `Promise`\<`object`\>
330
338
 
331
339
  Create a verifiable presentation from the supplied verifiable credentials.
332
340
 
341
+ #### Type Parameters
342
+
343
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
344
+
333
345
  #### Parameters
334
346
 
335
347
  • **controller**: `string`
@@ -352,7 +364,7 @@ The contexts for the data stored in the verifiable credential.
352
364
 
353
365
  The types for the data stored in the verifiable credential.
354
366
 
355
- • **verifiableCredentials**: (`string` \| `IDidVerifiableCredential`)[]
367
+ • **verifiableCredentials**: (`string` \| `IDidVerifiableCredential`\<`T`\>)[]
356
368
 
357
369
  The credentials to use for creating the presentation in jwt format.
358
370
 
@@ -368,7 +380,7 @@ The created verifiable presentation and its token.
368
380
 
369
381
  ##### verifiablePresentation
370
382
 
371
- > **verifiablePresentation**: `IDidVerifiablePresentation`
383
+ > **verifiablePresentation**: `IDidVerifiablePresentation`\<`T`\>
372
384
 
373
385
  ##### jwt
374
386
 
@@ -382,10 +394,14 @@ NotFoundError if the id can not be resolved.
382
394
 
383
395
  ### checkVerifiablePresentation()
384
396
 
385
- > **checkVerifiablePresentation**(`presentationJwt`): `Promise`\<`object`\>
397
+ > **checkVerifiablePresentation**\<`T`\>(`presentationJwt`): `Promise`\<`object`\>
386
398
 
387
399
  Check a verifiable presentation is valid.
388
400
 
401
+ #### Type Parameters
402
+
403
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
404
+
389
405
  #### Parameters
390
406
 
391
407
  • **presentationJwt**: `string`
@@ -404,7 +420,7 @@ The presentation stored in the jwt and the revocation status.
404
420
 
405
421
  ##### verifiablePresentation?
406
422
 
407
- > `optional` **verifiablePresentation**: `IDidVerifiablePresentation`
423
+ > `optional` **verifiablePresentation**: `IDidVerifiablePresentation`\<`T`\>
408
424
 
409
425
  ##### issuers?
410
426
 
@@ -10,9 +10,9 @@ Response to get an identity public profile.
10
10
 
11
11
  The response headers.
12
12
 
13
- #### Content-Type
13
+ #### content-type
14
14
 
15
- > **Content-Type**: `"application/ld+json"`
15
+ > **content-type**: `"application/ld+json"`
16
16
 
17
17
  ***
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-models",
3
- "version": "0.0.1-next.7",
3
+ "version": "0.0.1-next.9",
4
4
  "description": "Models which define the structure of the contracts and connectors",
5
5
  "repository": {
6
6
  "type": "git",