@twin.org/api-auth-entity-storage-models 0.0.1-next.9 → 0.0.2-next.1

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.
@@ -3,4 +3,6 @@ export * from "./models/api/ILoginResponse";
3
3
  export * from "./models/api/ILogoutRequest";
4
4
  export * from "./models/api/IRefreshTokenRequest";
5
5
  export * from "./models/api/IRefreshTokenResponse";
6
+ export * from "./models/api/IUpdatePasswordRequest";
7
+ export * from "./models/IAuthenticationAdminComponent";
6
8
  export * from "./models/IAuthenticationComponent";
@@ -0,0 +1,28 @@
1
+ import type { IComponent } from "@twin.org/core";
2
+ /**
3
+ * Contract definition for authentication admin component.
4
+ */
5
+ export interface IAuthenticationAdminComponent extends IComponent {
6
+ /**
7
+ * Create a login for the user.
8
+ * @param email The email address for the user.
9
+ * @param password The password for the user.
10
+ * @param identity The DID to associate with the account.
11
+ * @returns Nothing.
12
+ */
13
+ create(email: string, password: string, identity: string): Promise<void>;
14
+ /**
15
+ * Remove the current user.
16
+ * @param email The email address of the user to remove.
17
+ * @returns Nothing.
18
+ */
19
+ remove(email: string): Promise<void>;
20
+ /**
21
+ * Update the user's password.
22
+ * @param email The email address of the user to update.
23
+ * @param newPassword The new password for the user.
24
+ * @param currentPassword The current password, optional, if supplied will check against existing.
25
+ * @returns Nothing.
26
+ */
27
+ updatePassword(email: string, newPassword: string, currentPassword?: string): Promise<void>;
28
+ }
@@ -28,4 +28,12 @@ export interface IAuthenticationComponent extends IComponent {
28
28
  token?: string;
29
29
  expiry: number;
30
30
  }>;
31
+ /**
32
+ * Update the user's password.
33
+ * @param email The email address of the user to update.
34
+ * @param currentPassword The current password for the user.
35
+ * @param newPassword The new password for the user.
36
+ * @returns Nothing.
37
+ */
38
+ updatePassword(email: string, currentPassword: string, newPassword: string): Promise<void>;
31
39
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Perform a refresh on the auth token.
2
+ * Perform a refresh of the auth token.
3
3
  */
4
4
  export interface IRefreshTokenRequest {
5
5
  /**
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Update a users password.
3
+ */
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
+ /**
15
+ * The body of the request.
16
+ */
17
+ body: {
18
+ /**
19
+ * The current password for the user.
20
+ */
21
+ currentPassword: string;
22
+ /**
23
+ * The new password for the user.
24
+ */
25
+ newPassword: string;
26
+ };
27
+ }
package/docs/changelog.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # @twin.org/api-auth-entity-storage-models - Changelog
2
2
 
3
- ## v0.0.1-next.9
3
+ ## [0.0.2-next.1](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.2-next.0...api-auth-entity-storage-models-v0.0.2-next.1) (2025-07-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
9
+ * improve description ([d28185c](https://github.com/twinfoundation/api/commit/d28185c799a97455fee72fb23c744c8e71325f0b))
10
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
11
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
12
+
13
+ ## 0.0.1 (2025-07-03)
14
+
15
+
16
+ ### Features
17
+
18
+ * release to production ([70ee2d5](https://github.com/twinfoundation/api/commit/70ee2d56a1dc9537d7c9c154d4cb78a235678a3a))
19
+
20
+ ## [0.0.1-next.36](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.1-next.35...api-auth-entity-storage-models-v0.0.1-next.36) (2025-06-17)
21
+
22
+
23
+ ### Miscellaneous Chores
24
+
25
+ * **api-auth-entity-storage-models:** Synchronize repo versions
26
+
27
+ ## [0.0.1-next.35](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.1-next.34...api-auth-entity-storage-models-v0.0.1-next.35) (2025-06-11)
28
+
29
+
30
+ ### Features
31
+
32
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
33
+
34
+ ## [0.0.1-next.34](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.1-next.33...api-auth-entity-storage-models-v0.0.1-next.34) (2025-05-27)
35
+
36
+
37
+ ### Miscellaneous Chores
38
+
39
+ * **api-auth-entity-storage-models:** Synchronize repo versions
40
+
41
+ ## [0.0.1-next.33](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.1-next.32...api-auth-entity-storage-models-v0.0.1-next.33) (2025-04-17)
42
+
43
+
44
+ ### Features
45
+
46
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
47
+
48
+ ## [0.0.1-next.32](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.1-next.31...api-auth-entity-storage-models-v0.0.1-next.32) (2025-03-28)
49
+
50
+
51
+ ### Features
52
+
53
+ * improve description ([d28185c](https://github.com/twinfoundation/api/commit/d28185c799a97455fee72fb23c744c8e71325f0b))
54
+
55
+ ## v0.0.1-next.31
4
56
 
5
57
  - Initial Release
@@ -2,9 +2,11 @@
2
2
 
3
3
  ## Interfaces
4
4
 
5
+ - [IAuthenticationAdminComponent](interfaces/IAuthenticationAdminComponent.md)
5
6
  - [IAuthenticationComponent](interfaces/IAuthenticationComponent.md)
6
7
  - [ILoginRequest](interfaces/ILoginRequest.md)
7
8
  - [ILoginResponse](interfaces/ILoginResponse.md)
8
9
  - [ILogoutRequest](interfaces/ILogoutRequest.md)
9
10
  - [IRefreshTokenRequest](interfaces/IRefreshTokenRequest.md)
10
11
  - [IRefreshTokenResponse](interfaces/IRefreshTokenResponse.md)
12
+ - [IUpdatePasswordRequest](interfaces/IUpdatePasswordRequest.md)
@@ -0,0 +1,97 @@
1
+ # Interface: IAuthenticationAdminComponent
2
+
3
+ Contract definition for authentication admin component.
4
+
5
+ ## Extends
6
+
7
+ - `IComponent`
8
+
9
+ ## Methods
10
+
11
+ ### create()
12
+
13
+ > **create**(`email`, `password`, `identity`): `Promise`\<`void`\>
14
+
15
+ Create a login for the user.
16
+
17
+ #### Parameters
18
+
19
+ ##### email
20
+
21
+ `string`
22
+
23
+ The email address for the user.
24
+
25
+ ##### password
26
+
27
+ `string`
28
+
29
+ The password for the user.
30
+
31
+ ##### identity
32
+
33
+ `string`
34
+
35
+ The DID to associate with the account.
36
+
37
+ #### Returns
38
+
39
+ `Promise`\<`void`\>
40
+
41
+ Nothing.
42
+
43
+ ***
44
+
45
+ ### remove()
46
+
47
+ > **remove**(`email`): `Promise`\<`void`\>
48
+
49
+ Remove the current user.
50
+
51
+ #### Parameters
52
+
53
+ ##### email
54
+
55
+ `string`
56
+
57
+ The email address of the user to remove.
58
+
59
+ #### Returns
60
+
61
+ `Promise`\<`void`\>
62
+
63
+ Nothing.
64
+
65
+ ***
66
+
67
+ ### updatePassword()
68
+
69
+ > **updatePassword**(`email`, `newPassword`, `currentPassword?`): `Promise`\<`void`\>
70
+
71
+ Update the user's password.
72
+
73
+ #### Parameters
74
+
75
+ ##### email
76
+
77
+ `string`
78
+
79
+ The email address of the user to update.
80
+
81
+ ##### newPassword
82
+
83
+ `string`
84
+
85
+ The new password for the user.
86
+
87
+ ##### currentPassword?
88
+
89
+ `string`
90
+
91
+ The current password, optional, if supplied will check against existing.
92
+
93
+ #### Returns
94
+
95
+ `Promise`\<`void`\>
96
+
97
+ Nothing.
@@ -10,45 +10,43 @@ Contract definition for authentication component.
10
10
 
11
11
  ### login()
12
12
 
13
- > **login**(`email`, `password`): `Promise`\<`object`\>
13
+ > **login**(`email`, `password`): `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
14
14
 
15
15
  Perform a login for the user.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **email**: `string`
19
+ ##### email
20
+
21
+ `string`
20
22
 
21
23
  The email address for the user.
22
24
 
23
- **password**: `string`
25
+ ##### password
26
+
27
+ `string`
24
28
 
25
29
  The password for the user.
26
30
 
27
31
  #### Returns
28
32
 
29
- `Promise`\<`object`\>
33
+ `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
30
34
 
31
35
  The authentication token for the user, if it uses a mechanism with public access.
32
36
 
33
- ##### token?
34
-
35
- > `optional` **token**: `string`
36
-
37
- ##### expiry
38
-
39
- > **expiry**: `number`
40
-
41
37
  ***
42
38
 
43
39
  ### logout()
44
40
 
45
- > **logout**(`token`?): `Promise`\<`void`\>
41
+ > **logout**(`token?`): `Promise`\<`void`\>
46
42
 
47
43
  Logout the current user.
48
44
 
49
45
  #### Parameters
50
46
 
51
- **token?**: `string`
47
+ ##### token?
48
+
49
+ `string`
52
50
 
53
51
  The token to logout, if it uses a mechanism with public access.
54
52
 
@@ -62,26 +60,54 @@ Nothing.
62
60
 
63
61
  ### refresh()
64
62
 
65
- > **refresh**(`token`?): `Promise`\<`object`\>
63
+ > **refresh**(`token?`): `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
66
64
 
67
65
  Refresh the token.
68
66
 
69
67
  #### Parameters
70
68
 
71
- **token?**: `string`
69
+ ##### token?
70
+
71
+ `string`
72
72
 
73
73
  The token to refresh, if it uses a mechanism with public access.
74
74
 
75
75
  #### Returns
76
76
 
77
- `Promise`\<`object`\>
77
+ `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
78
78
 
79
79
  The refreshed token, if it uses a mechanism with public access.
80
80
 
81
- ##### token?
81
+ ***
82
+
83
+ ### updatePassword()
84
+
85
+ > **updatePassword**(`email`, `currentPassword`, `newPassword`): `Promise`\<`void`\>
82
86
 
83
- > `optional` **token**: `string`
87
+ Update the user's password.
84
88
 
85
- ##### expiry
89
+ #### Parameters
90
+
91
+ ##### email
92
+
93
+ `string`
94
+
95
+ The email address of the user to update.
96
+
97
+ ##### currentPassword
98
+
99
+ `string`
100
+
101
+ The current password for the user.
102
+
103
+ ##### newPassword
86
104
 
87
- > **expiry**: `number`
105
+ `string`
106
+
107
+ The new password for the user.
108
+
109
+ #### Returns
110
+
111
+ `Promise`\<`void`\>
112
+
113
+ Nothing.
@@ -1,6 +1,6 @@
1
1
  # Interface: IRefreshTokenRequest
2
2
 
3
- Perform a refresh on the auth token.
3
+ Perform a refresh of the auth token.
4
4
 
5
5
  ## Properties
6
6
 
@@ -0,0 +1,37 @@
1
+ # Interface: IUpdatePasswordRequest
2
+
3
+ Update a users password.
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
+ #### currentPassword
28
+
29
+ > **currentPassword**: `string`
30
+
31
+ The current password for the user.
32
+
33
+ #### newPassword
34
+
35
+ > **newPassword**: `string`
36
+
37
+ The new password for the user.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-auth-entity-storage-models",
3
- "version": "0.0.1-next.9",
3
+ "version": "0.0.2-next.1",
4
4
  "description": "Models which define the structure of the Auth Entity Storage contracts.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,9 +23,9 @@
23
23
  "types": "./dist/types/index.d.ts",
24
24
  "exports": {
25
25
  ".": {
26
+ "types": "./dist/types/index.d.ts",
26
27
  "require": "./dist/cjs/index.cjs",
27
- "import": "./dist/esm/index.mjs",
28
- "types": "./dist/types/index.d.ts"
28
+ "import": "./dist/esm/index.mjs"
29
29
  }
30
30
  },
31
31
  "files": [