@twin.org/api-auth-entity-storage-models 0.0.3-next.20 → 0.0.3-next.22

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,6 +1,6 @@
1
- # TWIN Auth Entity Storage Models
1
+ # TWIN API Auth Entity Storage Models
2
2
 
3
- Models which define the structure of the Auth Entity Storage contracts.
3
+ This package provides contracts for authentication flows and admin user management with entity storage.
4
4
 
5
5
  ## Installation
6
6
 
package/docs/changelog.md CHANGED
@@ -1,4 +1,18 @@
1
- # @twin.org/api-auth-entity-storage-models - Changelog
1
+ # Changelog
2
+
3
+ ## [0.0.3-next.22](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.21...api-auth-entity-storage-models-v0.0.3-next.22) (2026-03-27)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **api-auth-entity-storage-models:** Synchronize repo versions
9
+
10
+ ## [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)
11
+
12
+
13
+ ### Miscellaneous Chores
14
+
15
+ * **api-auth-entity-storage-models:** Synchronize repo versions
2
16
 
3
17
  ## [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)
4
18
 
package/docs/examples.md CHANGED
@@ -1 +1,80 @@
1
- # @twin.org/api-auth-entity-storage-models - Examples
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
+ ```
@@ -4,7 +4,7 @@ Create a new user as an admin.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
7
+ ### body {#body}
8
8
 
9
9
  > **body**: `Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"salt"`\>
10
10
 
@@ -4,7 +4,7 @@ Get a user as an admin.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### pathParams
7
+ ### pathParams {#pathparams}
8
8
 
9
9
  > **pathParams**: `object`
10
10
 
@@ -4,7 +4,7 @@ Get a user as an admin.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### pathParams
7
+ ### pathParams {#pathparams}
8
8
 
9
9
  > **pathParams**: `object`
10
10
 
@@ -4,7 +4,7 @@ Get a user as an admin.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
7
+ ### body {#body}
8
8
 
9
9
  > **body**: `Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"password"` \| `"salt"`\>
10
10
 
@@ -4,7 +4,7 @@ Remove a user as an admin.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### pathParams
7
+ ### pathParams {#pathparams}
8
8
 
9
9
  > **pathParams**: `object`
10
10
 
@@ -4,7 +4,7 @@ Update a users password as an admin.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### pathParams
7
+ ### pathParams {#pathparams}
8
8
 
9
9
  > **pathParams**: `object`
10
10
 
@@ -18,7 +18,7 @@ The user email.
18
18
 
19
19
  ***
20
20
 
21
- ### body
21
+ ### body {#body}
22
22
 
23
23
  > **body**: `object`
24
24
 
@@ -32,6 +32,6 @@ The new password for the user.
32
32
 
33
33
  #### currentPassword?
34
34
 
35
- > `optional` **currentPassword**: `string`
35
+ > `optional` **currentPassword?**: `string`
36
36
 
37
37
  The current password for the user.
@@ -4,7 +4,7 @@ Update a user as an admin.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### pathParams
7
+ ### pathParams {#pathparams}
8
8
 
9
9
  > **pathParams**: `object`
10
10
 
@@ -18,7 +18,7 @@ The user email.
18
18
 
19
19
  ***
20
20
 
21
- ### body
21
+ ### body {#body}
22
22
 
23
23
  > **body**: `Partial`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"email"` \| `"password"` \| `"salt"`\>\>
24
24
 
@@ -8,7 +8,7 @@ Contract definition for authentication admin component.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### create()
11
+ ### create() {#create}
12
12
 
13
13
  > **create**(`user`): `Promise`\<`void`\>
14
14
 
@@ -30,7 +30,7 @@ Nothing.
30
30
 
31
31
  ***
32
32
 
33
- ### update()
33
+ ### update() {#update}
34
34
 
35
35
  > **update**(`user`): `Promise`\<`void`\>
36
36
 
@@ -52,7 +52,7 @@ Nothing.
52
52
 
53
53
  ***
54
54
 
55
- ### get()
55
+ ### get() {#get}
56
56
 
57
57
  > **get**(`email`): `Promise`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"salt"` \| `"password"`\>\>
58
58
 
@@ -74,7 +74,7 @@ The user details.
74
74
 
75
75
  ***
76
76
 
77
- ### getByIdentity()
77
+ ### getByIdentity() {#getbyidentity}
78
78
 
79
79
  > **getByIdentity**(`identity`): `Promise`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"salt"` \| `"password"`\>\>
80
80
 
@@ -96,7 +96,7 @@ The user details.
96
96
 
97
97
  ***
98
98
 
99
- ### remove()
99
+ ### remove() {#remove}
100
100
 
101
101
  > **remove**(`email`): `Promise`\<`void`\>
102
102
 
@@ -118,7 +118,7 @@ Nothing.
118
118
 
119
119
  ***
120
120
 
121
- ### updatePassword()
121
+ ### updatePassword() {#updatepassword}
122
122
 
123
123
  > **updatePassword**(`email`, `newPassword`, `currentPassword?`): `Promise`\<`void`\>
124
124
 
@@ -8,7 +8,7 @@ Contract definition for authentication component.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### login()
11
+ ### login() {#login}
12
12
 
13
13
  > **login**(`email`, `password`): `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
14
14
 
@@ -36,7 +36,7 @@ The authentication token for the user, if it uses a mechanism with public access
36
36
 
37
37
  ***
38
38
 
39
- ### logout()
39
+ ### logout() {#logout}
40
40
 
41
41
  > **logout**(`token?`): `Promise`\<`void`\>
42
42
 
@@ -58,7 +58,7 @@ Nothing.
58
58
 
59
59
  ***
60
60
 
61
- ### refresh()
61
+ ### refresh() {#refresh}
62
62
 
63
63
  > **refresh**(`token?`): `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
64
64
 
@@ -80,7 +80,7 @@ The refreshed token, if it uses a mechanism with public access.
80
80
 
81
81
  ***
82
82
 
83
- ### updatePassword()
83
+ ### updatePassword() {#updatepassword}
84
84
 
85
85
  > **updatePassword**(`currentPassword`, `newPassword`): `Promise`\<`void`\>
86
86
 
@@ -4,7 +4,7 @@ Contract definition for authentication user.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### email
7
+ ### email {#email}
8
8
 
9
9
  > **email**: `string`
10
10
 
@@ -12,7 +12,7 @@ The user e-mail address.
12
12
 
13
13
  ***
14
14
 
15
- ### password
15
+ ### password {#password}
16
16
 
17
17
  > **password**: `string`
18
18
 
@@ -20,7 +20,7 @@ The encrypted password for the user.
20
20
 
21
21
  ***
22
22
 
23
- ### salt
23
+ ### salt {#salt}
24
24
 
25
25
  > **salt**: `string`
26
26
 
@@ -28,7 +28,7 @@ The salt for the password.
28
28
 
29
29
  ***
30
30
 
31
- ### userIdentity
31
+ ### userIdentity {#useridentity}
32
32
 
33
33
  > **userIdentity**: `string`
34
34
 
@@ -36,7 +36,7 @@ The user identity.
36
36
 
37
37
  ***
38
38
 
39
- ### organizationIdentity
39
+ ### organizationIdentity {#organizationidentity}
40
40
 
41
41
  > **organizationIdentity**: `string`
42
42
 
@@ -44,7 +44,7 @@ The users organization.
44
44
 
45
45
  ***
46
46
 
47
- ### scope
47
+ ### scope {#scope}
48
48
 
49
49
  > **scope**: `string`[]
50
50
 
@@ -4,7 +4,7 @@ Perform a login on the server.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
7
+ ### body {#body}
8
8
 
9
9
  > **body**: `object`
10
10
 
@@ -4,21 +4,21 @@ Response from a login on the server.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### headers?
7
+ ### headers? {#headers}
8
8
 
9
- > `optional` **headers**: `object`
9
+ > `optional` **headers?**: `object`
10
10
 
11
11
  Response headers.
12
12
 
13
13
  #### set-cookie?
14
14
 
15
- > `optional` **set-cookie**: `string`
15
+ > `optional` **set-cookie?**: `string`
16
16
 
17
17
  The cookie containing the auth token.
18
18
 
19
19
  ***
20
20
 
21
- ### body
21
+ ### body {#body}
22
22
 
23
23
  > **body**: `object`
24
24
 
@@ -4,14 +4,14 @@ Perform a logout on the auth token.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### query?
7
+ ### query? {#query}
8
8
 
9
- > `optional` **query**: `object`
9
+ > `optional` **query?**: `object`
10
10
 
11
11
  The logout token details.
12
12
 
13
13
  #### token?
14
14
 
15
- > `optional` **token**: `string`
15
+ > `optional` **token?**: `string`
16
16
 
17
17
  The token to logout, if it uses a mechanism with public access.
@@ -4,14 +4,14 @@ Perform a refresh of the auth token.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### query?
7
+ ### query? {#query}
8
8
 
9
- > `optional` **query**: `object`
9
+ > `optional` **query?**: `object`
10
10
 
11
11
  The refresh token details.
12
12
 
13
13
  #### token?
14
14
 
15
- > `optional` **token**: `string`
15
+ > `optional` **token?**: `string`
16
16
 
17
17
  The token to refresh, if it uses a mechanism with public access.
@@ -4,21 +4,21 @@ Response from a refresh on the auth token.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### headers?
7
+ ### headers? {#headers}
8
8
 
9
- > `optional` **headers**: `object`
9
+ > `optional` **headers?**: `object`
10
10
 
11
11
  Response headers.
12
12
 
13
13
  #### set-cookie?
14
14
 
15
- > `optional` **set-cookie**: `string`
15
+ > `optional` **set-cookie?**: `string`
16
16
 
17
17
  The cookie containing the auth token.
18
18
 
19
19
  ***
20
20
 
21
- ### body
21
+ ### body {#body}
22
22
 
23
23
  > **body**: `object`
24
24
 
@@ -4,7 +4,7 @@ Update the current user's password.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
7
+ ### body {#body}
8
8
 
9
9
  > **body**: `object`
10
10
 
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.20",
4
- "description": "Models which define the structure of the Auth Entity Storage contracts.",
3
+ "version": "0.0.3-next.22",
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",