@twin.org/identity-models 0.0.1-next.4 → 0.0.1-next.6

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.
@@ -1,4 +1,5 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
+ import type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
3
  import type { DidVerificationMethodType, IDidDocument, IDidDocumentVerificationMethod, IDidService, IDidVerifiableCredential, IDidVerifiablePresentation } from "@twin.org/standards-w3c-did";
3
4
  /**
4
5
  * Interface describing an identity connector.
@@ -60,16 +61,14 @@ export interface IIdentityConnector extends IComponent {
60
61
  * Create a verifiable credential for a verification method.
61
62
  * @param controller The controller of the identity who can make changes.
62
63
  * @param verificationMethodId The verification method id to use.
63
- * @param credentialId The id of the credential.
64
- * @param types The type for the data stored in the verifiable credential.
65
- * @param subject The subject data to store for the credential.
66
- * @param contexts Additional contexts to include in the credential.
64
+ * @param id The id of the credential.
65
+ * @param credential The credential to store in the verifiable credential.
67
66
  * @param revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
68
67
  * @returns The created verifiable credential and its token.
69
68
  * @throws NotFoundError if the id can not be resolved.
70
69
  */
71
- createVerifiableCredential<T>(controller: string, verificationMethodId: string, credentialId: string | undefined, types: string | string[] | undefined, subject: T | T[], contexts?: string | string[], revocationIndex?: number): Promise<{
72
- verifiableCredential: IDidVerifiableCredential<T>;
70
+ createVerifiableCredential(controller: string, verificationMethodId: string, id: string | undefined, credential: IJsonLdNodeObject, revocationIndex?: number): Promise<{
71
+ verifiableCredential: IDidVerifiableCredential;
73
72
  jwt: string;
74
73
  }>;
75
74
  /**
@@ -77,9 +76,9 @@ export interface IIdentityConnector extends IComponent {
77
76
  * @param credentialJwt The credential to verify.
78
77
  * @returns The credential stored in the jwt and the revocation status.
79
78
  */
80
- checkVerifiableCredential<T>(credentialJwt: string): Promise<{
79
+ checkVerifiableCredential(credentialJwt: string): Promise<{
81
80
  revoked: boolean;
82
- verifiableCredential?: IDidVerifiableCredential<T>;
81
+ verifiableCredential?: IDidVerifiableCredential;
83
82
  }>;
84
83
  /**
85
84
  * Revoke verifiable credential(s).
@@ -101,14 +100,15 @@ export interface IIdentityConnector extends IComponent {
101
100
  * Create a verifiable presentation from the supplied verifiable credentials.
102
101
  * @param controller The controller of the identity who can make changes.
103
102
  * @param presentationMethodId The method to associate with the presentation.
103
+ * @param presentationId The id of the presentation.
104
+ * @param contexts The contexts for the data stored in the verifiable credential.
104
105
  * @param types The types for the data stored in the verifiable credential.
105
106
  * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.
106
- * @param contexts Additional contexts to include in the presentation.
107
107
  * @param expiresInMinutes The time in minutes for the presentation to expire.
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, types: string | string[] | undefined, verifiableCredentials: string[], contexts?: string | string[], expiresInMinutes?: number): Promise<{
111
+ createVerifiablePresentation(controller: string, presentationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential)[], expiresInMinutes?: number): Promise<{
112
112
  verifiablePresentation: IDidVerifiablePresentation;
113
113
  jwt: string;
114
114
  }>;
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/identity-service-models - Changelog
2
2
 
3
- ## v0.0.1-next.4
3
+ ## v0.0.1-next.6
4
4
 
5
5
  - Initial Release
@@ -194,14 +194,10 @@ NotFoundError if the id can not be resolved.
194
194
 
195
195
  ### createVerifiableCredential()
196
196
 
197
- > **createVerifiableCredential**\<`T`\>(`controller`, `verificationMethodId`, `credentialId`, `types`, `subject`, `contexts`?, `revocationIndex`?): `Promise`\<`object`\>
197
+ > **createVerifiableCredential**(`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**
204
-
205
201
  #### Parameters
206
202
 
207
203
  • **controller**: `string`
@@ -212,21 +208,13 @@ The controller of the identity who can make changes.
212
208
 
213
209
  The verification method id to use.
214
210
 
215
- • **credentialId**: `undefined` \| `string`
211
+ • **id**: `undefined` \| `string`
216
212
 
217
213
  The id of the credential.
218
214
 
219
- • **types**: `undefined` \| `string` \| `string`[]
220
-
221
- The type for the data stored in the verifiable credential.
215
+ • **credential**: `IJsonLdNodeObject`
222
216
 
223
- **subject**: `T` \| `T`[]
224
-
225
- The subject data to store for the credential.
226
-
227
- • **contexts?**: `string` \| `string`[]
228
-
229
- Additional contexts to include in the credential.
217
+ The credential to store in the verifiable credential.
230
218
 
231
219
  • **revocationIndex?**: `number`
232
220
 
@@ -240,7 +228,7 @@ The created verifiable credential and its token.
240
228
 
241
229
  ##### verifiableCredential
242
230
 
243
- > **verifiableCredential**: `IDidVerifiableCredential`\<`T`\>
231
+ > **verifiableCredential**: `IDidVerifiableCredential`
244
232
 
245
233
  ##### jwt
246
234
 
@@ -254,14 +242,10 @@ NotFoundError if the id can not be resolved.
254
242
 
255
243
  ### checkVerifiableCredential()
256
244
 
257
- > **checkVerifiableCredential**\<`T`\>(`credentialJwt`): `Promise`\<`object`\>
245
+ > **checkVerifiableCredential**(`credentialJwt`): `Promise`\<`object`\>
258
246
 
259
247
  Check a verifiable credential is valid.
260
248
 
261
- #### Type Parameters
262
-
263
- • **T**
264
-
265
249
  #### Parameters
266
250
 
267
251
  • **credentialJwt**: `string`
@@ -280,7 +264,7 @@ The credential stored in the jwt and the revocation status.
280
264
 
281
265
  ##### verifiableCredential?
282
266
 
283
- > `optional` **verifiableCredential**: `IDidVerifiableCredential`\<`T`\>
267
+ > `optional` **verifiableCredential**: `IDidVerifiableCredential`
284
268
 
285
269
  ***
286
270
 
@@ -342,7 +326,7 @@ Nothing.
342
326
 
343
327
  ### createVerifiablePresentation()
344
328
 
345
- > **createVerifiablePresentation**(`controller`, `presentationMethodId`, `types`, `verifiableCredentials`, `contexts`?, `expiresInMinutes`?): `Promise`\<`object`\>
329
+ > **createVerifiablePresentation**(`controller`, `presentationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `expiresInMinutes`?): `Promise`\<`object`\>
346
330
 
347
331
  Create a verifiable presentation from the supplied verifiable credentials.
348
332
 
@@ -356,18 +340,22 @@ The controller of the identity who can make changes.
356
340
 
357
341
  The method to associate with the presentation.
358
342
 
343
+ • **presentationId**: `undefined` \| `string`
344
+
345
+ The id of the presentation.
346
+
347
+ • **contexts**: `undefined` \| `IJsonLdContextDefinitionRoot`
348
+
349
+ The contexts for the data stored in the verifiable credential.
350
+
359
351
  • **types**: `undefined` \| `string` \| `string`[]
360
352
 
361
353
  The types for the data stored in the verifiable credential.
362
354
 
363
- • **verifiableCredentials**: `string`[]
355
+ • **verifiableCredentials**: (`string` \| `IDidVerifiableCredential`)[]
364
356
 
365
357
  The credentials to use for creating the presentation in jwt format.
366
358
 
367
- • **contexts?**: `string` \| `string`[]
368
-
369
- Additional contexts to include in the presentation.
370
-
371
359
  • **expiresInMinutes?**: `number`
372
360
 
373
361
  The time in minutes for the presentation to expire.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-models",
3
- "version": "0.0.1-next.4",
3
+ "version": "0.0.1-next.6",
4
4
  "description": "Models which define the structure of the contracts and connectors",
5
5
  "repository": {
6
6
  "type": "git",