@twin.org/identity-rest-client 0.0.2-next.3 → 0.0.2-next.5

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.
@@ -146,15 +146,17 @@ class IdentityClient extends apiCore.BaseRestClient {
146
146
  * @param verificationMethodId The verification method id to use.
147
147
  * @param id The id of the credential.
148
148
  * @param subject The credential subject to store in the verifiable credential.
149
- * @param revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
149
+ * @param options Additional options for creating the verifiable credential.
150
+ * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
151
+ * @param options.expirationDate The date the verifiable credential is valid until.
150
152
  * @returns The created verifiable credential and its token.
151
153
  * @throws NotFoundError if the id can not be resolved.
152
154
  */
153
- async verifiableCredentialCreate(verificationMethodId, id, subject, revocationIndex) {
155
+ async verifiableCredentialCreate(verificationMethodId, id, subject, options) {
154
156
  core.Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
155
157
  core.Guards.object(this.CLASS_NAME, "subject", subject);
156
- if (!core.Is.undefined(revocationIndex)) {
157
- core.Guards.number(this.CLASS_NAME, "revocationIndex", revocationIndex);
158
+ if (!core.Is.undefined(options?.revocationIndex)) {
159
+ core.Guards.number(this.CLASS_NAME, "options.revocationIndex", options?.revocationIndex);
158
160
  }
159
161
  const idParts = identityModels.DocumentHelper.parseId(verificationMethodId);
160
162
  const response = await this.fetch("/:identity/verifiable-credential", "POST", {
@@ -165,7 +167,8 @@ class IdentityClient extends apiCore.BaseRestClient {
165
167
  body: {
166
168
  credentialId: id,
167
169
  subject,
168
- revocationIndex
170
+ revocationIndex: options?.revocationIndex,
171
+ expirationDate: options?.expirationDate?.toISOString()
169
172
  }
170
173
  });
171
174
  return response.body;
@@ -144,15 +144,17 @@ class IdentityClient extends BaseRestClient {
144
144
  * @param verificationMethodId The verification method id to use.
145
145
  * @param id The id of the credential.
146
146
  * @param subject The credential subject to store in the verifiable credential.
147
- * @param revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
147
+ * @param options Additional options for creating the verifiable credential.
148
+ * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
149
+ * @param options.expirationDate The date the verifiable credential is valid until.
148
150
  * @returns The created verifiable credential and its token.
149
151
  * @throws NotFoundError if the id can not be resolved.
150
152
  */
151
- async verifiableCredentialCreate(verificationMethodId, id, subject, revocationIndex) {
153
+ async verifiableCredentialCreate(verificationMethodId, id, subject, options) {
152
154
  Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
153
155
  Guards.object(this.CLASS_NAME, "subject", subject);
154
- if (!Is.undefined(revocationIndex)) {
155
- Guards.number(this.CLASS_NAME, "revocationIndex", revocationIndex);
156
+ if (!Is.undefined(options?.revocationIndex)) {
157
+ Guards.number(this.CLASS_NAME, "options.revocationIndex", options?.revocationIndex);
156
158
  }
157
159
  const idParts = DocumentHelper.parseId(verificationMethodId);
158
160
  const response = await this.fetch("/:identity/verifiable-credential", "POST", {
@@ -163,7 +165,8 @@ class IdentityClient extends BaseRestClient {
163
165
  body: {
164
166
  credentialId: id,
165
167
  subject,
166
- revocationIndex
168
+ revocationIndex: options?.revocationIndex,
169
+ expirationDate: options?.expirationDate?.toISOString()
167
170
  }
168
171
  });
169
172
  return response.body;
@@ -68,11 +68,16 @@ export declare class IdentityClient extends BaseRestClient implements IIdentityC
68
68
  * @param verificationMethodId The verification method id to use.
69
69
  * @param id The id of the credential.
70
70
  * @param subject The credential subject to store in the verifiable credential.
71
- * @param revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
71
+ * @param options Additional options for creating the verifiable credential.
72
+ * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
73
+ * @param options.expirationDate The date the verifiable credential is valid until.
72
74
  * @returns The created verifiable credential and its token.
73
75
  * @throws NotFoundError if the id can not be resolved.
74
76
  */
75
- verifiableCredentialCreate(verificationMethodId: string, id: string | undefined, subject: IJsonLdNodeObject, revocationIndex?: number): Promise<{
77
+ verifiableCredentialCreate(verificationMethodId: string, id: string | undefined, subject: IJsonLdNodeObject, options?: {
78
+ revocationIndex?: number;
79
+ expirationDate?: Date;
80
+ }): Promise<{
76
81
  verifiableCredential: IDidVerifiableCredential;
77
82
  jwt: string;
78
83
  }>;
package/docs/changelog.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @twin.org/identity-rest-client - Changelog
2
2
 
3
+ ## [0.0.2-next.5](https://github.com/twinfoundation/identity/compare/identity-rest-client-v0.0.2-next.4...identity-rest-client-v0.0.2-next.5) (2025-09-15)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **identity-rest-client:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/identity-models bumped from 0.0.2-next.4 to 0.0.2-next.5
16
+
17
+ ## [0.0.2-next.4](https://github.com/twinfoundation/identity/compare/identity-rest-client-v0.0.2-next.3...identity-rest-client-v0.0.2-next.4) (2025-09-12)
18
+
19
+
20
+ ### Features
21
+
22
+ * add expiration date option to vc creation ([73e05e1](https://github.com/twinfoundation/identity/commit/73e05e1ae61112c7e056889969751f4ff82d9f29))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/identity-models bumped from 0.0.2-next.3 to 0.0.2-next.4
30
+
3
31
  ## [0.0.2-next.3](https://github.com/twinfoundation/identity/compare/identity-rest-client-v0.0.2-next.2...identity-rest-client-v0.0.2-next.3) (2025-08-29)
4
32
 
5
33
 
@@ -260,7 +260,7 @@ NotFoundError if the id can not be resolved.
260
260
 
261
261
  ### verifiableCredentialCreate()
262
262
 
263
- > **verifiableCredentialCreate**(`verificationMethodId`, `id`, `subject`, `revocationIndex?`): `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
263
+ > **verifiableCredentialCreate**(`verificationMethodId`, `id`, `subject`, `options?`): `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
264
264
 
265
265
  Create a verifiable credential for a verification method.
266
266
 
@@ -284,12 +284,22 @@ The id of the credential.
284
284
 
285
285
  The credential subject to store in the verifiable credential.
286
286
 
287
- ##### revocationIndex?
287
+ ##### options?
288
+
289
+ Additional options for creating the verifiable credential.
290
+
291
+ ###### revocationIndex?
288
292
 
289
293
  `number`
290
294
 
291
295
  The bitmap revocation index of the credential, if undefined will not have revocation status.
292
296
 
297
+ ###### expirationDate?
298
+
299
+ `Date`
300
+
301
+ The date the verifiable credential is valid until.
302
+
293
303
  #### Returns
294
304
 
295
305
  `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-rest-client",
3
- "version": "0.0.2-next.3",
3
+ "version": "0.0.2-next.5",
4
4
  "description": "Identity contract implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "@twin.org/data-core": "next",
21
21
  "@twin.org/data-json-ld": "next",
22
22
  "@twin.org/entity": "next",
23
- "@twin.org/identity-models": "0.0.2-next.3",
23
+ "@twin.org/identity-models": "0.0.2-next.5",
24
24
  "@twin.org/nameof": "next",
25
25
  "@twin.org/standards-w3c-did": "next"
26
26
  },