@twin.org/api-auth-entity-storage-models 0.0.1 → 0.0.2-next.2
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/dist/types/index.d.ts +2 -0
- package/dist/types/models/IAuthenticationAdminComponent.d.ts +28 -0
- package/dist/types/models/IAuthenticationComponent.d.ts +8 -0
- package/dist/types/models/api/IUpdatePasswordRequest.d.ts +27 -0
- package/docs/changelog.md +17 -0
- package/docs/reference/index.md +2 -0
- package/docs/reference/interfaces/IAuthenticationAdminComponent.md +97 -0
- package/docs/reference/interfaces/IAuthenticationComponent.md +34 -0
- package/docs/reference/interfaces/IUpdatePasswordRequest.md +37 -0
- package/package.json +4 -4
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
}
|
|
@@ -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,22 @@
|
|
|
1
1
|
# @twin.org/api-auth-entity-storage-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.2](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.2-next.1...api-auth-entity-storage-models-v0.0.2-next.2) (2025-07-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* improve socket route logging ([b8d9519](https://github.com/twinfoundation/api/commit/b8d95199f838ac6ba9f45c30ef7c4e613201ff53))
|
|
9
|
+
|
|
10
|
+
## [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)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
|
|
16
|
+
* improve description ([d28185c](https://github.com/twinfoundation/api/commit/d28185c799a97455fee72fb23c744c8e71325f0b))
|
|
17
|
+
* update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
|
|
18
|
+
* use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
|
|
19
|
+
|
|
3
20
|
## 0.0.1 (2025-07-03)
|
|
4
21
|
|
|
5
22
|
|
package/docs/reference/index.md
CHANGED
|
@@ -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.
|
|
@@ -77,3 +77,37 @@ The token to refresh, if it uses a mechanism with public access.
|
|
|
77
77
|
`Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
|
|
78
78
|
|
|
79
79
|
The refreshed token, if it uses a mechanism with public access.
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### updatePassword()
|
|
84
|
+
|
|
85
|
+
> **updatePassword**(`email`, `currentPassword`, `newPassword`): `Promise`\<`void`\>
|
|
86
|
+
|
|
87
|
+
Update the user's password.
|
|
88
|
+
|
|
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
|
|
104
|
+
|
|
105
|
+
`string`
|
|
106
|
+
|
|
107
|
+
The new password for the user.
|
|
108
|
+
|
|
109
|
+
#### Returns
|
|
110
|
+
|
|
111
|
+
`Promise`\<`void`\>
|
|
112
|
+
|
|
113
|
+
Nothing.
|
|
@@ -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.
|
|
3
|
+
"version": "0.0.2-next.2",
|
|
4
4
|
"description": "Models which define the structure of the Auth Entity Storage contracts.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "
|
|
18
|
-
"@twin.org/nameof": "
|
|
19
|
-
"@twin.org/web": "
|
|
17
|
+
"@twin.org/core": "next",
|
|
18
|
+
"@twin.org/nameof": "next",
|
|
19
|
+
"@twin.org/web": "next"
|
|
20
20
|
},
|
|
21
21
|
"main": "./dist/cjs/index.cjs",
|
|
22
22
|
"module": "./dist/esm/index.mjs",
|