@twin.org/api-auth-entity-storage-models 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 +2 -2
- package/dist/es/index.js +8 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IAuthenticationAdminComponent.js.map +1 -1
- package/dist/es/models/IAuthenticationComponent.js.map +1 -1
- package/dist/es/models/IAuthenticationUser.js +4 -0
- package/dist/es/models/IAuthenticationUser.js.map +1 -0
- package/dist/es/models/api/IAdminUserCreateRequest.js +2 -0
- package/dist/es/models/api/IAdminUserCreateRequest.js.map +1 -0
- package/dist/es/models/api/IAdminUserGetByIdentityRequest.js +4 -0
- package/dist/es/models/api/IAdminUserGetByIdentityRequest.js.map +1 -0
- package/dist/es/models/api/IAdminUserGetRequest.js +4 -0
- package/dist/es/models/api/IAdminUserGetRequest.js.map +1 -0
- package/dist/es/models/api/IAdminUserGetResponse.js +2 -0
- package/dist/es/models/api/IAdminUserGetResponse.js.map +1 -0
- package/dist/es/models/api/IAdminUserRemoveRequest.js +4 -0
- package/dist/es/models/api/IAdminUserRemoveRequest.js.map +1 -0
- package/dist/es/models/api/IAdminUserUpdatePasswordRequest.js +4 -0
- package/dist/es/models/api/IAdminUserUpdatePasswordRequest.js.map +1 -0
- package/dist/es/models/api/IAdminUserUpdateRequest.js +2 -0
- package/dist/es/models/api/IAdminUserUpdateRequest.js.map +1 -0
- package/dist/es/models/api/ILoginResponse.js +0 -2
- package/dist/es/models/api/ILoginResponse.js.map +1 -1
- package/dist/es/models/api/IRefreshTokenResponse.js +0 -2
- package/dist/es/models/api/IRefreshTokenResponse.js.map +1 -1
- package/dist/es/models/api/IUpdatePasswordRequest.js.map +1 -1
- package/dist/types/index.d.ts +8 -0
- package/dist/types/models/IAuthenticationAdminComponent.d.ts +22 -6
- package/dist/types/models/IAuthenticationComponent.d.ts +1 -2
- package/dist/types/models/IAuthenticationUser.d.ts +29 -0
- package/dist/types/models/api/IAdminUserCreateRequest.d.ts +10 -0
- package/dist/types/models/api/IAdminUserGetByIdentityRequest.d.ts +14 -0
- package/dist/types/models/api/IAdminUserGetRequest.d.ts +14 -0
- package/dist/types/models/api/IAdminUserGetResponse.d.ts +10 -0
- package/dist/types/models/api/IAdminUserRemoveRequest.d.ts +14 -0
- package/dist/types/models/api/IAdminUserUpdatePasswordRequest.d.ts +27 -0
- package/dist/types/models/api/IAdminUserUpdateRequest.d.ts +19 -0
- package/dist/types/models/api/ILoginResponse.d.ts +10 -4
- package/dist/types/models/api/IRefreshTokenResponse.d.ts +10 -4
- package/dist/types/models/api/IUpdatePasswordRequest.d.ts +1 -10
- package/docs/changelog.md +155 -1
- package/docs/examples.md +80 -1
- package/docs/reference/index.md +8 -0
- package/docs/reference/interfaces/IAdminUserCreateRequest.md +11 -0
- package/docs/reference/interfaces/IAdminUserGetByIdentityRequest.md +17 -0
- package/docs/reference/interfaces/IAdminUserGetRequest.md +17 -0
- package/docs/reference/interfaces/IAdminUserGetResponse.md +11 -0
- package/docs/reference/interfaces/IAdminUserRemoveRequest.md +17 -0
- package/docs/reference/interfaces/IAdminUserUpdatePasswordRequest.md +37 -0
- package/docs/reference/interfaces/IAdminUserUpdateRequest.md +25 -0
- package/docs/reference/interfaces/IAuthenticationAdminComponent.md +61 -13
- package/docs/reference/interfaces/IAuthenticationComponent.md +1 -7
- package/docs/reference/interfaces/IAuthenticationUser.md +51 -0
- package/docs/reference/interfaces/ILoginResponse.md +14 -6
- package/docs/reference/interfaces/IRefreshTokenResponse.md +14 -6
- package/docs/reference/interfaces/IUpdatePasswordRequest.md +1 -15
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# TWIN Auth Entity Storage Models
|
|
1
|
+
# TWIN API Auth Entity Storage Models
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides contracts for authentication flows and admin user management with entity storage.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
package/dist/es/index.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
// Copyright 2024 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
export * from "./models/api/IAdminUserCreateRequest.js";
|
|
4
|
+
export * from "./models/api/IAdminUserGetRequest.js";
|
|
5
|
+
export * from "./models/api/IAdminUserGetByIdentityRequest.js";
|
|
6
|
+
export * from "./models/api/IAdminUserGetResponse.js";
|
|
7
|
+
export * from "./models/api/IAdminUserRemoveRequest.js";
|
|
8
|
+
export * from "./models/api/IAdminUserUpdatePasswordRequest.js";
|
|
9
|
+
export * from "./models/api/IAdminUserUpdateRequest.js";
|
|
3
10
|
export * from "./models/api/ILoginRequest.js";
|
|
4
11
|
export * from "./models/api/ILoginResponse.js";
|
|
5
12
|
export * from "./models/api/ILogoutRequest.js";
|
|
@@ -8,4 +15,5 @@ export * from "./models/api/IRefreshTokenResponse.js";
|
|
|
8
15
|
export * from "./models/api/IUpdatePasswordRequest.js";
|
|
9
16
|
export * from "./models/IAuthenticationAdminComponent.js";
|
|
10
17
|
export * from "./models/IAuthenticationComponent.js";
|
|
18
|
+
export * from "./models/IAuthenticationUser.js";
|
|
11
19
|
//# sourceMappingURL=index.js.map
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./models/api/ILoginRequest.js\";\nexport * from \"./models/api/ILoginResponse.js\";\nexport * from \"./models/api/ILogoutRequest.js\";\nexport * from \"./models/api/IRefreshTokenRequest.js\";\nexport * from \"./models/api/IRefreshTokenResponse.js\";\nexport * from \"./models/api/IUpdatePasswordRequest.js\";\nexport * from \"./models/IAuthenticationAdminComponent.js\";\nexport * from \"./models/IAuthenticationComponent.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,iDAAiD,CAAC;AAChE,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./models/api/IAdminUserCreateRequest.js\";\nexport * from \"./models/api/IAdminUserGetRequest.js\";\nexport * from \"./models/api/IAdminUserGetByIdentityRequest.js\";\nexport * from \"./models/api/IAdminUserGetResponse.js\";\nexport * from \"./models/api/IAdminUserRemoveRequest.js\";\nexport * from \"./models/api/IAdminUserUpdatePasswordRequest.js\";\nexport * from \"./models/api/IAdminUserUpdateRequest.js\";\nexport * from \"./models/api/ILoginRequest.js\";\nexport * from \"./models/api/ILoginResponse.js\";\nexport * from \"./models/api/ILogoutRequest.js\";\nexport * from \"./models/api/IRefreshTokenRequest.js\";\nexport * from \"./models/api/IRefreshTokenResponse.js\";\nexport * from \"./models/api/IUpdatePasswordRequest.js\";\nexport * from \"./models/IAuthenticationAdminComponent.js\";\nexport * from \"./models/IAuthenticationComponent.js\";\nexport * from \"./models/IAuthenticationUser.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IAuthenticationAdminComponent.js","sourceRoot":"","sources":["../../../src/models/IAuthenticationAdminComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Contract definition for authentication admin component.\n */\nexport interface IAuthenticationAdminComponent extends IComponent {\n\t/**\n\t * Create a login for the user.\n\t * @param
|
|
1
|
+
{"version":3,"file":"IAuthenticationAdminComponent.js","sourceRoot":"","sources":["../../../src/models/IAuthenticationAdminComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IAuthenticationUser } from \"./IAuthenticationUser.js\";\n\n/**\n * Contract definition for authentication admin component.\n */\nexport interface IAuthenticationAdminComponent extends IComponent {\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\tcreate(user: Omit<IAuthenticationUser, \"salt\">): Promise<void>;\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\tupdate(user: Partial<Omit<IAuthenticationUser, \"password\" | \"salt\">>): Promise<void>;\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\tget(email: string): Promise<Omit<IAuthenticationUser, \"password\" | \"salt\">>;\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\tgetByIdentity(identity: string): Promise<Omit<IAuthenticationUser, \"password\" | \"salt\">>;\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\tremove(email: string): Promise<void>;\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\tupdatePassword(email: string, newPassword: string, currentPassword?: string): Promise<void>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IAuthenticationComponent.js","sourceRoot":"","sources":["../../../src/models/IAuthenticationComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Contract definition for authentication component.\n */\nexport interface IAuthenticationComponent extends IComponent {\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\tlogin(\n\t\temail: string,\n\t\tpassword: string\n\t): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\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\tlogout(token?: string): Promise<void>;\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\trefresh(token?: string): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\n\t}>;\n\n\t/**\n\t * Update the user's password.\n\t * @param
|
|
1
|
+
{"version":3,"file":"IAuthenticationComponent.js","sourceRoot":"","sources":["../../../src/models/IAuthenticationComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Contract definition for authentication component.\n */\nexport interface IAuthenticationComponent extends IComponent {\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\tlogin(\n\t\temail: string,\n\t\tpassword: string\n\t): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\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\tlogout(token?: string): Promise<void>;\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\trefresh(token?: string): Promise<{\n\t\ttoken?: string;\n\t\texpiry: number;\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\tupdatePassword(currentPassword: string, newPassword: string): Promise<void>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAuthenticationUser.js","sourceRoot":"","sources":["../../../src/models/IAuthenticationUser.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Contract definition for authentication user.\n */\nexport interface IAuthenticationUser {\n\t/**\n\t * The user e-mail address.\n\t */\n\temail: string;\n\n\t/**\n\t * The encrypted password for the user.\n\t */\n\tpassword: string;\n\n\t/**\n\t * The salt for the password.\n\t */\n\tsalt: string;\n\n\t/**\n\t * The user identity.\n\t */\n\tuserIdentity: string;\n\n\t/**\n\t * The users organization.\n\t */\n\torganizationIdentity: string;\n\n\t/**\n\t * The scope assigned to the user, comma separated.\n\t */\n\tscope: string[];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAdminUserCreateRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAdminUserCreateRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IAuthenticationUser } from \"../IAuthenticationUser.js\";\n\n/**\n * Create a new user as an admin.\n */\nexport interface IAdminUserCreateRequest {\n\t/**\n\t * The body of the request.\n\t */\n\tbody: Omit<IAuthenticationUser, \"salt\">;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAdminUserGetByIdentityRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAdminUserGetByIdentityRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Get a user as an admin.\n */\nexport interface IAdminUserGetByIdentityRequest {\n\t/**\n\t * The path parameters for the request.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The user identity.\n\t\t */\n\t\tidentity: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAdminUserGetRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAdminUserGetRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Get a user as an admin.\n */\nexport interface IAdminUserGetRequest {\n\t/**\n\t * The path parameters for the request.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The user email.\n\t\t */\n\t\temail: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAdminUserGetResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IAdminUserGetResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IAuthenticationUser } from \"../IAuthenticationUser.js\";\n\n/**\n * Get a user as an admin.\n */\nexport interface IAdminUserGetResponse {\n\t/**\n\t * The body of the request.\n\t */\n\tbody: Omit<IAuthenticationUser, \"password\" | \"salt\">;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAdminUserRemoveRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAdminUserRemoveRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Remove a user as an admin.\n */\nexport interface IAdminUserRemoveRequest {\n\t/**\n\t * The path parameters for the request.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The user email.\n\t\t */\n\t\temail: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAdminUserUpdatePasswordRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAdminUserUpdatePasswordRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Update a users password as an admin.\n */\nexport interface IAdminUserUpdatePasswordRequest {\n\t/**\n\t * The path parameters for the request.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The user email.\n\t\t */\n\t\temail: string;\n\t};\n\n\t/**\n\t * The body of the request.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The new password for the user.\n\t\t */\n\t\tnewPassword: string;\n\n\t\t/**\n\t\t * The current password for the user.\n\t\t */\n\t\tcurrentPassword?: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAdminUserUpdateRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAdminUserUpdateRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IAuthenticationUser } from \"../IAuthenticationUser.js\";\n\n/**\n * Update a user as an admin.\n */\nexport interface IAdminUserUpdateRequest {\n\t/**\n\t * The path parameters for the request.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The user email.\n\t\t */\n\t\temail: string;\n\t};\n\n\t/**\n\t * The body of the request.\n\t */\n\tbody: Partial<Omit<IAuthenticationUser, \"email\" | \"password\" | \"salt\">>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILoginResponse.js","sourceRoot":"","sources":["../../../../src/models/api/ILoginResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ILoginResponse.js","sourceRoot":"","sources":["../../../../src/models/api/ILoginResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes } from \"@twin.org/web\";\n\n/**\n * Response from a login on the server.\n */\nexport interface ILoginResponse {\n\t/**\n\t * Response headers.\n\t */\n\theaders?: {\n\t\t/**\n\t\t * The cookie containing the auth token.\n\t\t */\n\t\t[HeaderTypes.SetCookie]?: string;\n\t};\n\n\t/**\n\t * The login response details.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The expiry time of the token.\n\t\t */\n\t\texpiry: number;\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRefreshTokenResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IRefreshTokenResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IRefreshTokenResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IRefreshTokenResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes } from \"@twin.org/web\";\n\n/**\n * Response from a refresh on the auth token.\n */\nexport interface IRefreshTokenResponse {\n\t/**\n\t * Response headers.\n\t */\n\theaders?: {\n\t\t/**\n\t\t * The cookie containing the auth token.\n\t\t */\n\t\t[HeaderTypes.SetCookie]?: string;\n\t};\n\n\t/**\n\t * The refresh token details.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The expiry time of the token.\n\t\t */\n\t\texpiry: number;\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IUpdatePasswordRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IUpdatePasswordRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Update
|
|
1
|
+
{"version":3,"file":"IUpdatePasswordRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IUpdatePasswordRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Update the current user's password.\n */\nexport interface IUpdatePasswordRequest {\n\t/**\n\t * The body of the request.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The current password for the user.\n\t\t */\n\t\tcurrentPassword: string;\n\n\t\t/**\n\t\t * The new password for the user.\n\t\t */\n\t\tnewPassword: string;\n\t};\n}\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export * from "./models/api/IAdminUserCreateRequest.js";
|
|
2
|
+
export * from "./models/api/IAdminUserGetRequest.js";
|
|
3
|
+
export * from "./models/api/IAdminUserGetByIdentityRequest.js";
|
|
4
|
+
export * from "./models/api/IAdminUserGetResponse.js";
|
|
5
|
+
export * from "./models/api/IAdminUserRemoveRequest.js";
|
|
6
|
+
export * from "./models/api/IAdminUserUpdatePasswordRequest.js";
|
|
7
|
+
export * from "./models/api/IAdminUserUpdateRequest.js";
|
|
1
8
|
export * from "./models/api/ILoginRequest.js";
|
|
2
9
|
export * from "./models/api/ILoginResponse.js";
|
|
3
10
|
export * from "./models/api/ILogoutRequest.js";
|
|
@@ -6,3 +13,4 @@ export * from "./models/api/IRefreshTokenResponse.js";
|
|
|
6
13
|
export * from "./models/api/IUpdatePasswordRequest.js";
|
|
7
14
|
export * from "./models/IAuthenticationAdminComponent.js";
|
|
8
15
|
export * from "./models/IAuthenticationComponent.js";
|
|
16
|
+
export * from "./models/IAuthenticationUser.js";
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
|
+
import type { IAuthenticationUser } from "./IAuthenticationUser.js";
|
|
2
3
|
/**
|
|
3
4
|
* Contract definition for authentication admin component.
|
|
4
5
|
*/
|
|
5
6
|
export interface IAuthenticationAdminComponent extends IComponent {
|
|
6
7
|
/**
|
|
7
8
|
* Create a login for the user.
|
|
8
|
-
* @param
|
|
9
|
-
* @param password The password for the user.
|
|
10
|
-
* @param userIdentity The DID to associate with the account.
|
|
11
|
-
* @param organizationIdentity The organization of the user.
|
|
9
|
+
* @param user The user to create.
|
|
12
10
|
* @returns Nothing.
|
|
13
11
|
*/
|
|
14
|
-
create(
|
|
12
|
+
create(user: Omit<IAuthenticationUser, "salt">): Promise<void>;
|
|
15
13
|
/**
|
|
16
|
-
*
|
|
14
|
+
* Update a login for the user.
|
|
15
|
+
* @param user The user to update.
|
|
16
|
+
* @returns Nothing.
|
|
17
|
+
*/
|
|
18
|
+
update(user: Partial<Omit<IAuthenticationUser, "password" | "salt">>): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Get a user by email.
|
|
21
|
+
* @param email The email address of the user to get.
|
|
22
|
+
* @returns The user details.
|
|
23
|
+
*/
|
|
24
|
+
get(email: string): Promise<Omit<IAuthenticationUser, "password" | "salt">>;
|
|
25
|
+
/**
|
|
26
|
+
* Get a user by identity.
|
|
27
|
+
* @param identity The identity of the user to get.
|
|
28
|
+
* @returns The user details.
|
|
29
|
+
*/
|
|
30
|
+
getByIdentity(identity: string): Promise<Omit<IAuthenticationUser, "password" | "salt">>;
|
|
31
|
+
/**
|
|
32
|
+
* Remove a user.
|
|
17
33
|
* @param email The email address of the user to remove.
|
|
18
34
|
* @returns Nothing.
|
|
19
35
|
*/
|
|
@@ -30,10 +30,9 @@ export interface IAuthenticationComponent extends IComponent {
|
|
|
30
30
|
}>;
|
|
31
31
|
/**
|
|
32
32
|
* Update the user's password.
|
|
33
|
-
* @param email The email address of the user to update.
|
|
34
33
|
* @param currentPassword The current password for the user.
|
|
35
34
|
* @param newPassword The new password for the user.
|
|
36
35
|
* @returns Nothing.
|
|
37
36
|
*/
|
|
38
|
-
updatePassword(
|
|
37
|
+
updatePassword(currentPassword: string, newPassword: string): Promise<void>;
|
|
39
38
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract definition for authentication user.
|
|
3
|
+
*/
|
|
4
|
+
export interface IAuthenticationUser {
|
|
5
|
+
/**
|
|
6
|
+
* The user e-mail address.
|
|
7
|
+
*/
|
|
8
|
+
email: string;
|
|
9
|
+
/**
|
|
10
|
+
* The encrypted password for the user.
|
|
11
|
+
*/
|
|
12
|
+
password: string;
|
|
13
|
+
/**
|
|
14
|
+
* The salt for the password.
|
|
15
|
+
*/
|
|
16
|
+
salt: string;
|
|
17
|
+
/**
|
|
18
|
+
* The user identity.
|
|
19
|
+
*/
|
|
20
|
+
userIdentity: string;
|
|
21
|
+
/**
|
|
22
|
+
* The users organization.
|
|
23
|
+
*/
|
|
24
|
+
organizationIdentity: string;
|
|
25
|
+
/**
|
|
26
|
+
* The scope assigned to the user, comma separated.
|
|
27
|
+
*/
|
|
28
|
+
scope: string[];
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a users password as an admin.
|
|
3
|
+
*/
|
|
4
|
+
export interface IAdminUserUpdatePasswordRequest {
|
|
5
|
+
/**
|
|
6
|
+
* The path parameters for the request.
|
|
7
|
+
*/
|
|
8
|
+
pathParams: {
|
|
9
|
+
/**
|
|
10
|
+
* The user email.
|
|
11
|
+
*/
|
|
12
|
+
email: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The body of the request.
|
|
16
|
+
*/
|
|
17
|
+
body: {
|
|
18
|
+
/**
|
|
19
|
+
* The new password for the user.
|
|
20
|
+
*/
|
|
21
|
+
newPassword: string;
|
|
22
|
+
/**
|
|
23
|
+
* The current password for the user.
|
|
24
|
+
*/
|
|
25
|
+
currentPassword?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IAuthenticationUser } from "../IAuthenticationUser.js";
|
|
2
|
+
/**
|
|
3
|
+
* Update a user as an admin.
|
|
4
|
+
*/
|
|
5
|
+
export interface IAdminUserUpdateRequest {
|
|
6
|
+
/**
|
|
7
|
+
* The path parameters for the request.
|
|
8
|
+
*/
|
|
9
|
+
pathParams: {
|
|
10
|
+
/**
|
|
11
|
+
* The user email.
|
|
12
|
+
*/
|
|
13
|
+
email: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The body of the request.
|
|
17
|
+
*/
|
|
18
|
+
body: Partial<Omit<IAuthenticationUser, "email" | "password" | "salt">>;
|
|
19
|
+
}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
import type { HeaderTypes } from "@twin.org/web";
|
|
1
2
|
/**
|
|
2
3
|
* Response from a login on the server.
|
|
3
4
|
*/
|
|
4
5
|
export interface ILoginResponse {
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* Response headers.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
headers?: {
|
|
9
10
|
/**
|
|
10
|
-
* The
|
|
11
|
+
* The cookie containing the auth token.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
[HeaderTypes.SetCookie]?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The login response details.
|
|
17
|
+
*/
|
|
18
|
+
body: {
|
|
13
19
|
/**
|
|
14
20
|
* The expiry time of the token.
|
|
15
21
|
*/
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
import type { HeaderTypes } from "@twin.org/web";
|
|
1
2
|
/**
|
|
2
3
|
* Response from a refresh on the auth token.
|
|
3
4
|
*/
|
|
4
5
|
export interface IRefreshTokenResponse {
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* Response headers.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
headers?: {
|
|
9
10
|
/**
|
|
10
|
-
* The
|
|
11
|
+
* The cookie containing the auth token.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
[HeaderTypes.SetCookie]?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The refresh token details.
|
|
17
|
+
*/
|
|
18
|
+
body: {
|
|
13
19
|
/**
|
|
14
20
|
* The expiry time of the token.
|
|
15
21
|
*/
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Update
|
|
2
|
+
* Update the current user's password.
|
|
3
3
|
*/
|
|
4
4
|
export interface IUpdatePasswordRequest {
|
|
5
|
-
/**
|
|
6
|
-
* The path parameters for the request.
|
|
7
|
-
*/
|
|
8
|
-
pathParams: {
|
|
9
|
-
/**
|
|
10
|
-
* The user email.
|
|
11
|
-
*/
|
|
12
|
-
email: string;
|
|
13
|
-
};
|
|
14
5
|
/**
|
|
15
6
|
* The body of the request.
|
|
16
7
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,158 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.21](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.20...api-auth-entity-storage-models-v0.0.3-next.21) (2026-03-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
## [0.0.3-next.20](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.19...api-auth-entity-storage-models-v0.0.3-next.20) (2026-02-09)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Miscellaneous Chores
|
|
14
|
+
|
|
15
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.19](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.18...api-auth-entity-storage-models-v0.0.3-next.19) (2026-02-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* user admin service ([#77](https://github.com/twinfoundation/api/issues/77)) ([c8491df](https://github.com/twinfoundation/api/commit/c8491df7b07c1f45560c8a78c6adc806d0ececbb))
|
|
23
|
+
|
|
24
|
+
## [0.0.3-next.18](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.17...api-auth-entity-storage-models-v0.0.3-next.18) (2026-02-04)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* tenant api and scopes ([#75](https://github.com/twinfoundation/api/issues/75)) ([c663141](https://github.com/twinfoundation/api/commit/c663141091e8974d769f8f9904ecdab009ebd083))
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.17](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.16...api-auth-entity-storage-models-v0.0.3-next.17) (2026-01-26)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
## [0.0.3-next.16](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.15...api-auth-entity-storage-models-v0.0.3-next.16) (2026-01-26)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Miscellaneous Chores
|
|
42
|
+
|
|
43
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
44
|
+
|
|
45
|
+
## [0.0.3-next.15](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.14...api-auth-entity-storage-models-v0.0.3-next.15) (2026-01-22)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Miscellaneous Chores
|
|
49
|
+
|
|
50
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
51
|
+
|
|
52
|
+
## [0.0.3-next.14](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.13...api-auth-entity-storage-models-v0.0.3-next.14) (2026-01-20)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Miscellaneous Chores
|
|
56
|
+
|
|
57
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
58
|
+
|
|
59
|
+
## [0.0.3-next.13](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.12...api-auth-entity-storage-models-v0.0.3-next.13) (2026-01-19)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
65
|
+
|
|
66
|
+
## [0.0.3-next.12](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.11...api-auth-entity-storage-models-v0.0.3-next.12) (2026-01-12)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Miscellaneous Chores
|
|
70
|
+
|
|
71
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
72
|
+
|
|
73
|
+
## [0.0.3-next.11](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.10...api-auth-entity-storage-models-v0.0.3-next.11) (2026-01-08)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Miscellaneous Chores
|
|
77
|
+
|
|
78
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
79
|
+
|
|
80
|
+
## [0.0.3-next.10](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.9...api-auth-entity-storage-models-v0.0.3-next.10) (2026-01-05)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Miscellaneous Chores
|
|
84
|
+
|
|
85
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
86
|
+
|
|
87
|
+
## [0.0.3-next.9](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.8...api-auth-entity-storage-models-v0.0.3-next.9) (2026-01-05)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Features
|
|
91
|
+
|
|
92
|
+
* add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
|
|
93
|
+
* add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
|
|
94
|
+
* add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
|
|
95
|
+
* eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
|
|
96
|
+
* improve description ([d28185c](https://github.com/twinfoundation/api/commit/d28185c799a97455fee72fb23c744c8e71325f0b))
|
|
97
|
+
* improve socket route logging ([b8d9519](https://github.com/twinfoundation/api/commit/b8d95199f838ac6ba9f45c30ef7c4e613201ff53))
|
|
98
|
+
* modify authHeaderProcessor to retain token in response body ([#53](https://github.com/twinfoundation/api/issues/53)) ([5d9ae76](https://github.com/twinfoundation/api/commit/5d9ae76b5b52a8e10dac391b2d5784638a186583))
|
|
99
|
+
* remove unused namespace ([08478f2](https://github.com/twinfoundation/api/commit/08478f27efda9beb0271fdb22f6972e918361965))
|
|
100
|
+
* update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
|
|
101
|
+
* update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
|
|
102
|
+
* update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
|
|
103
|
+
* use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
|
|
104
|
+
|
|
105
|
+
## [0.0.3-next.8](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.7...api-auth-entity-storage-models-v0.0.3-next.8) (2025-12-17)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### Miscellaneous Chores
|
|
109
|
+
|
|
110
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
111
|
+
|
|
112
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.6...api-auth-entity-storage-models-v0.0.3-next.7) (2025-11-26)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
### Miscellaneous Chores
|
|
116
|
+
|
|
117
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
118
|
+
|
|
119
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.5...api-auth-entity-storage-models-v0.0.3-next.6) (2025-11-20)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Miscellaneous Chores
|
|
123
|
+
|
|
124
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
125
|
+
|
|
126
|
+
## [0.0.3-next.5](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.4...api-auth-entity-storage-models-v0.0.3-next.5) (2025-11-14)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Miscellaneous Chores
|
|
130
|
+
|
|
131
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
132
|
+
|
|
133
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.3...api-auth-entity-storage-models-v0.0.3-next.4) (2025-11-14)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### Features
|
|
137
|
+
|
|
138
|
+
* add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
|
|
139
|
+
* add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
|
|
140
|
+
* add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
|
|
141
|
+
* eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
|
|
142
|
+
* improve description ([d28185c](https://github.com/twinfoundation/api/commit/d28185c799a97455fee72fb23c744c8e71325f0b))
|
|
143
|
+
* improve socket route logging ([b8d9519](https://github.com/twinfoundation/api/commit/b8d95199f838ac6ba9f45c30ef7c4e613201ff53))
|
|
144
|
+
* remove unused namespace ([08478f2](https://github.com/twinfoundation/api/commit/08478f27efda9beb0271fdb22f6972e918361965))
|
|
145
|
+
* update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
|
|
146
|
+
* update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
|
|
147
|
+
* update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
|
|
148
|
+
* use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
|
|
149
|
+
|
|
150
|
+
## [0.0.3-next.3](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.2...api-auth-entity-storage-models-v0.0.3-next.3) (2025-11-14)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
### Miscellaneous Chores
|
|
154
|
+
|
|
155
|
+
* **api-auth-entity-storage-models:** Synchronize repo versions
|
|
2
156
|
|
|
3
157
|
## [0.0.3-next.2](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.1...api-auth-entity-storage-models-v0.0.3-next.2) (2025-11-12)
|
|
4
158
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,80 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Auth Entity Storage Models Examples
|
|
2
|
+
|
|
3
|
+
Use these snippets to shape request and response data consistently across sign-in flows, admin operations, and token refresh handling.
|
|
4
|
+
|
|
5
|
+
## Authentication Requests
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import type {
|
|
9
|
+
ILoginRequest,
|
|
10
|
+
IRefreshTokenRequest,
|
|
11
|
+
IUpdatePasswordRequest
|
|
12
|
+
} from '@twin.org/api-auth-entity-storage-models';
|
|
13
|
+
|
|
14
|
+
const loginRequest: ILoginRequest = {
|
|
15
|
+
body: {
|
|
16
|
+
email: 'alice@example.org',
|
|
17
|
+
password: 'correct-horse-battery-staple'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const refreshRequest: IRefreshTokenRequest = {
|
|
22
|
+
query: {
|
|
23
|
+
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.refresh'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const updatePasswordRequest: IUpdatePasswordRequest = {
|
|
28
|
+
body: {
|
|
29
|
+
currentPassword: 'old-password',
|
|
30
|
+
newPassword: 'new-password-2026'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
console.log(loginRequest.body.email); // alice@example.org
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Admin User Models
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import type {
|
|
41
|
+
IAdminUserCreateRequest,
|
|
42
|
+
IAdminUserUpdateRequest
|
|
43
|
+
} from '@twin.org/api-auth-entity-storage-models';
|
|
44
|
+
|
|
45
|
+
const createRequest: IAdminUserCreateRequest = {
|
|
46
|
+
body: {
|
|
47
|
+
email: 'bob@example.org',
|
|
48
|
+
password: 'initial-password',
|
|
49
|
+
userIdentity: 'did:example:bob',
|
|
50
|
+
organizationIdentity: 'did:example:org',
|
|
51
|
+
scope: ['admin', 'auditor']
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const updateRequest: IAdminUserUpdateRequest = {
|
|
56
|
+
pathParams: {
|
|
57
|
+
email: 'bob@example.org'
|
|
58
|
+
},
|
|
59
|
+
body: {
|
|
60
|
+
userIdentity: 'did:example:bob:ops',
|
|
61
|
+
scope: ['admin']
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
console.log(createRequest.body.scope.length); // 2
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Authentication Responses
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import type { ILoginResponse } from '@twin.org/api-auth-entity-storage-models';
|
|
72
|
+
|
|
73
|
+
const loginResponse: ILoginResponse = {
|
|
74
|
+
body: {
|
|
75
|
+
expiry: 3600
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
console.log(loginResponse.body.expiry); // 3600
|
|
80
|
+
```
|
package/docs/reference/index.md
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
- [IAuthenticationAdminComponent](interfaces/IAuthenticationAdminComponent.md)
|
|
6
6
|
- [IAuthenticationComponent](interfaces/IAuthenticationComponent.md)
|
|
7
|
+
- [IAuthenticationUser](interfaces/IAuthenticationUser.md)
|
|
8
|
+
- [IAdminUserCreateRequest](interfaces/IAdminUserCreateRequest.md)
|
|
9
|
+
- [IAdminUserGetByIdentityRequest](interfaces/IAdminUserGetByIdentityRequest.md)
|
|
10
|
+
- [IAdminUserGetRequest](interfaces/IAdminUserGetRequest.md)
|
|
11
|
+
- [IAdminUserGetResponse](interfaces/IAdminUserGetResponse.md)
|
|
12
|
+
- [IAdminUserRemoveRequest](interfaces/IAdminUserRemoveRequest.md)
|
|
13
|
+
- [IAdminUserUpdatePasswordRequest](interfaces/IAdminUserUpdatePasswordRequest.md)
|
|
14
|
+
- [IAdminUserUpdateRequest](interfaces/IAdminUserUpdateRequest.md)
|
|
7
15
|
- [ILoginRequest](interfaces/ILoginRequest.md)
|
|
8
16
|
- [ILoginResponse](interfaces/ILoginResponse.md)
|
|
9
17
|
- [ILogoutRequest](interfaces/ILogoutRequest.md)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: IAdminUserGetByIdentityRequest
|
|
2
|
+
|
|
3
|
+
Get a user as an admin.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### pathParams
|
|
8
|
+
|
|
9
|
+
> **pathParams**: `object`
|
|
10
|
+
|
|
11
|
+
The path parameters for the request.
|
|
12
|
+
|
|
13
|
+
#### identity
|
|
14
|
+
|
|
15
|
+
> **identity**: `string`
|
|
16
|
+
|
|
17
|
+
The user identity.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Interface: IAdminUserUpdatePasswordRequest
|
|
2
|
+
|
|
3
|
+
Update a users password as an admin.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### pathParams
|
|
8
|
+
|
|
9
|
+
> **pathParams**: `object`
|
|
10
|
+
|
|
11
|
+
The path parameters for the request.
|
|
12
|
+
|
|
13
|
+
#### email
|
|
14
|
+
|
|
15
|
+
> **email**: `string`
|
|
16
|
+
|
|
17
|
+
The user email.
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### body
|
|
22
|
+
|
|
23
|
+
> **body**: `object`
|
|
24
|
+
|
|
25
|
+
The body of the request.
|
|
26
|
+
|
|
27
|
+
#### newPassword
|
|
28
|
+
|
|
29
|
+
> **newPassword**: `string`
|
|
30
|
+
|
|
31
|
+
The new password for the user.
|
|
32
|
+
|
|
33
|
+
#### currentPassword?
|
|
34
|
+
|
|
35
|
+
> `optional` **currentPassword**: `string`
|
|
36
|
+
|
|
37
|
+
The current password for the user.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: IAdminUserUpdateRequest
|
|
2
|
+
|
|
3
|
+
Update a user as an admin.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### pathParams
|
|
8
|
+
|
|
9
|
+
> **pathParams**: `object`
|
|
10
|
+
|
|
11
|
+
The path parameters for the request.
|
|
12
|
+
|
|
13
|
+
#### email
|
|
14
|
+
|
|
15
|
+
> **email**: `string`
|
|
16
|
+
|
|
17
|
+
The user email.
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### body
|
|
22
|
+
|
|
23
|
+
> **body**: `Partial`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"email"` \| `"password"` \| `"salt"`\>\>
|
|
24
|
+
|
|
25
|
+
The body of the request.
|
|
@@ -10,41 +10,89 @@ Contract definition for authentication admin component.
|
|
|
10
10
|
|
|
11
11
|
### create()
|
|
12
12
|
|
|
13
|
-
> **create**(`
|
|
13
|
+
> **create**(`user`): `Promise`\<`void`\>
|
|
14
14
|
|
|
15
15
|
Create a login for the user.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
+
##### user
|
|
20
|
+
|
|
21
|
+
`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"salt"`\>
|
|
22
|
+
|
|
23
|
+
The user to create.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`Promise`\<`void`\>
|
|
28
|
+
|
|
29
|
+
Nothing.
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
### update()
|
|
34
|
+
|
|
35
|
+
> **update**(`user`): `Promise`\<`void`\>
|
|
36
|
+
|
|
37
|
+
Update a login for the user.
|
|
38
|
+
|
|
39
|
+
#### Parameters
|
|
40
|
+
|
|
41
|
+
##### user
|
|
42
|
+
|
|
43
|
+
`Partial`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"password"` \| `"salt"`\>\>
|
|
44
|
+
|
|
45
|
+
The user to update.
|
|
46
|
+
|
|
47
|
+
#### Returns
|
|
48
|
+
|
|
49
|
+
`Promise`\<`void`\>
|
|
50
|
+
|
|
51
|
+
Nothing.
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### get()
|
|
56
|
+
|
|
57
|
+
> **get**(`email`): `Promise`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"salt"` \| `"password"`\>\>
|
|
58
|
+
|
|
59
|
+
Get a user by email.
|
|
60
|
+
|
|
61
|
+
#### Parameters
|
|
62
|
+
|
|
19
63
|
##### email
|
|
20
64
|
|
|
21
65
|
`string`
|
|
22
66
|
|
|
23
|
-
The email address
|
|
67
|
+
The email address of the user to get.
|
|
24
68
|
|
|
25
|
-
|
|
69
|
+
#### Returns
|
|
26
70
|
|
|
27
|
-
`
|
|
71
|
+
`Promise`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"salt"` \| `"password"`\>\>
|
|
28
72
|
|
|
29
|
-
The
|
|
73
|
+
The user details.
|
|
30
74
|
|
|
31
|
-
|
|
75
|
+
***
|
|
32
76
|
|
|
33
|
-
|
|
77
|
+
### getByIdentity()
|
|
34
78
|
|
|
35
|
-
|
|
79
|
+
> **getByIdentity**(`identity`): `Promise`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"salt"` \| `"password"`\>\>
|
|
36
80
|
|
|
37
|
-
|
|
81
|
+
Get a user by identity.
|
|
82
|
+
|
|
83
|
+
#### Parameters
|
|
84
|
+
|
|
85
|
+
##### identity
|
|
38
86
|
|
|
39
87
|
`string`
|
|
40
88
|
|
|
41
|
-
The
|
|
89
|
+
The identity of the user to get.
|
|
42
90
|
|
|
43
91
|
#### Returns
|
|
44
92
|
|
|
45
|
-
`Promise`\<`
|
|
93
|
+
`Promise`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"salt"` \| `"password"`\>\>
|
|
46
94
|
|
|
47
|
-
|
|
95
|
+
The user details.
|
|
48
96
|
|
|
49
97
|
***
|
|
50
98
|
|
|
@@ -52,7 +100,7 @@ Nothing.
|
|
|
52
100
|
|
|
53
101
|
> **remove**(`email`): `Promise`\<`void`\>
|
|
54
102
|
|
|
55
|
-
Remove
|
|
103
|
+
Remove a user.
|
|
56
104
|
|
|
57
105
|
#### Parameters
|
|
58
106
|
|
|
@@ -82,18 +82,12 @@ The refreshed token, if it uses a mechanism with public access.
|
|
|
82
82
|
|
|
83
83
|
### updatePassword()
|
|
84
84
|
|
|
85
|
-
> **updatePassword**(`
|
|
85
|
+
> **updatePassword**(`currentPassword`, `newPassword`): `Promise`\<`void`\>
|
|
86
86
|
|
|
87
87
|
Update the user's password.
|
|
88
88
|
|
|
89
89
|
#### Parameters
|
|
90
90
|
|
|
91
|
-
##### email
|
|
92
|
-
|
|
93
|
-
`string`
|
|
94
|
-
|
|
95
|
-
The email address of the user to update.
|
|
96
|
-
|
|
97
91
|
##### currentPassword
|
|
98
92
|
|
|
99
93
|
`string`
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Interface: IAuthenticationUser
|
|
2
|
+
|
|
3
|
+
Contract definition for authentication user.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### email
|
|
8
|
+
|
|
9
|
+
> **email**: `string`
|
|
10
|
+
|
|
11
|
+
The user e-mail address.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### password
|
|
16
|
+
|
|
17
|
+
> **password**: `string`
|
|
18
|
+
|
|
19
|
+
The encrypted password for the user.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### salt
|
|
24
|
+
|
|
25
|
+
> **salt**: `string`
|
|
26
|
+
|
|
27
|
+
The salt for the password.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### userIdentity
|
|
32
|
+
|
|
33
|
+
> **userIdentity**: `string`
|
|
34
|
+
|
|
35
|
+
The user identity.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### organizationIdentity
|
|
40
|
+
|
|
41
|
+
> **organizationIdentity**: `string`
|
|
42
|
+
|
|
43
|
+
The users organization.
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### scope
|
|
48
|
+
|
|
49
|
+
> **scope**: `string`[]
|
|
50
|
+
|
|
51
|
+
The scope assigned to the user, comma separated.
|
|
@@ -4,17 +4,25 @@ Response from a login on the server.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### headers?
|
|
8
8
|
|
|
9
|
-
> **
|
|
9
|
+
> `optional` **headers**: `object`
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Response headers.
|
|
12
|
+
|
|
13
|
+
#### set-cookie?
|
|
14
|
+
|
|
15
|
+
> `optional` **set-cookie**: `string`
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
The cookie containing the auth token.
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
***
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### body
|
|
22
|
+
|
|
23
|
+
> **body**: `object`
|
|
24
|
+
|
|
25
|
+
The login response details.
|
|
18
26
|
|
|
19
27
|
#### expiry
|
|
20
28
|
|
|
@@ -4,17 +4,25 @@ Response from a refresh on the auth token.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### headers?
|
|
8
8
|
|
|
9
|
-
> **
|
|
9
|
+
> `optional` **headers**: `object`
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Response headers.
|
|
12
|
+
|
|
13
|
+
#### set-cookie?
|
|
14
|
+
|
|
15
|
+
> `optional` **set-cookie**: `string`
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
The cookie containing the auth token.
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
***
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### body
|
|
22
|
+
|
|
23
|
+
> **body**: `object`
|
|
24
|
+
|
|
25
|
+
The refresh token details.
|
|
18
26
|
|
|
19
27
|
#### expiry
|
|
20
28
|
|
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
# Interface: IUpdatePasswordRequest
|
|
2
2
|
|
|
3
|
-
Update
|
|
3
|
+
Update the current user's password.
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### pathParams
|
|
8
|
-
|
|
9
|
-
> **pathParams**: `object`
|
|
10
|
-
|
|
11
|
-
The path parameters for the request.
|
|
12
|
-
|
|
13
|
-
#### email
|
|
14
|
-
|
|
15
|
-
> **email**: `string`
|
|
16
|
-
|
|
17
|
-
The user email.
|
|
18
|
-
|
|
19
|
-
***
|
|
20
|
-
|
|
21
7
|
### body
|
|
22
8
|
|
|
23
9
|
> **body**: `object`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/api-auth-entity-storage-models",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.21",
|
|
4
|
+
"description": "Contracts for authentication flows and admin user management with entity storage.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/api.git",
|