@twin.org/api-auth-entity-storage-rest-client 0.0.3-next.2 → 0.0.3-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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # TWIN Auth Entity Storage
1
+ # TWIN API Auth Entity Storage REST Client
2
2
 
3
- Perform REST authentication using entity storage.
3
+ This package provides REST clients for authentication and admin operations against entity storage endpoints.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```shell
8
- npm install @twin.org/api-auth-entity-storage
8
+ npm install @twin.org/api-auth-entity-storage-rest-client
9
9
  ```
10
10
 
11
11
  ## Examples
@@ -0,0 +1,114 @@
1
+ import { BaseRestClient } from "@twin.org/api-core";
2
+ import { Guards } from "@twin.org/core";
3
+ /**
4
+ * The client to connect to the authentication admin service.
5
+ */
6
+ export class EntityStorageAuthenticationAdminRestClient extends BaseRestClient {
7
+ /**
8
+ * Runtime name for the class.
9
+ */
10
+ static CLASS_NAME = "EntityStorageAuthenticationAdminRestClient";
11
+ /**
12
+ * Create a new instance of EntityStorageAuthenticationAdminRestClient.
13
+ * @param config The configuration for the client.
14
+ */
15
+ constructor(config) {
16
+ super("EntityStorageAuthenticationAdminRestClient", config, "authentication/admin");
17
+ }
18
+ /**
19
+ * Returns the class name of the component.
20
+ * @returns The class name of the component.
21
+ */
22
+ className() {
23
+ return EntityStorageAuthenticationAdminRestClient.CLASS_NAME;
24
+ }
25
+ /**
26
+ * Create a login for the user.
27
+ * @param user The user to create.
28
+ * @returns Nothing.
29
+ */
30
+ async create(user) {
31
+ Guards.object(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, "user", user);
32
+ Guards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, "user.email", user.email);
33
+ await this.fetch("/users", "POST", {
34
+ body: user
35
+ });
36
+ }
37
+ /**
38
+ * Update a login for the user.
39
+ * @param user The user to update.
40
+ * @returns Nothing.
41
+ */
42
+ async update(user) {
43
+ Guards.object(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, "user", user);
44
+ Guards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, "user.email", user.email);
45
+ await this.fetch("/users/:email", "PUT", {
46
+ pathParams: {
47
+ email: user.email
48
+ },
49
+ body: user
50
+ });
51
+ }
52
+ /**
53
+ * Get a user by email.
54
+ * @param email The email address of the user to get.
55
+ * @returns The user details.
56
+ */
57
+ async get(email) {
58
+ Guards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, "email", email);
59
+ const response = await this.fetch("/users/:email", "GET", {
60
+ pathParams: {
61
+ email
62
+ }
63
+ });
64
+ return response.body;
65
+ }
66
+ /**
67
+ * Get a user by identity.
68
+ * @param identity The identity of the user to get.
69
+ * @returns The user details.
70
+ */
71
+ async getByIdentity(identity) {
72
+ Guards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, "identity", identity);
73
+ const response = await this.fetch("/users/identity/:identity", "GET", {
74
+ pathParams: {
75
+ identity
76
+ }
77
+ });
78
+ return response.body;
79
+ }
80
+ /**
81
+ * Remove a user.
82
+ * @param email The email address of the user to remove.
83
+ * @returns Nothing.
84
+ */
85
+ async remove(email) {
86
+ Guards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, "email", email);
87
+ await this.fetch("/users/:email", "DELETE", {
88
+ pathParams: {
89
+ email
90
+ }
91
+ });
92
+ }
93
+ /**
94
+ * Update the user's password.
95
+ * @param email The email address of the user to update.
96
+ * @param newPassword The new password for the user.
97
+ * @param currentPassword The current password, optional, if supplied will check against existing.
98
+ * @returns Nothing.
99
+ */
100
+ async updatePassword(email, newPassword, currentPassword) {
101
+ Guards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, "email", email);
102
+ Guards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, "newPassword", newPassword);
103
+ await this.fetch("/users/:email/password", "PUT", {
104
+ pathParams: {
105
+ email
106
+ },
107
+ body: {
108
+ newPassword,
109
+ currentPassword
110
+ }
111
+ });
112
+ }
113
+ }
114
+ //# sourceMappingURL=entityStorageAuthenticationAdminRestClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entityStorageAuthenticationAdminRestClient.js","sourceRoot":"","sources":["../../src/entityStorageAuthenticationAdminRestClient.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC;;GAEG;AACH,MAAM,OAAO,0CACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,gDAAgE;IAEjG;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,+CAAuD,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC7F,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,0CAA0C,CAAC,UAAU,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,IAAuC;QAC1D,MAAM,CAAC,MAAM,CAAC,0CAA0C,CAAC,UAAU,UAAgB,IAAI,CAAC,CAAC;QACzF,MAAM,CAAC,WAAW,CACjB,0CAA0C,CAAC,UAAU,gBAErD,IAAI,CAAC,KAAK,CACV,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA8C,QAAQ,EAAE,MAAM,EAAE;YAC/E,IAAI,EAAE,IAAI;SACV,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAClB,IAA6D;QAE7D,MAAM,CAAC,MAAM,CAAC,0CAA0C,CAAC,UAAU,UAAgB,IAAI,CAAC,CAAC;QACzF,MAAM,CAAC,WAAW,CACjB,0CAA0C,CAAC,UAAU,gBAErD,IAAI,CAAC,KAAK,CACV,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA8C,eAAe,EAAE,KAAK,EAAE;YACrF,UAAU,EAAE;gBACX,KAAK,EAAE,IAAI,CAAC,KAAK;aACjB;YACD,IAAI,EAAE,IAAI;SACV,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,KAAa;QAC7B,MAAM,CAAC,WAAW,CAAC,0CAA0C,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAEhG,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,eAAe,EACf,KAAK,EACL;YACC,UAAU,EAAE;gBACX,KAAK;aACL;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,aAAa,CACzB,QAAgB;QAEhB,MAAM,CAAC,WAAW,CACjB,0CAA0C,CAAC,UAAU,cAErD,QAAQ,CACR,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,2BAA2B,EAC3B,KAAK,EACL;YACC,UAAU,EAAE;gBACX,QAAQ;aACR;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,KAAa;QAChC,MAAM,CAAC,WAAW,CAAC,0CAA0C,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAEhG,MAAM,IAAI,CAAC,KAAK,CAA8C,eAAe,EAAE,QAAQ,EAAE;YACxF,UAAU,EAAE;gBACX,KAAK;aACL;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,cAAc,CAC1B,KAAa,EACb,WAAmB,EACnB,eAAwB;QAExB,MAAM,CAAC,WAAW,CAAC,0CAA0C,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAChG,MAAM,CAAC,WAAW,CACjB,0CAA0C,CAAC,UAAU,iBAErD,WAAW,CACX,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CACf,wBAAwB,EACxB,KAAK,EACL;YACC,UAAU,EAAE;gBACX,KAAK;aACL;YACD,IAAI,EAAE;gBACL,WAAW;gBACX,eAAe;aACf;SACD,CACD,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAdminUserCreateRequest,\n\tIAdminUserGetByIdentityRequest,\n\tIAdminUserGetRequest,\n\tIAdminUserGetResponse,\n\tIAdminUserRemoveRequest,\n\tIAdminUserUpdatePasswordRequest,\n\tIAdminUserUpdateRequest,\n\tIAuthenticationAdminComponent,\n\tIAuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-models\";\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, INoContentResponse } from \"@twin.org/api-models\";\nimport { Guards } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * The client to connect to the authentication admin service.\n */\nexport class EntityStorageAuthenticationAdminRestClient\n\textends BaseRestClient\n\timplements IAuthenticationAdminComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<EntityStorageAuthenticationAdminRestClient>();\n\n\t/**\n\t * Create a new instance of EntityStorageAuthenticationAdminRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<EntityStorageAuthenticationAdminRestClient>(), config, \"authentication/admin\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageAuthenticationAdminRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a login for the user.\n\t * @param user The user to create.\n\t * @returns Nothing.\n\t */\n\tpublic async create(user: Omit<IAuthenticationUser, \"salt\">): Promise<void> {\n\t\tGuards.object(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, nameof(user), user);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\tnameof(user.email),\n\t\t\tuser.email\n\t\t);\n\n\t\tawait this.fetch<IAdminUserCreateRequest, INoContentResponse>(\"/users\", \"POST\", {\n\t\t\tbody: user\n\t\t});\n\t}\n\n\t/**\n\t * Update a login for the user.\n\t * @param user The user to update.\n\t * @returns Nothing.\n\t */\n\tpublic async update(\n\t\tuser: Partial<Omit<IAuthenticationUser, \"password\" | \"salt\">>\n\t): Promise<void> {\n\t\tGuards.object(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, nameof(user), user);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\tnameof(user.email),\n\t\t\tuser.email\n\t\t);\n\n\t\tawait this.fetch<IAdminUserUpdateRequest, INoContentResponse>(\"/users/:email\", \"PUT\", {\n\t\t\tpathParams: {\n\t\t\t\temail: user.email\n\t\t\t},\n\t\t\tbody: user\n\t\t});\n\t}\n\n\t/**\n\t * Get a user by email.\n\t * @param email The email address of the user to get.\n\t * @returns The user details.\n\t */\n\tpublic async get(email: string): Promise<Omit<IAuthenticationUser, \"password\" | \"salt\">> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, nameof(email), email);\n\n\t\tconst response = await this.fetch<IAdminUserGetRequest, IAdminUserGetResponse>(\n\t\t\t\"/users/:email\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\temail\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Get a user by identity.\n\t * @param identity The identity of the user to get.\n\t * @returns The user details.\n\t */\n\tpublic async getByIdentity(\n\t\tidentity: string\n\t): Promise<Omit<IAuthenticationUser, \"password\" | \"salt\">> {\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\tnameof(identity),\n\t\t\tidentity\n\t\t);\n\n\t\tconst response = await this.fetch<IAdminUserGetByIdentityRequest, IAdminUserGetResponse>(\n\t\t\t\"/users/identity/:identity\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\tidentity\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Remove a user.\n\t * @param email The email address of the user to remove.\n\t * @returns Nothing.\n\t */\n\tpublic async remove(email: string): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, nameof(email), email);\n\n\t\tawait this.fetch<IAdminUserRemoveRequest, INoContentResponse>(\"/users/:email\", \"DELETE\", {\n\t\t\tpathParams: {\n\t\t\t\temail\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Update the user's password.\n\t * @param email The email address of the user to update.\n\t * @param newPassword The new password for the user.\n\t * @param currentPassword The current password, optional, if supplied will check against existing.\n\t * @returns Nothing.\n\t */\n\tpublic async updatePassword(\n\t\temail: string,\n\t\tnewPassword: string,\n\t\tcurrentPassword?: string\n\t): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationAdminRestClient.CLASS_NAME, nameof(email), email);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationAdminRestClient.CLASS_NAME,\n\t\t\tnameof(newPassword),\n\t\t\tnewPassword\n\t\t);\n\n\t\tawait this.fetch<IAdminUserUpdatePasswordRequest, INoContentResponse>(\n\t\t\t\"/users/:email/password\",\n\t\t\t\"PUT\",\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\temail\n\t\t\t\t},\n\t\t\t\tbody: {\n\t\t\t\t\tnewPassword,\n\t\t\t\t\tcurrentPassword\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { BaseRestClient } from "@twin.org/api-core";
2
2
  import { Guards } from "@twin.org/core";
3
+ import { CookieHelper, HeaderTypes } from "@twin.org/web";
3
4
  /**
4
5
  * The client to connect to the authentication service.
5
6
  */
@@ -8,12 +9,24 @@ export class EntityStorageAuthenticationRestClient extends BaseRestClient {
8
9
  * Runtime name for the class.
9
10
  */
10
11
  static CLASS_NAME = "EntityStorageAuthenticationRestClient";
12
+ /**
13
+ * The default name for the access token as a cookie.
14
+ * @internal
15
+ */
16
+ static DEFAULT_COOKIE_NAME = "access_token";
17
+ /**
18
+ * The name of the cookie to use for storing the auth token.
19
+ * @internal
20
+ */
21
+ _cookieName;
11
22
  /**
12
23
  * Create a new instance of EntityStorageAuthenticationRestClient.
13
24
  * @param config The configuration for the client.
14
25
  */
15
26
  constructor(config) {
16
27
  super("EntityStorageAuthenticationRestClient", config, "authentication");
28
+ this._cookieName =
29
+ config.cookieName ?? EntityStorageAuthenticationRestClient.DEFAULT_COOKIE_NAME;
17
30
  }
18
31
  /**
19
32
  * Returns the class name of the component.
@@ -37,7 +50,10 @@ export class EntityStorageAuthenticationRestClient extends BaseRestClient {
37
50
  password
38
51
  }
39
52
  });
40
- return response.body;
53
+ return {
54
+ token: CookieHelper.getCookieFromHeaders(response?.headers?.[HeaderTypes.SetCookie], this._cookieName),
55
+ expiry: response.body.expiry
56
+ };
41
57
  }
42
58
  /**
43
59
  * Logout the current user.
@@ -62,23 +78,21 @@ export class EntityStorageAuthenticationRestClient extends BaseRestClient {
62
78
  token
63
79
  }
64
80
  });
65
- return response.body;
81
+ return {
82
+ token: CookieHelper.getCookieFromHeaders(response?.headers?.[HeaderTypes.SetCookie], this._cookieName),
83
+ expiry: response.body.expiry
84
+ };
66
85
  }
67
86
  /**
68
87
  * Update the user's password.
69
- * @param email The email address of the user to update.
70
88
  * @param currentPassword The current password for the user.
71
89
  * @param newPassword The new password for the user.
72
90
  * @returns Nothing.
73
91
  */
74
- async updatePassword(email, currentPassword, newPassword) {
75
- Guards.stringValue(EntityStorageAuthenticationRestClient.CLASS_NAME, "email", email);
92
+ async updatePassword(currentPassword, newPassword) {
76
93
  Guards.stringValue(EntityStorageAuthenticationRestClient.CLASS_NAME, "currentPassword", currentPassword);
77
94
  Guards.stringValue(EntityStorageAuthenticationRestClient.CLASS_NAME, "newPassword", newPassword);
78
- await this.fetch("/:email/password", "PUT", {
79
- pathParams: {
80
- email
81
- },
95
+ await this.fetch("/password", "PUT", {
82
96
  body: {
83
97
  currentPassword,
84
98
  newPassword
@@ -1 +1 @@
1
- {"version":3,"file":"entityStorageAuthenticationRestClient.js","sourceRoot":"","sources":["../../src/entityStorageAuthenticationRestClient.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC;;GAEG;AACH,MAAM,OAAO,qCACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,2CAA2D;IAE5F;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,0CAAkD,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,qCAAqC,CAAC,UAAU,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,KAAK,CACjB,KAAa,EACb,QAAgB;QAKhB,MAAM,CAAC,WAAW,CAAC,qCAAqC,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAC3F,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,cAEhD,QAAQ,CACR,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAgC,QAAQ,EAAE,MAAM,EAAE;YAClF,IAAI,EAAE;gBACL,KAAK;gBACL,QAAQ;aACR;SACD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,KAAc;QACjC,MAAM,IAAI,CAAC,KAAK,CAAqC,SAAS,EAAE,KAAK,EAAE;YACtE,KAAK,EAAE;gBACN,KAAK;aACL;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAO,CAAC,KAAc;QAIlC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,UAAU,EACV,KAAK,EACL;YACC,KAAK,EAAE;gBACN,KAAK;aACL;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,cAAc,CAC1B,KAAa,EACb,eAAuB,EACvB,WAAmB;QAEnB,MAAM,CAAC,WAAW,CAAC,qCAAqC,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAC3F,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,qBAEhD,eAAe,CACf,CAAC;QACF,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,iBAEhD,WAAW,CACX,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA6C,kBAAkB,EAAE,KAAK,EAAE;YACvF,UAAU,EAAE;gBACX,KAAK;aACL;YACD,IAAI,EAAE;gBACL,eAAe;gBACf,WAAW;aACX;SACD,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAuthenticationComponent,\n\tILoginRequest,\n\tILoginResponse,\n\tILogoutRequest,\n\tIRefreshTokenRequest,\n\tIRefreshTokenResponse,\n\tIUpdatePasswordRequest\n} from \"@twin.org/api-auth-entity-storage-models\";\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, INoContentResponse } from \"@twin.org/api-models\";\nimport { Guards } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * The client to connect to the authentication service.\n */\nexport class EntityStorageAuthenticationRestClient\n\textends BaseRestClient\n\timplements IAuthenticationComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<EntityStorageAuthenticationRestClient>();\n\n\t/**\n\t * Create a new instance of EntityStorageAuthenticationRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<EntityStorageAuthenticationRestClient>(), config, \"authentication\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageAuthenticationRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Perform a login for the user.\n\t * @param email The email address for the user.\n\t * @param password The password for the user.\n\t * @returns The authentication token for the user, if it uses a mechanism with public access.\n\t */\n\tpublic async login(\n\t\temail: string,\n\t\tpassword: string\n\t): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\n\t}> {\n\t\tGuards.stringValue(EntityStorageAuthenticationRestClient.CLASS_NAME, nameof(email), email);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\tnameof(password),\n\t\t\tpassword\n\t\t);\n\n\t\tconst response = await this.fetch<ILoginRequest, ILoginResponse>(\"/login\", \"POST\", {\n\t\t\tbody: {\n\t\t\t\temail,\n\t\t\t\tpassword\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Logout the current user.\n\t * @param token The token to logout, if it uses a mechanism with public access.\n\t * @returns Nothing.\n\t */\n\tpublic async logout(token?: string): Promise<void> {\n\t\tawait this.fetch<ILogoutRequest, INoContentResponse>(\"/logout\", \"GET\", {\n\t\t\tquery: {\n\t\t\t\ttoken\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Refresh the token.\n\t * @param token The token to refresh, if it uses a mechanism with public access.\n\t * @returns The refreshed token, if it uses a mechanism with public access.\n\t */\n\tpublic async refresh(token?: string): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\n\t}> {\n\t\tconst response = await this.fetch<IRefreshTokenRequest, IRefreshTokenResponse>(\n\t\t\t\"/refresh\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tquery: {\n\t\t\t\t\ttoken\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Update the user's password.\n\t * @param email The email address of the user to update.\n\t * @param currentPassword The current password for the user.\n\t * @param newPassword The new password for the user.\n\t * @returns Nothing.\n\t */\n\tpublic async updatePassword(\n\t\temail: string,\n\t\tcurrentPassword: string,\n\t\tnewPassword: string\n\t): Promise<void> {\n\t\tGuards.stringValue(EntityStorageAuthenticationRestClient.CLASS_NAME, nameof(email), email);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\tnameof(currentPassword),\n\t\t\tcurrentPassword\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\tnameof(newPassword),\n\t\t\tnewPassword\n\t\t);\n\n\t\tawait this.fetch<IUpdatePasswordRequest, INoContentResponse>(\"/:email/password\", \"PUT\", {\n\t\t\tpathParams: {\n\t\t\t\temail\n\t\t\t},\n\t\t\tbody: {\n\t\t\t\tcurrentPassword,\n\t\t\t\tnewPassword\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"entityStorageAuthenticationRestClient.js","sourceRoot":"","sources":["../../src/entityStorageAuthenticationRestClient.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG1D;;GAEG;AACH,MAAM,OAAO,qCACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,2CAA2D;IAE5F;;;OAGG;IACI,MAAM,CAAU,mBAAmB,GAAW,cAAc,CAAC;IAEpE;;;OAGG;IACc,WAAW,CAAS;IAErC;;;OAGG;IACH,YAAY,MAAgE;QAC3E,KAAK,0CAAkD,MAAM,EAAE,gBAAgB,CAAC,CAAC;QACjF,IAAI,CAAC,WAAW;YACf,MAAM,CAAC,UAAU,IAAI,qCAAqC,CAAC,mBAAmB,CAAC;IACjF,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,qCAAqC,CAAC,UAAU,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,KAAK,CACjB,KAAa,EACb,QAAgB;QAKhB,MAAM,CAAC,WAAW,CAAC,qCAAqC,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAC3F,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,cAEhD,QAAQ,CACR,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAgC,QAAQ,EAAE,MAAM,EAAE;YAClF,IAAI,EAAE;gBACL,KAAK;gBACL,QAAQ;aACR;SACD,CAAC,CAAC;QAEH,OAAO;YACN,KAAK,EAAE,YAAY,CAAC,oBAAoB,CACvC,QAAQ,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,EAC1C,IAAI,CAAC,WAAW,CAChB;YACD,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;SAC5B,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,KAAc;QACjC,MAAM,IAAI,CAAC,KAAK,CAAqC,SAAS,EAAE,KAAK,EAAE;YACtE,KAAK,EAAE;gBACN,KAAK;aACL;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAO,CAAC,KAAc;QAIlC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,UAAU,EACV,KAAK,EACL;YACC,KAAK,EAAE;gBACN,KAAK;aACL;SACD,CACD,CAAC;QAEF,OAAO;YACN,KAAK,EAAE,YAAY,CAAC,oBAAoB,CACvC,QAAQ,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,EAC1C,IAAI,CAAC,WAAW,CAChB;YACD,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;SAC5B,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,cAAc,CAAC,eAAuB,EAAE,WAAmB;QACvE,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,qBAEhD,eAAe,CACf,CAAC;QACF,MAAM,CAAC,WAAW,CACjB,qCAAqC,CAAC,UAAU,iBAEhD,WAAW,CACX,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA6C,WAAW,EAAE,KAAK,EAAE;YAChF,IAAI,EAAE;gBACL,eAAe;gBACf,WAAW;aACX;SACD,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAuthenticationComponent,\n\tILoginRequest,\n\tILoginResponse,\n\tILogoutRequest,\n\tIRefreshTokenRequest,\n\tIRefreshTokenResponse,\n\tIUpdatePasswordRequest\n} from \"@twin.org/api-auth-entity-storage-models\";\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { INoContentResponse } from \"@twin.org/api-models\";\nimport { Guards } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { CookieHelper, HeaderTypes } from \"@twin.org/web\";\nimport type { IEntityStorageAuthenticationRestClientConstructorOptions } from \"./models/entityStorageAuthenticationRestClientConstructorOptions.js\";\n\n/**\n * The client to connect to the authentication service.\n */\nexport class EntityStorageAuthenticationRestClient\n\textends BaseRestClient\n\timplements IAuthenticationComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<EntityStorageAuthenticationRestClient>();\n\n\t/**\n\t * The default name for the access token as a cookie.\n\t * @internal\n\t */\n\tpublic static readonly DEFAULT_COOKIE_NAME: string = \"access_token\";\n\n\t/**\n\t * The name of the cookie to use for storing the auth token.\n\t * @internal\n\t */\n\tprivate readonly _cookieName: string;\n\n\t/**\n\t * Create a new instance of EntityStorageAuthenticationRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IEntityStorageAuthenticationRestClientConstructorOptions) {\n\t\tsuper(nameof<EntityStorageAuthenticationRestClient>(), config, \"authentication\");\n\t\tthis._cookieName =\n\t\t\tconfig.cookieName ?? EntityStorageAuthenticationRestClient.DEFAULT_COOKIE_NAME;\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageAuthenticationRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Perform a login for the user.\n\t * @param email The email address for the user.\n\t * @param password The password for the user.\n\t * @returns The authentication token for the user, if it uses a mechanism with public access.\n\t */\n\tpublic async login(\n\t\temail: string,\n\t\tpassword: string\n\t): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\n\t}> {\n\t\tGuards.stringValue(EntityStorageAuthenticationRestClient.CLASS_NAME, nameof(email), email);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\tnameof(password),\n\t\t\tpassword\n\t\t);\n\n\t\tconst response = await this.fetch<ILoginRequest, ILoginResponse>(\"/login\", \"POST\", {\n\t\t\tbody: {\n\t\t\t\temail,\n\t\t\t\tpassword\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\ttoken: CookieHelper.getCookieFromHeaders(\n\t\t\t\tresponse?.headers?.[HeaderTypes.SetCookie],\n\t\t\t\tthis._cookieName\n\t\t\t),\n\t\t\texpiry: response.body.expiry\n\t\t};\n\t}\n\n\t/**\n\t * Logout the current user.\n\t * @param token The token to logout, if it uses a mechanism with public access.\n\t * @returns Nothing.\n\t */\n\tpublic async logout(token?: string): Promise<void> {\n\t\tawait this.fetch<ILogoutRequest, INoContentResponse>(\"/logout\", \"GET\", {\n\t\t\tquery: {\n\t\t\t\ttoken\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Refresh the token.\n\t * @param token The token to refresh, if it uses a mechanism with public access.\n\t * @returns The refreshed token, if it uses a mechanism with public access.\n\t */\n\tpublic async refresh(token?: string): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\n\t}> {\n\t\tconst response = await this.fetch<IRefreshTokenRequest, IRefreshTokenResponse>(\n\t\t\t\"/refresh\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tquery: {\n\t\t\t\t\ttoken\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn {\n\t\t\ttoken: CookieHelper.getCookieFromHeaders(\n\t\t\t\tresponse?.headers?.[HeaderTypes.SetCookie],\n\t\t\t\tthis._cookieName\n\t\t\t),\n\t\t\texpiry: response.body.expiry\n\t\t};\n\t}\n\n\t/**\n\t * Update the user's password.\n\t * @param currentPassword The current password for the user.\n\t * @param newPassword The new password for the user.\n\t * @returns Nothing.\n\t */\n\tpublic async updatePassword(currentPassword: string, newPassword: string): Promise<void> {\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\tnameof(currentPassword),\n\t\t\tcurrentPassword\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageAuthenticationRestClient.CLASS_NAME,\n\t\t\tnameof(newPassword),\n\t\t\tnewPassword\n\t\t);\n\n\t\tawait this.fetch<IUpdatePasswordRequest, INoContentResponse>(\"/password\", \"PUT\", {\n\t\t\tbody: {\n\t\t\t\tcurrentPassword,\n\t\t\t\tnewPassword\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
package/dist/es/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./entityStorageAuthenticationAdminRestClient.js";
3
4
  export * from "./entityStorageAuthenticationRestClient.js";
5
+ export * from "./models/entityStorageAuthenticationRestClientConstructorOptions.js";
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,4CAA4C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./entityStorageAuthenticationRestClient.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qEAAqE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./entityStorageAuthenticationAdminRestClient.js\";\nexport * from \"./entityStorageAuthenticationRestClient.js\";\nexport * from \"./models/entityStorageAuthenticationRestClientConstructorOptions.js\";\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=entityStorageAuthenticationRestClientConstructorOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entityStorageAuthenticationRestClientConstructorOptions.js","sourceRoot":"","sources":["../../../src/models/entityStorageAuthenticationRestClientConstructorOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IBaseRestClientConfig } from \"@twin.org/api-models\";\n\n/**\n * Options for the Entity Storage Authentication REST client constructor.\n */\nexport interface IEntityStorageAuthenticationRestClientConstructorOptions extends IBaseRestClientConfig {\n\t/**\n\t * The name of the cookie to use for storing the auth token.\n\t * @default access_token\n\t */\n\tcookieName?: string;\n}\n"]}
@@ -0,0 +1,60 @@
1
+ import type { IAuthenticationAdminComponent, IAuthenticationUser } from "@twin.org/api-auth-entity-storage-models";
2
+ import { BaseRestClient } from "@twin.org/api-core";
3
+ import type { IBaseRestClientConfig } from "@twin.org/api-models";
4
+ /**
5
+ * The client to connect to the authentication admin service.
6
+ */
7
+ export declare class EntityStorageAuthenticationAdminRestClient extends BaseRestClient implements IAuthenticationAdminComponent {
8
+ /**
9
+ * Runtime name for the class.
10
+ */
11
+ static readonly CLASS_NAME: string;
12
+ /**
13
+ * Create a new instance of EntityStorageAuthenticationAdminRestClient.
14
+ * @param config The configuration for the client.
15
+ */
16
+ constructor(config: IBaseRestClientConfig);
17
+ /**
18
+ * Returns the class name of the component.
19
+ * @returns The class name of the component.
20
+ */
21
+ className(): string;
22
+ /**
23
+ * Create a login for the user.
24
+ * @param user The user to create.
25
+ * @returns Nothing.
26
+ */
27
+ create(user: Omit<IAuthenticationUser, "salt">): Promise<void>;
28
+ /**
29
+ * Update a login for the user.
30
+ * @param user The user to update.
31
+ * @returns Nothing.
32
+ */
33
+ update(user: Partial<Omit<IAuthenticationUser, "password" | "salt">>): Promise<void>;
34
+ /**
35
+ * Get a user by email.
36
+ * @param email The email address of the user to get.
37
+ * @returns The user details.
38
+ */
39
+ get(email: string): Promise<Omit<IAuthenticationUser, "password" | "salt">>;
40
+ /**
41
+ * Get a user by identity.
42
+ * @param identity The identity of the user to get.
43
+ * @returns The user details.
44
+ */
45
+ getByIdentity(identity: string): Promise<Omit<IAuthenticationUser, "password" | "salt">>;
46
+ /**
47
+ * Remove a user.
48
+ * @param email The email address of the user to remove.
49
+ * @returns Nothing.
50
+ */
51
+ remove(email: string): Promise<void>;
52
+ /**
53
+ * Update the user's password.
54
+ * @param email The email address of the user to update.
55
+ * @param newPassword The new password for the user.
56
+ * @param currentPassword The current password, optional, if supplied will check against existing.
57
+ * @returns Nothing.
58
+ */
59
+ updatePassword(email: string, newPassword: string, currentPassword?: string): Promise<void>;
60
+ }
@@ -1,6 +1,6 @@
1
1
  import type { IAuthenticationComponent } from "@twin.org/api-auth-entity-storage-models";
2
2
  import { BaseRestClient } from "@twin.org/api-core";
3
- import type { IBaseRestClientConfig } from "@twin.org/api-models";
3
+ import type { IEntityStorageAuthenticationRestClientConstructorOptions } from "./models/entityStorageAuthenticationRestClientConstructorOptions.js";
4
4
  /**
5
5
  * The client to connect to the authentication service.
6
6
  */
@@ -13,7 +13,7 @@ export declare class EntityStorageAuthenticationRestClient extends BaseRestClien
13
13
  * Create a new instance of EntityStorageAuthenticationRestClient.
14
14
  * @param config The configuration for the client.
15
15
  */
16
- constructor(config: IBaseRestClientConfig);
16
+ constructor(config: IEntityStorageAuthenticationRestClientConstructorOptions);
17
17
  /**
18
18
  * Returns the class name of the component.
19
19
  * @returns The class name of the component.
@@ -46,10 +46,9 @@ export declare class EntityStorageAuthenticationRestClient extends BaseRestClien
46
46
  }>;
47
47
  /**
48
48
  * Update the user's password.
49
- * @param email The email address of the user to update.
50
49
  * @param currentPassword The current password for the user.
51
50
  * @param newPassword The new password for the user.
52
51
  * @returns Nothing.
53
52
  */
54
- updatePassword(email: string, currentPassword: string, newPassword: string): Promise<void>;
53
+ updatePassword(currentPassword: string, newPassword: string): Promise<void>;
55
54
  }
@@ -1 +1,3 @@
1
+ export * from "./entityStorageAuthenticationAdminRestClient.js";
1
2
  export * from "./entityStorageAuthenticationRestClient.js";
3
+ export * from "./models/entityStorageAuthenticationRestClientConstructorOptions.js";
@@ -0,0 +1,11 @@
1
+ import type { IBaseRestClientConfig } from "@twin.org/api-models";
2
+ /**
3
+ * Options for the Entity Storage Authentication REST client constructor.
4
+ */
5
+ export interface IEntityStorageAuthenticationRestClientConstructorOptions extends IBaseRestClientConfig {
6
+ /**
7
+ * The name of the cookie to use for storing the auth token.
8
+ * @default access_token
9
+ */
10
+ cookieName?: string;
11
+ }
package/docs/changelog.md CHANGED
@@ -1,4 +1,333 @@
1
- # @twin.org/api-auth-entity-storage-rest-client - Changelog
1
+ # Changelog
2
+
3
+ ## [0.0.3-next.21](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.20...api-auth-entity-storage-rest-client-v0.0.3-next.21) (2026-03-11)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.20 to 0.0.3-next.21
16
+ * @twin.org/api-core bumped from 0.0.3-next.20 to 0.0.3-next.21
17
+ * @twin.org/api-models bumped from 0.0.3-next.20 to 0.0.3-next.21
18
+
19
+ ## [0.0.3-next.20](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.19...api-auth-entity-storage-rest-client-v0.0.3-next.20) (2026-02-09)
20
+
21
+
22
+ ### Miscellaneous Chores
23
+
24
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * The following workspace dependencies were updated
30
+ * dependencies
31
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.19 to 0.0.3-next.20
32
+ * @twin.org/api-core bumped from 0.0.3-next.19 to 0.0.3-next.20
33
+ * @twin.org/api-models bumped from 0.0.3-next.19 to 0.0.3-next.20
34
+
35
+ ## [0.0.3-next.19](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.18...api-auth-entity-storage-rest-client-v0.0.3-next.19) (2026-02-06)
36
+
37
+
38
+ ### Features
39
+
40
+ * user admin service ([#77](https://github.com/twinfoundation/api/issues/77)) ([c8491df](https://github.com/twinfoundation/api/commit/c8491df7b07c1f45560c8a78c6adc806d0ececbb))
41
+
42
+
43
+ ### Dependencies
44
+
45
+ * The following workspace dependencies were updated
46
+ * dependencies
47
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.18 to 0.0.3-next.19
48
+ * @twin.org/api-core bumped from 0.0.3-next.18 to 0.0.3-next.19
49
+ * @twin.org/api-models bumped from 0.0.3-next.18 to 0.0.3-next.19
50
+
51
+ ## [0.0.3-next.18](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.17...api-auth-entity-storage-rest-client-v0.0.3-next.18) (2026-02-04)
52
+
53
+
54
+ ### Miscellaneous Chores
55
+
56
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
57
+
58
+
59
+ ### Dependencies
60
+
61
+ * The following workspace dependencies were updated
62
+ * dependencies
63
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.17 to 0.0.3-next.18
64
+ * @twin.org/api-core bumped from 0.0.3-next.17 to 0.0.3-next.18
65
+ * @twin.org/api-models bumped from 0.0.3-next.17 to 0.0.3-next.18
66
+
67
+ ## [0.0.3-next.17](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.16...api-auth-entity-storage-rest-client-v0.0.3-next.17) (2026-01-26)
68
+
69
+
70
+ ### Miscellaneous Chores
71
+
72
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
73
+
74
+
75
+ ### Dependencies
76
+
77
+ * The following workspace dependencies were updated
78
+ * dependencies
79
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.16 to 0.0.3-next.17
80
+ * @twin.org/api-core bumped from 0.0.3-next.16 to 0.0.3-next.17
81
+ * @twin.org/api-models bumped from 0.0.3-next.16 to 0.0.3-next.17
82
+
83
+ ## [0.0.3-next.16](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.15...api-auth-entity-storage-rest-client-v0.0.3-next.16) (2026-01-26)
84
+
85
+
86
+ ### Miscellaneous Chores
87
+
88
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
89
+
90
+
91
+ ### Dependencies
92
+
93
+ * The following workspace dependencies were updated
94
+ * dependencies
95
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.15 to 0.0.3-next.16
96
+ * @twin.org/api-core bumped from 0.0.3-next.15 to 0.0.3-next.16
97
+ * @twin.org/api-models bumped from 0.0.3-next.15 to 0.0.3-next.16
98
+
99
+ ## [0.0.3-next.15](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.14...api-auth-entity-storage-rest-client-v0.0.3-next.15) (2026-01-22)
100
+
101
+
102
+ ### Miscellaneous Chores
103
+
104
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
105
+
106
+
107
+ ### Dependencies
108
+
109
+ * The following workspace dependencies were updated
110
+ * dependencies
111
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.14 to 0.0.3-next.15
112
+ * @twin.org/api-core bumped from 0.0.3-next.14 to 0.0.3-next.15
113
+ * @twin.org/api-models bumped from 0.0.3-next.14 to 0.0.3-next.15
114
+
115
+ ## [0.0.3-next.14](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.13...api-auth-entity-storage-rest-client-v0.0.3-next.14) (2026-01-20)
116
+
117
+
118
+ ### Miscellaneous Chores
119
+
120
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
121
+
122
+
123
+ ### Dependencies
124
+
125
+ * The following workspace dependencies were updated
126
+ * dependencies
127
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.13 to 0.0.3-next.14
128
+ * @twin.org/api-core bumped from 0.0.3-next.13 to 0.0.3-next.14
129
+ * @twin.org/api-models bumped from 0.0.3-next.13 to 0.0.3-next.14
130
+
131
+ ## [0.0.3-next.13](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.12...api-auth-entity-storage-rest-client-v0.0.3-next.13) (2026-01-19)
132
+
133
+
134
+ ### Features
135
+
136
+ * remove authentication generators ([#66](https://github.com/twinfoundation/api/issues/66)) ([adaa169](https://github.com/twinfoundation/api/commit/adaa1698df1c5ccb0ad645a7a7c0d3ef82ef6ac1))
137
+
138
+
139
+ ### Dependencies
140
+
141
+ * The following workspace dependencies were updated
142
+ * dependencies
143
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.12 to 0.0.3-next.13
144
+ * @twin.org/api-core bumped from 0.0.3-next.12 to 0.0.3-next.13
145
+ * @twin.org/api-models bumped from 0.0.3-next.12 to 0.0.3-next.13
146
+
147
+ ## [0.0.3-next.12](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.11...api-auth-entity-storage-rest-client-v0.0.3-next.12) (2026-01-12)
148
+
149
+
150
+ ### Miscellaneous Chores
151
+
152
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
153
+
154
+
155
+ ### Dependencies
156
+
157
+ * The following workspace dependencies were updated
158
+ * dependencies
159
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.11 to 0.0.3-next.12
160
+ * @twin.org/api-core bumped from 0.0.3-next.11 to 0.0.3-next.12
161
+ * @twin.org/api-models bumped from 0.0.3-next.11 to 0.0.3-next.12
162
+
163
+ ## [0.0.3-next.11](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.10...api-auth-entity-storage-rest-client-v0.0.3-next.11) (2026-01-08)
164
+
165
+
166
+ ### Miscellaneous Chores
167
+
168
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
169
+
170
+
171
+ ### Dependencies
172
+
173
+ * The following workspace dependencies were updated
174
+ * dependencies
175
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.10 to 0.0.3-next.11
176
+ * @twin.org/api-core bumped from 0.0.3-next.10 to 0.0.3-next.11
177
+ * @twin.org/api-models bumped from 0.0.3-next.10 to 0.0.3-next.11
178
+
179
+ ## [0.0.3-next.10](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.9...api-auth-entity-storage-rest-client-v0.0.3-next.10) (2026-01-05)
180
+
181
+
182
+ ### Miscellaneous Chores
183
+
184
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
185
+
186
+
187
+ ### Dependencies
188
+
189
+ * The following workspace dependencies were updated
190
+ * dependencies
191
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.9 to 0.0.3-next.10
192
+ * @twin.org/api-core bumped from 0.0.3-next.9 to 0.0.3-next.10
193
+ * @twin.org/api-models bumped from 0.0.3-next.9 to 0.0.3-next.10
194
+
195
+ ## [0.0.3-next.9](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.8...api-auth-entity-storage-rest-client-v0.0.3-next.9) (2026-01-05)
196
+
197
+
198
+ ### Features
199
+
200
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
201
+ * add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
202
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
203
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
204
+ * modify authHeaderProcessor to retain token in response body ([#53](https://github.com/twinfoundation/api/issues/53)) ([5d9ae76](https://github.com/twinfoundation/api/commit/5d9ae76b5b52a8e10dac391b2d5784638a186583))
205
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
206
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
207
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
208
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
209
+
210
+
211
+ ### Bug Fixes
212
+
213
+ * use correct format for log messaging ([44bc2a4](https://github.com/twinfoundation/api/commit/44bc2a4f7cf1f9c38a7e8c6f90ccb2424c958de9))
214
+
215
+
216
+ ### Dependencies
217
+
218
+ * The following workspace dependencies were updated
219
+ * dependencies
220
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.8 to 0.0.3-next.9
221
+ * @twin.org/api-core bumped from 0.0.3-next.8 to 0.0.3-next.9
222
+ * @twin.org/api-models bumped from 0.0.3-next.8 to 0.0.3-next.9
223
+
224
+ ## [0.0.3-next.8](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.7...api-auth-entity-storage-rest-client-v0.0.3-next.8) (2025-12-17)
225
+
226
+
227
+ ### Miscellaneous Chores
228
+
229
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
230
+
231
+
232
+ ### Dependencies
233
+
234
+ * The following workspace dependencies were updated
235
+ * dependencies
236
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.7 to 0.0.3-next.8
237
+ * @twin.org/api-core bumped from 0.0.3-next.7 to 0.0.3-next.8
238
+ * @twin.org/api-models bumped from 0.0.3-next.7 to 0.0.3-next.8
239
+
240
+ ## [0.0.3-next.7](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.6...api-auth-entity-storage-rest-client-v0.0.3-next.7) (2025-11-26)
241
+
242
+
243
+ ### Miscellaneous Chores
244
+
245
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
246
+
247
+
248
+ ### Dependencies
249
+
250
+ * The following workspace dependencies were updated
251
+ * dependencies
252
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.6 to 0.0.3-next.7
253
+ * @twin.org/api-core bumped from 0.0.3-next.6 to 0.0.3-next.7
254
+ * @twin.org/api-models bumped from 0.0.3-next.6 to 0.0.3-next.7
255
+
256
+ ## [0.0.3-next.6](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.5...api-auth-entity-storage-rest-client-v0.0.3-next.6) (2025-11-20)
257
+
258
+
259
+ ### Miscellaneous Chores
260
+
261
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
262
+
263
+
264
+ ### Dependencies
265
+
266
+ * The following workspace dependencies were updated
267
+ * dependencies
268
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.5 to 0.0.3-next.6
269
+ * @twin.org/api-core bumped from 0.0.3-next.5 to 0.0.3-next.6
270
+ * @twin.org/api-models bumped from 0.0.3-next.5 to 0.0.3-next.6
271
+
272
+ ## [0.0.3-next.5](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.4...api-auth-entity-storage-rest-client-v0.0.3-next.5) (2025-11-14)
273
+
274
+
275
+ ### Miscellaneous Chores
276
+
277
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
278
+
279
+
280
+ ### Dependencies
281
+
282
+ * The following workspace dependencies were updated
283
+ * dependencies
284
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.4 to 0.0.3-next.5
285
+ * @twin.org/api-core bumped from 0.0.3-next.4 to 0.0.3-next.5
286
+ * @twin.org/api-models bumped from 0.0.3-next.4 to 0.0.3-next.5
287
+
288
+ ## [0.0.3-next.4](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.3...api-auth-entity-storage-rest-client-v0.0.3-next.4) (2025-11-14)
289
+
290
+
291
+ ### Features
292
+
293
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
294
+ * add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
295
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
296
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
297
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
298
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
299
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
300
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
301
+
302
+
303
+ ### Bug Fixes
304
+
305
+ * use correct format for log messaging ([44bc2a4](https://github.com/twinfoundation/api/commit/44bc2a4f7cf1f9c38a7e8c6f90ccb2424c958de9))
306
+
307
+
308
+ ### Dependencies
309
+
310
+ * The following workspace dependencies were updated
311
+ * dependencies
312
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.3 to 0.0.3-next.4
313
+ * @twin.org/api-core bumped from 0.0.3-next.3 to 0.0.3-next.4
314
+ * @twin.org/api-models bumped from 0.0.3-next.3 to 0.0.3-next.4
315
+
316
+ ## [0.0.3-next.3](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.2...api-auth-entity-storage-rest-client-v0.0.3-next.3) (2025-11-14)
317
+
318
+
319
+ ### Miscellaneous Chores
320
+
321
+ * **api-auth-entity-storage-rest-client:** Synchronize repo versions
322
+
323
+
324
+ ### Dependencies
325
+
326
+ * The following workspace dependencies were updated
327
+ * dependencies
328
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.2 to 0.0.3-next.3
329
+ * @twin.org/api-core bumped from 0.0.3-next.2 to 0.0.3-next.3
330
+ * @twin.org/api-models bumped from 0.0.3-next.2 to 0.0.3-next.3
2
331
 
3
332
  ## [0.0.3-next.2](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-rest-client-v0.0.3-next.1...api-auth-entity-storage-rest-client-v0.0.3-next.2) (2025-11-12)
4
333
 
package/docs/examples.md CHANGED
@@ -1 +1,73 @@
1
- # @twin.org/api-auth-entity-storage-rest-client - Examples
1
+ # Auth Entity Storage Rest Client Examples
2
+
3
+ Use these snippets to integrate sign-in and user administration flows from browser or server-side TypeScript applications.
4
+
5
+ ## EntityStorageAuthenticationAdminRestClient
6
+
7
+ ```typescript
8
+ import { EntityStorageAuthenticationAdminRestClient } from '@twin.org/api-auth-entity-storage-rest-client';
9
+
10
+ const adminClient = new EntityStorageAuthenticationAdminRestClient({
11
+ endpoint: 'https://api.example.org',
12
+ pathPrefix: 'v1'
13
+ });
14
+
15
+ console.log(adminClient.className()); // EntityStorageAuthenticationAdminRestClient
16
+
17
+ await adminClient.create({
18
+ email: 'ops@example.org',
19
+ password: 'StrongPassword123',
20
+ userIdentity: 'did:example:ops',
21
+ organizationIdentity: 'did:example:core',
22
+ scope: ['admin']
23
+ });
24
+
25
+ await adminClient.update({
26
+ email: 'ops@example.org',
27
+ userIdentity: 'did:example:ops:team',
28
+ scope: ['admin', 'support']
29
+ });
30
+
31
+ await adminClient.updatePassword('ops@example.org', 'StrongPassword124', 'StrongPassword123');
32
+ const adminUser = await adminClient.get('ops@example.org');
33
+ console.log(adminUser.email); // ops@example.org
34
+ ```
35
+
36
+ ```typescript
37
+ import { EntityStorageAuthenticationAdminRestClient } from '@twin.org/api-auth-entity-storage-rest-client';
38
+
39
+ const adminClient = new EntityStorageAuthenticationAdminRestClient({
40
+ endpoint: 'https://api.example.org',
41
+ pathPrefix: 'v1'
42
+ });
43
+
44
+ const byEmail = await adminClient.get('ops@example.org');
45
+ const byIdentity = await adminClient.getByIdentity('ops-team@example.org');
46
+ await adminClient.remove('ops@example.org');
47
+
48
+ console.log(byEmail.email); // ops@example.org
49
+ console.log(byIdentity.userIdentity); // did:example:ops:team
50
+ ```
51
+
52
+ ## EntityStorageAuthenticationRestClient
53
+
54
+ ```typescript
55
+ import { EntityStorageAuthenticationRestClient } from '@twin.org/api-auth-entity-storage-rest-client';
56
+
57
+ const authClient = new EntityStorageAuthenticationRestClient({
58
+ endpoint: 'https://api.example.org',
59
+ pathPrefix: 'v1',
60
+ cookieName: 'access_token'
61
+ });
62
+
63
+ console.log(authClient.className()); // EntityStorageAuthenticationRestClient
64
+
65
+ const loginResponse = await authClient.login('alice@example.org', 'correct-horse-battery-staple');
66
+
67
+ await authClient.updatePassword('correct-horse-battery-staple', 'correct-horse-battery-staple-2');
68
+
69
+ const refreshResponse = await authClient.refresh(loginResponse.token);
70
+
71
+ await authClient.logout(refreshResponse.token);
72
+ console.log(refreshResponse.expiry > 0); // true
73
+ ```
@@ -0,0 +1,295 @@
1
+ # Class: EntityStorageAuthenticationAdminRestClient
2
+
3
+ The client to connect to the authentication admin service.
4
+
5
+ ## Extends
6
+
7
+ - `BaseRestClient`
8
+
9
+ ## Implements
10
+
11
+ - `IAuthenticationAdminComponent`
12
+
13
+ ## Constructors
14
+
15
+ ### Constructor
16
+
17
+ > **new EntityStorageAuthenticationAdminRestClient**(`config`): `EntityStorageAuthenticationAdminRestClient`
18
+
19
+ Create a new instance of EntityStorageAuthenticationAdminRestClient.
20
+
21
+ #### Parameters
22
+
23
+ ##### config
24
+
25
+ `IBaseRestClientConfig`
26
+
27
+ The configuration for the client.
28
+
29
+ #### Returns
30
+
31
+ `EntityStorageAuthenticationAdminRestClient`
32
+
33
+ #### Overrides
34
+
35
+ `BaseRestClient.constructor`
36
+
37
+ ## Properties
38
+
39
+ ### CLASS\_NAME
40
+
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
+
43
+ Runtime name for the class.
44
+
45
+ ## Methods
46
+
47
+ ### className()
48
+
49
+ > **className**(): `string`
50
+
51
+ Returns the class name of the component.
52
+
53
+ #### Returns
54
+
55
+ `string`
56
+
57
+ The class name of the component.
58
+
59
+ #### Implementation of
60
+
61
+ `IAuthenticationAdminComponent.className`
62
+
63
+ ***
64
+
65
+ ### create()
66
+
67
+ > **create**(`user`): `Promise`\<`void`\>
68
+
69
+ Create a login for the user.
70
+
71
+ #### Parameters
72
+
73
+ ##### user
74
+
75
+ `Omit`\<`IAuthenticationUser`, `"salt"`\>
76
+
77
+ The user to create.
78
+
79
+ #### Returns
80
+
81
+ `Promise`\<`void`\>
82
+
83
+ Nothing.
84
+
85
+ #### Implementation of
86
+
87
+ `IAuthenticationAdminComponent.create`
88
+
89
+ ***
90
+
91
+ ### update()
92
+
93
+ > **update**(`user`): `Promise`\<`void`\>
94
+
95
+ Update a login for the user.
96
+
97
+ #### Parameters
98
+
99
+ ##### user
100
+
101
+ `Partial`\<`Omit`\<`IAuthenticationUser`, `"password"` \| `"salt"`\>\>
102
+
103
+ The user to update.
104
+
105
+ #### Returns
106
+
107
+ `Promise`\<`void`\>
108
+
109
+ Nothing.
110
+
111
+ #### Implementation of
112
+
113
+ `IAuthenticationAdminComponent.update`
114
+
115
+ ***
116
+
117
+ ### get()
118
+
119
+ > **get**(`email`): `Promise`\<`Omit`\<`IAuthenticationUser`, `"salt"` \| `"password"`\>\>
120
+
121
+ Get a user by email.
122
+
123
+ #### Parameters
124
+
125
+ ##### email
126
+
127
+ `string`
128
+
129
+ The email address of the user to get.
130
+
131
+ #### Returns
132
+
133
+ `Promise`\<`Omit`\<`IAuthenticationUser`, `"salt"` \| `"password"`\>\>
134
+
135
+ The user details.
136
+
137
+ #### Implementation of
138
+
139
+ `IAuthenticationAdminComponent.get`
140
+
141
+ ***
142
+
143
+ ### getByIdentity()
144
+
145
+ > **getByIdentity**(`identity`): `Promise`\<`Omit`\<`IAuthenticationUser`, `"salt"` \| `"password"`\>\>
146
+
147
+ Get a user by identity.
148
+
149
+ #### Parameters
150
+
151
+ ##### identity
152
+
153
+ `string`
154
+
155
+ The identity of the user to get.
156
+
157
+ #### Returns
158
+
159
+ `Promise`\<`Omit`\<`IAuthenticationUser`, `"salt"` \| `"password"`\>\>
160
+
161
+ The user details.
162
+
163
+ #### Implementation of
164
+
165
+ `IAuthenticationAdminComponent.getByIdentity`
166
+
167
+ ***
168
+
169
+ ### remove()
170
+
171
+ > **remove**(`email`): `Promise`\<`void`\>
172
+
173
+ Remove a user.
174
+
175
+ #### Parameters
176
+
177
+ ##### email
178
+
179
+ `string`
180
+
181
+ The email address of the user to remove.
182
+
183
+ #### Returns
184
+
185
+ `Promise`\<`void`\>
186
+
187
+ Nothing.
188
+
189
+ #### Implementation of
190
+
191
+ `IAuthenticationAdminComponent.remove`
192
+
193
+ ***
194
+
195
+ ### updatePassword()
196
+
197
+ > **updatePassword**(`email`, `newPassword`, `currentPassword?`): `Promise`\<`void`\>
198
+
199
+ Update the user's password.
200
+
201
+ #### Parameters
202
+
203
+ ##### email
204
+
205
+ `string`
206
+
207
+ The email address of the user to update.
208
+
209
+ ##### newPassword
210
+
211
+ `string`
212
+
213
+ The new password for the user.
214
+
215
+ ##### currentPassword?
216
+
217
+ `string`
218
+
219
+ The current password, optional, if supplied will check against existing.
220
+
221
+ #### Returns
222
+
223
+ `Promise`\<`void`\>
224
+
225
+ Nothing.
226
+
227
+ #### Implementation of
228
+
229
+ `IAuthenticationAdminComponent.updatePassword`
230
+
231
+ ***
232
+
233
+ ### getEndpointWithPrefix()
234
+
235
+ > **getEndpointWithPrefix**(): `string`
236
+
237
+ Get the endpoint with the prefix for the namespace.
238
+
239
+ #### Returns
240
+
241
+ `string`
242
+
243
+ The endpoint with namespace prefix attached.
244
+
245
+ #### Inherited from
246
+
247
+ `BaseRestClient.getEndpointWithPrefix`
248
+
249
+ ***
250
+
251
+ ### fetch()
252
+
253
+ > **fetch**\<`T`, `U`\>(`route`, `method`, `request?`): `Promise`\<`U`\>
254
+
255
+ Perform a request in json format.
256
+
257
+ #### Type Parameters
258
+
259
+ ##### T
260
+
261
+ `T` *extends* `IHttpRequest`\<`any`\>
262
+
263
+ ##### U
264
+
265
+ `U` *extends* `IHttpResponse`\<`any`\>
266
+
267
+ #### Parameters
268
+
269
+ ##### route
270
+
271
+ `string`
272
+
273
+ The route of the request.
274
+
275
+ ##### method
276
+
277
+ `HttpMethod`
278
+
279
+ The http method.
280
+
281
+ ##### request?
282
+
283
+ `T`
284
+
285
+ Request to send to the endpoint.
286
+
287
+ #### Returns
288
+
289
+ `Promise`\<`U`\>
290
+
291
+ The response.
292
+
293
+ #### Inherited from
294
+
295
+ `BaseRestClient.fetch`
@@ -22,7 +22,7 @@ Create a new instance of EntityStorageAuthenticationRestClient.
22
22
 
23
23
  ##### config
24
24
 
25
- `IBaseRestClientConfig`
25
+ [`IEntityStorageAuthenticationRestClientConstructorOptions`](../interfaces/IEntityStorageAuthenticationRestClientConstructorOptions.md)
26
26
 
27
27
  The configuration for the client.
28
28
 
@@ -148,18 +148,12 @@ The refreshed token, if it uses a mechanism with public access.
148
148
 
149
149
  ### updatePassword()
150
150
 
151
- > **updatePassword**(`email`, `currentPassword`, `newPassword`): `Promise`\<`void`\>
151
+ > **updatePassword**(`currentPassword`, `newPassword`): `Promise`\<`void`\>
152
152
 
153
153
  Update the user's password.
154
154
 
155
155
  #### Parameters
156
156
 
157
- ##### email
158
-
159
- `string`
160
-
161
- The email address of the user to update.
162
-
163
157
  ##### currentPassword
164
158
 
165
159
  `string`
@@ -181,3 +175,69 @@ Nothing.
181
175
  #### Implementation of
182
176
 
183
177
  `IAuthenticationComponent.updatePassword`
178
+
179
+ ***
180
+
181
+ ### getEndpointWithPrefix()
182
+
183
+ > **getEndpointWithPrefix**(): `string`
184
+
185
+ Get the endpoint with the prefix for the namespace.
186
+
187
+ #### Returns
188
+
189
+ `string`
190
+
191
+ The endpoint with namespace prefix attached.
192
+
193
+ #### Inherited from
194
+
195
+ `BaseRestClient.getEndpointWithPrefix`
196
+
197
+ ***
198
+
199
+ ### fetch()
200
+
201
+ > **fetch**\<`T`, `U`\>(`route`, `method`, `request?`): `Promise`\<`U`\>
202
+
203
+ Perform a request in json format.
204
+
205
+ #### Type Parameters
206
+
207
+ ##### T
208
+
209
+ `T` *extends* `IHttpRequest`\<`any`\>
210
+
211
+ ##### U
212
+
213
+ `U` *extends* `IHttpResponse`\<`any`\>
214
+
215
+ #### Parameters
216
+
217
+ ##### route
218
+
219
+ `string`
220
+
221
+ The route of the request.
222
+
223
+ ##### method
224
+
225
+ `HttpMethod`
226
+
227
+ The http method.
228
+
229
+ ##### request?
230
+
231
+ `T`
232
+
233
+ Request to send to the endpoint.
234
+
235
+ #### Returns
236
+
237
+ `Promise`\<`U`\>
238
+
239
+ The response.
240
+
241
+ #### Inherited from
242
+
243
+ `BaseRestClient.fetch`
@@ -2,4 +2,9 @@
2
2
 
3
3
  ## Classes
4
4
 
5
+ - [EntityStorageAuthenticationAdminRestClient](classes/EntityStorageAuthenticationAdminRestClient.md)
5
6
  - [EntityStorageAuthenticationRestClient](classes/EntityStorageAuthenticationRestClient.md)
7
+
8
+ ## Interfaces
9
+
10
+ - [IEntityStorageAuthenticationRestClientConstructorOptions](interfaces/IEntityStorageAuthenticationRestClientConstructorOptions.md)
@@ -0,0 +1,75 @@
1
+ # Interface: IEntityStorageAuthenticationRestClientConstructorOptions
2
+
3
+ Options for the Entity Storage Authentication REST client constructor.
4
+
5
+ ## Extends
6
+
7
+ - `IBaseRestClientConfig`
8
+
9
+ ## Properties
10
+
11
+ ### cookieName?
12
+
13
+ > `optional` **cookieName**: `string`
14
+
15
+ The name of the cookie to use for storing the auth token.
16
+
17
+ ***
18
+
19
+ ### endpoint
20
+
21
+ > **endpoint**: `string`
22
+
23
+ The endpoint where the api is hosted.
24
+
25
+ #### Inherited from
26
+
27
+ `IBaseRestClientConfig.endpoint`
28
+
29
+ ***
30
+
31
+ ### pathPrefix?
32
+
33
+ > `optional` **pathPrefix**: `string`
34
+
35
+ The prefix to the routes.
36
+
37
+ #### Inherited from
38
+
39
+ `IBaseRestClientConfig.pathPrefix`
40
+
41
+ ***
42
+
43
+ ### headers?
44
+
45
+ > `optional` **headers**: `IHttpHeaders`
46
+
47
+ The headers to include in requests.
48
+
49
+ #### Inherited from
50
+
51
+ `IBaseRestClientConfig.headers`
52
+
53
+ ***
54
+
55
+ ### timeout?
56
+
57
+ > `optional` **timeout**: `number`
58
+
59
+ Timeout for requests in ms.
60
+
61
+ #### Inherited from
62
+
63
+ `IBaseRestClientConfig.timeout`
64
+
65
+ ***
66
+
67
+ ### includeCredentials?
68
+
69
+ > `optional` **includeCredentials**: `boolean`
70
+
71
+ Include credentials in the request, defaults to true.
72
+
73
+ #### Inherited from
74
+
75
+ `IBaseRestClientConfig.includeCredentials`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@twin.org/api-auth-entity-storage-rest-client",
3
- "version": "0.0.3-next.2",
4
- "description": "Perform REST authentication using entity storage.",
3
+ "version": "0.0.3-next.21",
4
+ "description": "REST clients for authentication and admin operations against entity storage endpoints.",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/twinfoundation/api.git",
@@ -14,9 +14,9 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-auth-entity-storage-models": "0.0.3-next.2",
18
- "@twin.org/api-core": "0.0.3-next.2",
19
- "@twin.org/api-models": "0.0.3-next.2",
17
+ "@twin.org/api-auth-entity-storage-models": "0.0.3-next.21",
18
+ "@twin.org/api-core": "0.0.3-next.21",
19
+ "@twin.org/api-models": "0.0.3-next.21",
20
20
  "@twin.org/core": "next",
21
21
  "@twin.org/nameof": "next",
22
22
  "@twin.org/web": "next"