@twin.org/api-auth-entity-storage-models 0.0.3-next.20 → 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/docs/changelog.md +8 -1
- package/docs/examples.md +80 -1
- 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/docs/changelog.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
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
|
|
2
9
|
|
|
3
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)
|
|
4
11
|
|
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/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",
|