@twin.org/identity-rest-client 0.0.2-next.7 → 0.0.2-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.
@@ -11,17 +11,17 @@ var apiModels = require('@twin.org/api-models');
11
11
  /**
12
12
  * Client for performing identity through to REST endpoints.
13
13
  */
14
- class IdentityClient extends apiCore.BaseRestClient {
14
+ class IdentityRestClient extends apiCore.BaseRestClient {
15
15
  /**
16
16
  * Runtime name for the class.
17
17
  */
18
- CLASS_NAME = "IdentityClient";
18
+ static CLASS_NAME = "IdentityRestClient";
19
19
  /**
20
20
  * Create a new instance of IdentityClient.
21
21
  * @param config The configuration for the client.
22
22
  */
23
23
  constructor(config) {
24
- super("IdentityClient", config, "identity");
24
+ super("IdentityRestClient", config, "identity");
25
25
  }
26
26
  /**
27
27
  * Create a new identity.
@@ -42,7 +42,7 @@ class IdentityClient extends apiCore.BaseRestClient {
42
42
  * @returns Nothing.
43
43
  */
44
44
  async identityRemove(identity) {
45
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
45
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "identity", identity);
46
46
  await this.fetch("/:identity", "DELETE", {
47
47
  pathParams: {
48
48
  identity
@@ -59,8 +59,8 @@ class IdentityClient extends apiCore.BaseRestClient {
59
59
  * @throws NotSupportedError if the platform does not support multiple keys.
60
60
  */
61
61
  async verificationMethodCreate(identity, verificationMethodType, verificationMethodId) {
62
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
63
- core.Guards.arrayOneOf(this.CLASS_NAME, "verificationMethodType", verificationMethodType, Object.values(standardsW3cDid.DidVerificationMethodType));
62
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "identity", identity);
63
+ core.Guards.arrayOneOf(IdentityRestClient.CLASS_NAME, "verificationMethodType", verificationMethodType, Object.values(standardsW3cDid.DidVerificationMethodType));
64
64
  const response = await this.fetch("/:identity/verification-method", "POST", {
65
65
  pathParams: {
66
66
  identity
@@ -80,7 +80,7 @@ class IdentityClient extends apiCore.BaseRestClient {
80
80
  * @throws NotSupportedError if the platform does not support multiple revocable keys.
81
81
  */
82
82
  async verificationMethodRemove(verificationMethodId) {
83
- core.Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
83
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "verificationMethodId", verificationMethodId);
84
84
  const idParts = identityModels.DocumentHelper.parseId(verificationMethodId);
85
85
  await this.fetch("/:identity/verification-method/:verificationMethodId", "DELETE", {
86
86
  pathParams: {
@@ -99,19 +99,19 @@ class IdentityClient extends apiCore.BaseRestClient {
99
99
  * @throws NotFoundError if the id can not be resolved.
100
100
  */
101
101
  async serviceCreate(identity, serviceId, serviceType, serviceEndpoint) {
102
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
103
- core.Guards.stringValue(this.CLASS_NAME, "serviceId", serviceId);
102
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "identity", identity);
103
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "serviceId", serviceId);
104
104
  if (core.Is.array(serviceType)) {
105
- core.Guards.arrayValue(this.CLASS_NAME, "serviceType", serviceType);
105
+ core.Guards.arrayValue(IdentityRestClient.CLASS_NAME, "serviceType", serviceType);
106
106
  }
107
107
  else {
108
- core.Guards.stringValue(this.CLASS_NAME, "serviceType", serviceType);
108
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "serviceType", serviceType);
109
109
  }
110
110
  if (core.Is.array(serviceEndpoint)) {
111
- core.Guards.arrayValue(this.CLASS_NAME, "serviceEndpoint", serviceEndpoint);
111
+ core.Guards.arrayValue(IdentityRestClient.CLASS_NAME, "serviceEndpoint", serviceEndpoint);
112
112
  }
113
113
  else {
114
- core.Guards.stringValue(this.CLASS_NAME, "serviceEndpoint", serviceEndpoint);
114
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "serviceEndpoint", serviceEndpoint);
115
115
  }
116
116
  const response = await this.fetch("/:identity/service", "POST", {
117
117
  pathParams: {
@@ -132,7 +132,7 @@ class IdentityClient extends apiCore.BaseRestClient {
132
132
  * @throws NotFoundError if the id can not be resolved.
133
133
  */
134
134
  async serviceRemove(serviceId) {
135
- core.Guards.stringValue(this.CLASS_NAME, "serviceId", serviceId);
135
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "serviceId", serviceId);
136
136
  const idParts = identityModels.DocumentHelper.parseId(serviceId);
137
137
  await this.fetch("/:identity/service/:serviceId", "DELETE", {
138
138
  pathParams: {
@@ -153,10 +153,10 @@ class IdentityClient extends apiCore.BaseRestClient {
153
153
  * @throws NotFoundError if the id can not be resolved.
154
154
  */
155
155
  async verifiableCredentialCreate(verificationMethodId, id, subject, options) {
156
- core.Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
157
- core.Guards.object(this.CLASS_NAME, "subject", subject);
156
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "verificationMethodId", verificationMethodId);
157
+ core.Guards.object(IdentityRestClient.CLASS_NAME, "subject", subject);
158
158
  if (!core.Is.undefined(options?.revocationIndex)) {
159
- core.Guards.number(this.CLASS_NAME, "options.revocationIndex", options?.revocationIndex);
159
+ core.Guards.number(IdentityRestClient.CLASS_NAME, "options.revocationIndex", options?.revocationIndex);
160
160
  }
161
161
  const idParts = identityModels.DocumentHelper.parseId(verificationMethodId);
162
162
  const response = await this.fetch("/:identity/verifiable-credential", "POST", {
@@ -179,7 +179,7 @@ class IdentityClient extends apiCore.BaseRestClient {
179
179
  * @returns The credential stored in the jwt and the revocation status.
180
180
  */
181
181
  async verifiableCredentialVerify(credentialJwt) {
182
- core.Guards.stringValue(this.CLASS_NAME, "credentialJwt", credentialJwt);
182
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "credentialJwt", credentialJwt);
183
183
  const response = await this.fetch("/verifiable-credential/verify", "POST", {
184
184
  query: {
185
185
  jwt: credentialJwt
@@ -194,8 +194,8 @@ class IdentityClient extends apiCore.BaseRestClient {
194
194
  * @returns Nothing.
195
195
  */
196
196
  async verifiableCredentialRevoke(issuerId, credentialIndex) {
197
- core.Guards.stringValue(this.CLASS_NAME, "issuerId", issuerId);
198
- core.Guards.integer(this.CLASS_NAME, "credentialIndex", credentialIndex);
197
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "issuerId", issuerId);
198
+ core.Guards.integer(IdentityRestClient.CLASS_NAME, "credentialIndex", credentialIndex);
199
199
  await this.fetch("/:identity/verifiable-credential/revoke/:revocationIndex", "GET", {
200
200
  pathParams: {
201
201
  identity: issuerId,
@@ -210,8 +210,8 @@ class IdentityClient extends apiCore.BaseRestClient {
210
210
  * @returns Nothing.
211
211
  */
212
212
  async verifiableCredentialUnrevoke(issuerId, credentialIndex) {
213
- core.Guards.stringValue(this.CLASS_NAME, "issuerId", issuerId);
214
- core.Guards.integer(this.CLASS_NAME, "credentialIndex", credentialIndex);
213
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "issuerId", issuerId);
214
+ core.Guards.integer(IdentityRestClient.CLASS_NAME, "credentialIndex", credentialIndex);
215
215
  await this.fetch("/:identity/verifiable-credential/unrevoke/:revocationIndex", "GET", {
216
216
  pathParams: {
217
217
  identity: issuerId,
@@ -231,16 +231,16 @@ class IdentityClient extends apiCore.BaseRestClient {
231
231
  * @throws NotFoundError if the id can not be resolved.
232
232
  */
233
233
  async verifiablePresentationCreate(verificationMethodId, presentationId, contexts, types, verifiableCredentials, expiresInMinutes) {
234
- core.Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
234
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "verificationMethodId", verificationMethodId);
235
235
  if (core.Is.array(types)) {
236
- core.Guards.arrayValue(this.CLASS_NAME, "types", types);
236
+ core.Guards.arrayValue(IdentityRestClient.CLASS_NAME, "types", types);
237
237
  }
238
238
  else if (core.Is.string(types)) {
239
- core.Guards.stringValue(this.CLASS_NAME, "types", types);
239
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "types", types);
240
240
  }
241
- core.Guards.arrayValue(this.CLASS_NAME, "verifiableCredentials", verifiableCredentials);
241
+ core.Guards.arrayValue(IdentityRestClient.CLASS_NAME, "verifiableCredentials", verifiableCredentials);
242
242
  if (!core.Is.undefined(expiresInMinutes)) {
243
- core.Guards.integer(this.CLASS_NAME, "expiresInMinutes", expiresInMinutes);
243
+ core.Guards.integer(IdentityRestClient.CLASS_NAME, "expiresInMinutes", expiresInMinutes);
244
244
  }
245
245
  const idParts = identityModels.DocumentHelper.parseId(verificationMethodId);
246
246
  const response = await this.fetch("/:identity/verifiable-presentation", "POST", {
@@ -264,7 +264,7 @@ class IdentityClient extends apiCore.BaseRestClient {
264
264
  * @returns The presentation stored in the jwt and the revocation status.
265
265
  */
266
266
  async verifiablePresentationVerify(presentationJwt) {
267
- core.Guards.stringValue(this.CLASS_NAME, "presentationJwt", presentationJwt);
267
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "presentationJwt", presentationJwt);
268
268
  const response = await this.fetch("/verifiable-presentation/verify", "POST", {
269
269
  query: {
270
270
  jwt: presentationJwt
@@ -280,9 +280,9 @@ class IdentityClient extends apiCore.BaseRestClient {
280
280
  * @returns The proof.
281
281
  */
282
282
  async proofCreate(verificationMethodId, proofType, unsecureDocument) {
283
- core.Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
284
- core.Guards.arrayOneOf(this.CLASS_NAME, "proofType", proofType, Object.values(standardsW3cDid.ProofTypes));
285
- core.Guards.object(this.CLASS_NAME, "unsecureDocument", unsecureDocument);
283
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "verificationMethodId", verificationMethodId);
284
+ core.Guards.arrayOneOf(IdentityRestClient.CLASS_NAME, "proofType", proofType, Object.values(standardsW3cDid.ProofTypes));
285
+ core.Guards.object(IdentityRestClient.CLASS_NAME, "unsecureDocument", unsecureDocument);
286
286
  const idParts = identityModels.DocumentHelper.parseId(verificationMethodId);
287
287
  const response = await this.fetch("/:identity/proof", "POST", {
288
288
  pathParams: {
@@ -303,9 +303,9 @@ class IdentityClient extends apiCore.BaseRestClient {
303
303
  * @returns True if the proof is verified.
304
304
  */
305
305
  async proofVerify(document, proof) {
306
- core.Guards.object(this.CLASS_NAME, "document", document);
307
- core.Guards.object(this.CLASS_NAME, "proof", proof);
308
- core.Guards.stringValue(this.CLASS_NAME, "proof.verificationMethod", proof.verificationMethod);
306
+ core.Guards.object(IdentityRestClient.CLASS_NAME, "document", document);
307
+ core.Guards.object(IdentityRestClient.CLASS_NAME, "proof", proof);
308
+ core.Guards.stringValue(IdentityRestClient.CLASS_NAME, "proof.verificationMethod", proof.verificationMethod);
309
309
  const response = await this.fetch("/proof/verify", "POST", {
310
310
  body: {
311
311
  document,
@@ -321,17 +321,17 @@ class IdentityClient extends apiCore.BaseRestClient {
321
321
  /**
322
322
  * Client for performing identity through to REST endpoints.
323
323
  */
324
- class IdentityProfileClient extends apiCore.BaseRestClient {
324
+ class IdentityProfileRestClient extends apiCore.BaseRestClient {
325
325
  /**
326
326
  * Runtime name for the class.
327
327
  */
328
- CLASS_NAME = "IdentityProfileClient";
328
+ static CLASS_NAME = "IdentityProfileRestClient";
329
329
  /**
330
330
  * Create a new instance of IdentityClient.
331
331
  * @param config The configuration for the client.
332
332
  */
333
333
  constructor(config) {
334
- super("IdentityProfileClient", config, "identity/profile");
334
+ super("IdentityProfileRestClient", config, "identity/profile");
335
335
  }
336
336
  /**
337
337
  * Create the profile properties for an identity.
@@ -373,7 +373,7 @@ class IdentityProfileClient extends apiCore.BaseRestClient {
373
373
  * @returns The items properties.
374
374
  */
375
375
  async getPublic(identity, propertyNames) {
376
- core.Guards.string(this.CLASS_NAME, "identity", identity);
376
+ core.Guards.string(IdentityProfileRestClient.CLASS_NAME, "identity", identity);
377
377
  const response = await this.fetch("/:identity/public", "GET", {
378
378
  pathParams: {
379
379
  identity
@@ -410,10 +410,10 @@ class IdentityProfileClient extends apiCore.BaseRestClient {
410
410
  * @param publicFilters The filters to apply to the identities public profiles.
411
411
  * @param publicPropertyNames The public properties to get for the profile, defaults to all.
412
412
  * @param cursor The cursor for paged requests.
413
- * @param pageSize The maximum number of items in a page.
413
+ * @param limit The maximum number of items in a page.
414
414
  * @returns The list of items and cursor for paging.
415
415
  */
416
- async list(publicFilters, publicPropertyNames, cursor, pageSize) {
416
+ async list(publicFilters, publicPropertyNames, cursor, limit) {
417
417
  const response = await this.fetch("/query", "GET", {
418
418
  query: {
419
419
  publicFilters: apiModels.HttpParameterHelper.arrayToString(
@@ -421,7 +421,7 @@ class IdentityProfileClient extends apiCore.BaseRestClient {
421
421
  publicFilters?.map(f => `${f.propertyName}:${f.propertyValue}`)),
422
422
  publicPropertyNames: apiModels.HttpParameterHelper.arrayToString(publicPropertyNames),
423
423
  cursor,
424
- pageSize
424
+ limit: core.Coerce.string(limit)
425
425
  }
426
426
  });
427
427
  return {
@@ -436,17 +436,17 @@ class IdentityProfileClient extends apiCore.BaseRestClient {
436
436
  /**
437
437
  * Client for performing identity through to REST endpoints.
438
438
  */
439
- class IdentityResolverClient extends apiCore.BaseRestClient {
439
+ class IdentityResolverRestClient extends apiCore.BaseRestClient {
440
440
  /**
441
441
  * Runtime name for the class.
442
442
  */
443
- CLASS_NAME = "IdentityResolverClient";
443
+ static CLASS_NAME = "IdentityResolverRestClient";
444
444
  /**
445
445
  * Create a new instance of IdentityClient.
446
446
  * @param config The configuration for the client.
447
447
  */
448
448
  constructor(config) {
449
- super("IdentityResolverClient", config, "identity");
449
+ super("IdentityResolverRestClient", config, "identity");
450
450
  }
451
451
  /**
452
452
  * Resolve an identity.
@@ -454,7 +454,7 @@ class IdentityResolverClient extends apiCore.BaseRestClient {
454
454
  * @returns The resolved document.
455
455
  */
456
456
  async identityResolve(documentId) {
457
- core.Urn.guard(this.CLASS_NAME, "documentId", documentId);
457
+ core.Urn.guard(IdentityResolverRestClient.CLASS_NAME, "documentId", documentId);
458
458
  const response = await this.fetch("/:identity", "GET", {
459
459
  pathParams: {
460
460
  identity: documentId
@@ -464,6 +464,6 @@ class IdentityResolverClient extends apiCore.BaseRestClient {
464
464
  }
465
465
  }
466
466
 
467
- exports.IdentityClient = IdentityClient;
468
- exports.IdentityProfileClient = IdentityProfileClient;
469
- exports.IdentityResolverClient = IdentityResolverClient;
467
+ exports.IdentityProfileRestClient = IdentityProfileRestClient;
468
+ exports.IdentityResolverRestClient = IdentityResolverRestClient;
469
+ exports.IdentityRestClient = IdentityRestClient;
@@ -1,5 +1,5 @@
1
1
  import { BaseRestClient } from '@twin.org/api-core';
2
- import { Guards, Is, Urn } from '@twin.org/core';
2
+ import { Guards, Is, Coerce, Urn } from '@twin.org/core';
3
3
  import { DocumentHelper } from '@twin.org/identity-models';
4
4
  import { DidVerificationMethodType, ProofTypes } from '@twin.org/standards-w3c-did';
5
5
  import { HttpParameterHelper } from '@twin.org/api-models';
@@ -9,17 +9,17 @@ import { HttpParameterHelper } from '@twin.org/api-models';
9
9
  /**
10
10
  * Client for performing identity through to REST endpoints.
11
11
  */
12
- class IdentityClient extends BaseRestClient {
12
+ class IdentityRestClient extends BaseRestClient {
13
13
  /**
14
14
  * Runtime name for the class.
15
15
  */
16
- CLASS_NAME = "IdentityClient";
16
+ static CLASS_NAME = "IdentityRestClient";
17
17
  /**
18
18
  * Create a new instance of IdentityClient.
19
19
  * @param config The configuration for the client.
20
20
  */
21
21
  constructor(config) {
22
- super("IdentityClient", config, "identity");
22
+ super("IdentityRestClient", config, "identity");
23
23
  }
24
24
  /**
25
25
  * Create a new identity.
@@ -40,7 +40,7 @@ class IdentityClient extends BaseRestClient {
40
40
  * @returns Nothing.
41
41
  */
42
42
  async identityRemove(identity) {
43
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
43
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "identity", identity);
44
44
  await this.fetch("/:identity", "DELETE", {
45
45
  pathParams: {
46
46
  identity
@@ -57,8 +57,8 @@ class IdentityClient extends BaseRestClient {
57
57
  * @throws NotSupportedError if the platform does not support multiple keys.
58
58
  */
59
59
  async verificationMethodCreate(identity, verificationMethodType, verificationMethodId) {
60
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
61
- Guards.arrayOneOf(this.CLASS_NAME, "verificationMethodType", verificationMethodType, Object.values(DidVerificationMethodType));
60
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "identity", identity);
61
+ Guards.arrayOneOf(IdentityRestClient.CLASS_NAME, "verificationMethodType", verificationMethodType, Object.values(DidVerificationMethodType));
62
62
  const response = await this.fetch("/:identity/verification-method", "POST", {
63
63
  pathParams: {
64
64
  identity
@@ -78,7 +78,7 @@ class IdentityClient extends BaseRestClient {
78
78
  * @throws NotSupportedError if the platform does not support multiple revocable keys.
79
79
  */
80
80
  async verificationMethodRemove(verificationMethodId) {
81
- Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
81
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "verificationMethodId", verificationMethodId);
82
82
  const idParts = DocumentHelper.parseId(verificationMethodId);
83
83
  await this.fetch("/:identity/verification-method/:verificationMethodId", "DELETE", {
84
84
  pathParams: {
@@ -97,19 +97,19 @@ class IdentityClient extends BaseRestClient {
97
97
  * @throws NotFoundError if the id can not be resolved.
98
98
  */
99
99
  async serviceCreate(identity, serviceId, serviceType, serviceEndpoint) {
100
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
101
- Guards.stringValue(this.CLASS_NAME, "serviceId", serviceId);
100
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "identity", identity);
101
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "serviceId", serviceId);
102
102
  if (Is.array(serviceType)) {
103
- Guards.arrayValue(this.CLASS_NAME, "serviceType", serviceType);
103
+ Guards.arrayValue(IdentityRestClient.CLASS_NAME, "serviceType", serviceType);
104
104
  }
105
105
  else {
106
- Guards.stringValue(this.CLASS_NAME, "serviceType", serviceType);
106
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "serviceType", serviceType);
107
107
  }
108
108
  if (Is.array(serviceEndpoint)) {
109
- Guards.arrayValue(this.CLASS_NAME, "serviceEndpoint", serviceEndpoint);
109
+ Guards.arrayValue(IdentityRestClient.CLASS_NAME, "serviceEndpoint", serviceEndpoint);
110
110
  }
111
111
  else {
112
- Guards.stringValue(this.CLASS_NAME, "serviceEndpoint", serviceEndpoint);
112
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "serviceEndpoint", serviceEndpoint);
113
113
  }
114
114
  const response = await this.fetch("/:identity/service", "POST", {
115
115
  pathParams: {
@@ -130,7 +130,7 @@ class IdentityClient extends BaseRestClient {
130
130
  * @throws NotFoundError if the id can not be resolved.
131
131
  */
132
132
  async serviceRemove(serviceId) {
133
- Guards.stringValue(this.CLASS_NAME, "serviceId", serviceId);
133
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "serviceId", serviceId);
134
134
  const idParts = DocumentHelper.parseId(serviceId);
135
135
  await this.fetch("/:identity/service/:serviceId", "DELETE", {
136
136
  pathParams: {
@@ -151,10 +151,10 @@ class IdentityClient extends BaseRestClient {
151
151
  * @throws NotFoundError if the id can not be resolved.
152
152
  */
153
153
  async verifiableCredentialCreate(verificationMethodId, id, subject, options) {
154
- Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
155
- Guards.object(this.CLASS_NAME, "subject", subject);
154
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "verificationMethodId", verificationMethodId);
155
+ Guards.object(IdentityRestClient.CLASS_NAME, "subject", subject);
156
156
  if (!Is.undefined(options?.revocationIndex)) {
157
- Guards.number(this.CLASS_NAME, "options.revocationIndex", options?.revocationIndex);
157
+ Guards.number(IdentityRestClient.CLASS_NAME, "options.revocationIndex", options?.revocationIndex);
158
158
  }
159
159
  const idParts = DocumentHelper.parseId(verificationMethodId);
160
160
  const response = await this.fetch("/:identity/verifiable-credential", "POST", {
@@ -177,7 +177,7 @@ class IdentityClient extends BaseRestClient {
177
177
  * @returns The credential stored in the jwt and the revocation status.
178
178
  */
179
179
  async verifiableCredentialVerify(credentialJwt) {
180
- Guards.stringValue(this.CLASS_NAME, "credentialJwt", credentialJwt);
180
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "credentialJwt", credentialJwt);
181
181
  const response = await this.fetch("/verifiable-credential/verify", "POST", {
182
182
  query: {
183
183
  jwt: credentialJwt
@@ -192,8 +192,8 @@ class IdentityClient extends BaseRestClient {
192
192
  * @returns Nothing.
193
193
  */
194
194
  async verifiableCredentialRevoke(issuerId, credentialIndex) {
195
- Guards.stringValue(this.CLASS_NAME, "issuerId", issuerId);
196
- Guards.integer(this.CLASS_NAME, "credentialIndex", credentialIndex);
195
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "issuerId", issuerId);
196
+ Guards.integer(IdentityRestClient.CLASS_NAME, "credentialIndex", credentialIndex);
197
197
  await this.fetch("/:identity/verifiable-credential/revoke/:revocationIndex", "GET", {
198
198
  pathParams: {
199
199
  identity: issuerId,
@@ -208,8 +208,8 @@ class IdentityClient extends BaseRestClient {
208
208
  * @returns Nothing.
209
209
  */
210
210
  async verifiableCredentialUnrevoke(issuerId, credentialIndex) {
211
- Guards.stringValue(this.CLASS_NAME, "issuerId", issuerId);
212
- Guards.integer(this.CLASS_NAME, "credentialIndex", credentialIndex);
211
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "issuerId", issuerId);
212
+ Guards.integer(IdentityRestClient.CLASS_NAME, "credentialIndex", credentialIndex);
213
213
  await this.fetch("/:identity/verifiable-credential/unrevoke/:revocationIndex", "GET", {
214
214
  pathParams: {
215
215
  identity: issuerId,
@@ -229,16 +229,16 @@ class IdentityClient extends BaseRestClient {
229
229
  * @throws NotFoundError if the id can not be resolved.
230
230
  */
231
231
  async verifiablePresentationCreate(verificationMethodId, presentationId, contexts, types, verifiableCredentials, expiresInMinutes) {
232
- Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
232
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "verificationMethodId", verificationMethodId);
233
233
  if (Is.array(types)) {
234
- Guards.arrayValue(this.CLASS_NAME, "types", types);
234
+ Guards.arrayValue(IdentityRestClient.CLASS_NAME, "types", types);
235
235
  }
236
236
  else if (Is.string(types)) {
237
- Guards.stringValue(this.CLASS_NAME, "types", types);
237
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "types", types);
238
238
  }
239
- Guards.arrayValue(this.CLASS_NAME, "verifiableCredentials", verifiableCredentials);
239
+ Guards.arrayValue(IdentityRestClient.CLASS_NAME, "verifiableCredentials", verifiableCredentials);
240
240
  if (!Is.undefined(expiresInMinutes)) {
241
- Guards.integer(this.CLASS_NAME, "expiresInMinutes", expiresInMinutes);
241
+ Guards.integer(IdentityRestClient.CLASS_NAME, "expiresInMinutes", expiresInMinutes);
242
242
  }
243
243
  const idParts = DocumentHelper.parseId(verificationMethodId);
244
244
  const response = await this.fetch("/:identity/verifiable-presentation", "POST", {
@@ -262,7 +262,7 @@ class IdentityClient extends BaseRestClient {
262
262
  * @returns The presentation stored in the jwt and the revocation status.
263
263
  */
264
264
  async verifiablePresentationVerify(presentationJwt) {
265
- Guards.stringValue(this.CLASS_NAME, "presentationJwt", presentationJwt);
265
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "presentationJwt", presentationJwt);
266
266
  const response = await this.fetch("/verifiable-presentation/verify", "POST", {
267
267
  query: {
268
268
  jwt: presentationJwt
@@ -278,9 +278,9 @@ class IdentityClient extends BaseRestClient {
278
278
  * @returns The proof.
279
279
  */
280
280
  async proofCreate(verificationMethodId, proofType, unsecureDocument) {
281
- Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
282
- Guards.arrayOneOf(this.CLASS_NAME, "proofType", proofType, Object.values(ProofTypes));
283
- Guards.object(this.CLASS_NAME, "unsecureDocument", unsecureDocument);
281
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "verificationMethodId", verificationMethodId);
282
+ Guards.arrayOneOf(IdentityRestClient.CLASS_NAME, "proofType", proofType, Object.values(ProofTypes));
283
+ Guards.object(IdentityRestClient.CLASS_NAME, "unsecureDocument", unsecureDocument);
284
284
  const idParts = DocumentHelper.parseId(verificationMethodId);
285
285
  const response = await this.fetch("/:identity/proof", "POST", {
286
286
  pathParams: {
@@ -301,9 +301,9 @@ class IdentityClient extends BaseRestClient {
301
301
  * @returns True if the proof is verified.
302
302
  */
303
303
  async proofVerify(document, proof) {
304
- Guards.object(this.CLASS_NAME, "document", document);
305
- Guards.object(this.CLASS_NAME, "proof", proof);
306
- Guards.stringValue(this.CLASS_NAME, "proof.verificationMethod", proof.verificationMethod);
304
+ Guards.object(IdentityRestClient.CLASS_NAME, "document", document);
305
+ Guards.object(IdentityRestClient.CLASS_NAME, "proof", proof);
306
+ Guards.stringValue(IdentityRestClient.CLASS_NAME, "proof.verificationMethod", proof.verificationMethod);
307
307
  const response = await this.fetch("/proof/verify", "POST", {
308
308
  body: {
309
309
  document,
@@ -319,17 +319,17 @@ class IdentityClient extends BaseRestClient {
319
319
  /**
320
320
  * Client for performing identity through to REST endpoints.
321
321
  */
322
- class IdentityProfileClient extends BaseRestClient {
322
+ class IdentityProfileRestClient extends BaseRestClient {
323
323
  /**
324
324
  * Runtime name for the class.
325
325
  */
326
- CLASS_NAME = "IdentityProfileClient";
326
+ static CLASS_NAME = "IdentityProfileRestClient";
327
327
  /**
328
328
  * Create a new instance of IdentityClient.
329
329
  * @param config The configuration for the client.
330
330
  */
331
331
  constructor(config) {
332
- super("IdentityProfileClient", config, "identity/profile");
332
+ super("IdentityProfileRestClient", config, "identity/profile");
333
333
  }
334
334
  /**
335
335
  * Create the profile properties for an identity.
@@ -371,7 +371,7 @@ class IdentityProfileClient extends BaseRestClient {
371
371
  * @returns The items properties.
372
372
  */
373
373
  async getPublic(identity, propertyNames) {
374
- Guards.string(this.CLASS_NAME, "identity", identity);
374
+ Guards.string(IdentityProfileRestClient.CLASS_NAME, "identity", identity);
375
375
  const response = await this.fetch("/:identity/public", "GET", {
376
376
  pathParams: {
377
377
  identity
@@ -408,10 +408,10 @@ class IdentityProfileClient extends BaseRestClient {
408
408
  * @param publicFilters The filters to apply to the identities public profiles.
409
409
  * @param publicPropertyNames The public properties to get for the profile, defaults to all.
410
410
  * @param cursor The cursor for paged requests.
411
- * @param pageSize The maximum number of items in a page.
411
+ * @param limit The maximum number of items in a page.
412
412
  * @returns The list of items and cursor for paging.
413
413
  */
414
- async list(publicFilters, publicPropertyNames, cursor, pageSize) {
414
+ async list(publicFilters, publicPropertyNames, cursor, limit) {
415
415
  const response = await this.fetch("/query", "GET", {
416
416
  query: {
417
417
  publicFilters: HttpParameterHelper.arrayToString(
@@ -419,7 +419,7 @@ class IdentityProfileClient extends BaseRestClient {
419
419
  publicFilters?.map(f => `${f.propertyName}:${f.propertyValue}`)),
420
420
  publicPropertyNames: HttpParameterHelper.arrayToString(publicPropertyNames),
421
421
  cursor,
422
- pageSize
422
+ limit: Coerce.string(limit)
423
423
  }
424
424
  });
425
425
  return {
@@ -434,17 +434,17 @@ class IdentityProfileClient extends BaseRestClient {
434
434
  /**
435
435
  * Client for performing identity through to REST endpoints.
436
436
  */
437
- class IdentityResolverClient extends BaseRestClient {
437
+ class IdentityResolverRestClient extends BaseRestClient {
438
438
  /**
439
439
  * Runtime name for the class.
440
440
  */
441
- CLASS_NAME = "IdentityResolverClient";
441
+ static CLASS_NAME = "IdentityResolverRestClient";
442
442
  /**
443
443
  * Create a new instance of IdentityClient.
444
444
  * @param config The configuration for the client.
445
445
  */
446
446
  constructor(config) {
447
- super("IdentityResolverClient", config, "identity");
447
+ super("IdentityResolverRestClient", config, "identity");
448
448
  }
449
449
  /**
450
450
  * Resolve an identity.
@@ -452,7 +452,7 @@ class IdentityResolverClient extends BaseRestClient {
452
452
  * @returns The resolved document.
453
453
  */
454
454
  async identityResolve(documentId) {
455
- Urn.guard(this.CLASS_NAME, "documentId", documentId);
455
+ Urn.guard(IdentityResolverRestClient.CLASS_NAME, "documentId", documentId);
456
456
  const response = await this.fetch("/:identity", "GET", {
457
457
  pathParams: {
458
458
  identity: documentId
@@ -462,4 +462,4 @@ class IdentityResolverClient extends BaseRestClient {
462
462
  }
463
463
  }
464
464
 
465
- export { IdentityClient, IdentityProfileClient, IdentityResolverClient };
465
+ export { IdentityProfileRestClient, IdentityResolverRestClient, IdentityRestClient };
@@ -5,11 +5,11 @@ import type { IIdentityProfileComponent } from "@twin.org/identity-models";
5
5
  /**
6
6
  * Client for performing identity through to REST endpoints.
7
7
  */
8
- export declare class IdentityProfileClient<T extends IJsonLdDocument = IJsonLdDocument, U extends IJsonLdDocument = IJsonLdDocument> extends BaseRestClient implements IIdentityProfileComponent<T, U> {
8
+ export declare class IdentityProfileRestClient<T extends IJsonLdDocument = IJsonLdDocument, U extends IJsonLdDocument = IJsonLdDocument> extends BaseRestClient implements IIdentityProfileComponent<T, U> {
9
9
  /**
10
10
  * Runtime name for the class.
11
11
  */
12
- readonly CLASS_NAME: string;
12
+ static readonly CLASS_NAME: string;
13
13
  /**
14
14
  * Create a new instance of IdentityClient.
15
15
  * @param config The configuration for the client.
@@ -57,13 +57,13 @@ export declare class IdentityProfileClient<T extends IJsonLdDocument = IJsonLdDo
57
57
  * @param publicFilters The filters to apply to the identities public profiles.
58
58
  * @param publicPropertyNames The public properties to get for the profile, defaults to all.
59
59
  * @param cursor The cursor for paged requests.
60
- * @param pageSize The maximum number of items in a page.
60
+ * @param limit The maximum number of items in a page.
61
61
  * @returns The list of items and cursor for paging.
62
62
  */
63
63
  list(publicFilters?: {
64
64
  propertyName: string;
65
65
  propertyValue: unknown;
66
- }[], publicPropertyNames?: (keyof T)[], cursor?: string, pageSize?: number): Promise<{
66
+ }[], publicPropertyNames?: (keyof T)[], cursor?: string, limit?: number): Promise<{
67
67
  /**
68
68
  * The identities.
69
69
  */
@@ -5,11 +5,11 @@ import type { IDidDocument } from "@twin.org/standards-w3c-did";
5
5
  /**
6
6
  * Client for performing identity through to REST endpoints.
7
7
  */
8
- export declare class IdentityResolverClient extends BaseRestClient implements IIdentityResolverComponent {
8
+ export declare class IdentityResolverRestClient extends BaseRestClient implements IIdentityResolverComponent {
9
9
  /**
10
10
  * Runtime name for the class.
11
11
  */
12
- readonly CLASS_NAME: string;
12
+ static readonly CLASS_NAME: string;
13
13
  /**
14
14
  * Create a new instance of IdentityClient.
15
15
  * @param config The configuration for the client.
@@ -6,11 +6,11 @@ import { DidVerificationMethodType, type IDidDocument, type IDidDocumentVerifica
6
6
  /**
7
7
  * Client for performing identity through to REST endpoints.
8
8
  */
9
- export declare class IdentityClient extends BaseRestClient implements IIdentityComponent {
9
+ export declare class IdentityRestClient extends BaseRestClient implements IIdentityComponent {
10
10
  /**
11
11
  * Runtime name for the class.
12
12
  */
13
- readonly CLASS_NAME: string;
13
+ static readonly CLASS_NAME: string;
14
14
  /**
15
15
  * Create a new instance of IdentityClient.
16
16
  * @param config The configuration for the client.
@@ -1,3 +1,3 @@
1
- export * from "./identityClient";
2
- export * from "./identityProfileClient";
3
- export * from "./identityResolverClient";
1
+ export * from "./identityRestClient";
2
+ export * from "./identityProfileRestClient";
3
+ export * from "./identityResolverRestClient";
package/docs/changelog.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @twin.org/identity-rest-client - Changelog
2
2
 
3
+ ## [0.0.2-next.9](https://github.com/twinfoundation/identity/compare/identity-rest-client-v0.0.2-next.8...identity-rest-client-v0.0.2-next.9) (2025-10-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * add validate-locales ([04d74b4](https://github.com/twinfoundation/identity/commit/04d74b4d1ebe42672e8ca75a7bdb8e3556afd0be))
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.8 to 0.0.2-next.9
16
+
17
+ ## [0.0.2-next.8](https://github.com/twinfoundation/identity/compare/identity-rest-client-v0.0.2-next.7...identity-rest-client-v0.0.2-next.8) (2025-09-25)
18
+
19
+
20
+ ### Miscellaneous Chores
21
+
22
+ * **identity-rest-client:** Synchronize repo versions
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.7 to 0.0.2-next.8
30
+
3
31
  ## [0.0.2-next.7](https://github.com/twinfoundation/identity/compare/identity-rest-client-v0.0.2-next.6...identity-rest-client-v0.0.2-next.7) (2025-09-23)
4
32
 
5
33
 
@@ -1,4 +1,4 @@
1
- # Class: IdentityProfileClient\<T, U\>
1
+ # Class: IdentityProfileRestClient\<T, U\>
2
2
 
3
3
  Client for performing identity through to REST endpoints.
4
4
 
@@ -24,7 +24,7 @@ Client for performing identity through to REST endpoints.
24
24
 
25
25
  ### Constructor
26
26
 
27
- > **new IdentityProfileClient**\<`T`, `U`\>(`config`): `IdentityProfileClient`\<`T`, `U`\>
27
+ > **new IdentityProfileRestClient**\<`T`, `U`\>(`config`): `IdentityProfileRestClient`\<`T`, `U`\>
28
28
 
29
29
  Create a new instance of IdentityClient.
30
30
 
@@ -38,7 +38,7 @@ The configuration for the client.
38
38
 
39
39
  #### Returns
40
40
 
41
- `IdentityProfileClient`\<`T`, `U`\>
41
+ `IdentityProfileRestClient`\<`T`, `U`\>
42
42
 
43
43
  #### Overrides
44
44
 
@@ -48,14 +48,10 @@ The configuration for the client.
48
48
 
49
49
  ### CLASS\_NAME
50
50
 
51
- > `readonly` **CLASS\_NAME**: `string`
51
+ > `readonly` `static` **CLASS\_NAME**: `string`
52
52
 
53
53
  Runtime name for the class.
54
54
 
55
- #### Implementation of
56
-
57
- `IIdentityProfileComponent.CLASS_NAME`
58
-
59
55
  ## Methods
60
56
 
61
57
  ### create()
@@ -206,7 +202,7 @@ Nothing.
206
202
 
207
203
  ### list()
208
204
 
209
- > **list**(`publicFilters?`, `publicPropertyNames?`, `cursor?`, `pageSize?`): `Promise`\<\{ `items`: `object`[]; `cursor?`: `string`; \}\>
205
+ > **list**(`publicFilters?`, `publicPropertyNames?`, `cursor?`, `limit?`): `Promise`\<\{ `items`: `object`[]; `cursor?`: `string`; \}\>
210
206
 
211
207
  Get a list of the requested identities.
212
208
 
@@ -230,7 +226,7 @@ The public properties to get for the profile, defaults to all.
230
226
 
231
227
  The cursor for paged requests.
232
228
 
233
- ##### pageSize?
229
+ ##### limit?
234
230
 
235
231
  `number`
236
232
 
@@ -1,4 +1,4 @@
1
- # Class: IdentityResolverClient
1
+ # Class: IdentityResolverRestClient
2
2
 
3
3
  Client for performing identity through to REST endpoints.
4
4
 
@@ -14,7 +14,7 @@ Client for performing identity through to REST endpoints.
14
14
 
15
15
  ### Constructor
16
16
 
17
- > **new IdentityResolverClient**(`config`): `IdentityResolverClient`
17
+ > **new IdentityResolverRestClient**(`config`): `IdentityResolverRestClient`
18
18
 
19
19
  Create a new instance of IdentityClient.
20
20
 
@@ -28,7 +28,7 @@ The configuration for the client.
28
28
 
29
29
  #### Returns
30
30
 
31
- `IdentityResolverClient`
31
+ `IdentityResolverRestClient`
32
32
 
33
33
  #### Overrides
34
34
 
@@ -38,14 +38,10 @@ The configuration for the client.
38
38
 
39
39
  ### CLASS\_NAME
40
40
 
41
- > `readonly` **CLASS\_NAME**: `string`
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
43
43
  Runtime name for the class.
44
44
 
45
- #### Implementation of
46
-
47
- `IIdentityResolverComponent.CLASS_NAME`
48
-
49
45
  ## Methods
50
46
 
51
47
  ### identityResolve()
@@ -1,4 +1,4 @@
1
- # Class: IdentityClient
1
+ # Class: IdentityRestClient
2
2
 
3
3
  Client for performing identity through to REST endpoints.
4
4
 
@@ -14,7 +14,7 @@ Client for performing identity through to REST endpoints.
14
14
 
15
15
  ### Constructor
16
16
 
17
- > **new IdentityClient**(`config`): `IdentityClient`
17
+ > **new IdentityRestClient**(`config`): `IdentityRestClient`
18
18
 
19
19
  Create a new instance of IdentityClient.
20
20
 
@@ -28,7 +28,7 @@ The configuration for the client.
28
28
 
29
29
  #### Returns
30
30
 
31
- `IdentityClient`
31
+ `IdentityRestClient`
32
32
 
33
33
  #### Overrides
34
34
 
@@ -38,14 +38,10 @@ The configuration for the client.
38
38
 
39
39
  ### CLASS\_NAME
40
40
 
41
- > `readonly` **CLASS\_NAME**: `string`
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
43
43
  Runtime name for the class.
44
44
 
45
- #### Implementation of
46
-
47
- `IIdentityComponent.CLASS_NAME`
48
-
49
45
  ## Methods
50
46
 
51
47
  ### identityCreate()
@@ -2,6 +2,6 @@
2
2
 
3
3
  ## Classes
4
4
 
5
- - [IdentityClient](classes/IdentityClient.md)
6
- - [IdentityProfileClient](classes/IdentityProfileClient.md)
7
- - [IdentityResolverClient](classes/IdentityResolverClient.md)
5
+ - [IdentityProfileRestClient](classes/IdentityProfileRestClient.md)
6
+ - [IdentityResolverRestClient](classes/IdentityResolverRestClient.md)
7
+ - [IdentityRestClient](classes/IdentityRestClient.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-rest-client",
3
- "version": "0.0.2-next.7",
3
+ "version": "0.0.2-next.9",
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.7",
23
+ "@twin.org/identity-models": "0.0.2-next.9",
24
24
  "@twin.org/nameof": "next",
25
25
  "@twin.org/standards-w3c-did": "next"
26
26
  },
@@ -41,5 +41,20 @@
41
41
  "dist/types",
42
42
  "locales",
43
43
  "docs"
44
- ]
44
+ ],
45
+ "keywords": [
46
+ "twin",
47
+ "trade",
48
+ "iota",
49
+ "framework",
50
+ "blockchain",
51
+ "identity",
52
+ "did",
53
+ "credentials",
54
+ "authentication"
55
+ ],
56
+ "bugs": {
57
+ "url": "git+https://github.com/twinfoundation/identity/issues"
58
+ },
59
+ "homepage": "https://twindev.org"
45
60
  }