@twin.org/api-auth-entity-storage-service 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 CHANGED
@@ -1,6 +1,6 @@
1
- # TWIN Auth Entity Storage Service
1
+ # TWIN API Auth Entity Storage Service
2
2
 
3
- Auth Entity Storage contract implementation and REST endpoint definitions.
3
+ This package provides an authentication service implementation and REST routes backed by entity storage.
4
4
 
5
5
  ## Installation
6
6
 
package/docs/changelog.md CHANGED
@@ -1,4 +1,20 @@
1
- # @twin.org/api-auth-entity-storage-service - Changelog
1
+ # Changelog
2
+
3
+ ## [0.0.3-next.21](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.20...api-auth-entity-storage-service-v0.0.3-next.21) (2026-03-11)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **api-auth-entity-storage-service:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.20 to 0.0.3-next.21
16
+ * @twin.org/api-core bumped from 0.0.3-next.20 to 0.0.3-next.21
17
+ * @twin.org/api-models bumped from 0.0.3-next.20 to 0.0.3-next.21
2
18
 
3
19
  ## [0.0.3-next.20](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.19...api-auth-entity-storage-service-v0.0.3-next.20) (2026-02-09)
4
20
 
package/docs/examples.md CHANGED
@@ -1 +1,88 @@
1
- # @twin.org/api-auth-entity-storage-service - Examples
1
+ # Auth Entity Storage Service Examples
2
+
3
+ These snippets show how to wire authentication services into your component container and apply token processing in request pipelines.
4
+
5
+ ## EntityStorageAuthenticationAdminService
6
+
7
+ ```typescript
8
+ import { EntityStorageAuthenticationAdminService } from '@twin.org/api-auth-entity-storage-service';
9
+
10
+ const adminService = new EntityStorageAuthenticationAdminService();
11
+
12
+ console.log(adminService.className()); // EntityStorageAuthenticationAdminService
13
+
14
+ await adminService.create({
15
+ email: 'owner@example.org',
16
+ password: 'StartPassword123',
17
+ userIdentity: 'did:example:owner',
18
+ organizationIdentity: 'did:example:org',
19
+ scope: ['admin']
20
+ });
21
+
22
+ await adminService.update({
23
+ email: 'owner@example.org',
24
+ scope: ['admin', 'security']
25
+ });
26
+
27
+ await adminService.updatePassword('owner@example.org', 'StartPassword124', 'StartPassword123');
28
+
29
+ const fromIdentity = await adminService.getByIdentity('did:example:owner');
30
+ console.log(fromIdentity.scope.length); // 2
31
+ ```
32
+
33
+ ```typescript
34
+ import { EntityStorageAuthenticationAdminService } from '@twin.org/api-auth-entity-storage-service';
35
+
36
+ const adminService = new EntityStorageAuthenticationAdminService();
37
+ const user = await adminService.get('owner@example.org');
38
+ await adminService.remove(user.email);
39
+
40
+ console.log(user.email); // owner@example.org
41
+ ```
42
+
43
+ ## EntityStorageAuthenticationService
44
+
45
+ ```typescript
46
+ import { EntityStorageAuthenticationService } from '@twin.org/api-auth-entity-storage-service';
47
+
48
+ const authService = new EntityStorageAuthenticationService();
49
+
50
+ await authService.start('default');
51
+ console.log(authService.className()); // EntityStorageAuthenticationService
52
+
53
+ const loginResult = await authService.login('alice@example.org', 'correct-horse-battery-staple');
54
+
55
+ const refreshResult = await authService.refresh(loginResult.token);
56
+
57
+ await authService.updatePassword('correct-horse-battery-staple', 'correct-horse-battery-staple-2');
58
+
59
+ await authService.logout(refreshResult.token);
60
+ console.log(refreshResult.expiry > 0); // true
61
+ ```
62
+
63
+ ## AuthHeaderProcessor
64
+
65
+ ```typescript
66
+ import { AuthHeaderProcessor } from '@twin.org/api-auth-entity-storage-service';
67
+
68
+ const processor = new AuthHeaderProcessor();
69
+
70
+ await processor.start('default');
71
+ console.log(processor.className()); // AuthHeaderProcessor
72
+
73
+ const request = {
74
+ method: 'get',
75
+ url: '/info',
76
+ headers: {
77
+ authorization: 'Bearer token-value'
78
+ }
79
+ };
80
+
81
+ const response = {};
82
+ const contextIds = {};
83
+ const processorState: { [id: string]: unknown } = {};
84
+
85
+ await processor.pre(request, response, { skipAuth: false }, contextIds, processorState);
86
+
87
+ await processor.post(request, response, { skipAuth: false }, contextIds, processorState);
88
+ ```
@@ -10,12 +10,6 @@ Configuration for the authentication header processor
10
10
 
11
11
  The name of the key to retrieve from the vault for signing JWT.
12
12
 
13
- #### Default
14
-
15
- ```ts
16
- auth-signing
17
- ```
18
-
19
13
  ***
20
14
 
21
15
  ### cookieName?
@@ -23,9 +17,3 @@ auth-signing
23
17
  > `optional` **cookieName**: `string`
24
18
 
25
19
  The name of the cookie to use for the token.
26
-
27
- #### Default
28
-
29
- ```ts
30
- access_token
31
- ```
@@ -10,12 +10,6 @@ Options for the AuthHeaderProcessor constructor.
10
10
 
11
11
  The vault for the private keys.
12
12
 
13
- #### Default
14
-
15
- ```ts
16
- vault
17
- ```
18
-
19
13
  ***
20
14
 
21
15
  ### config?
@@ -9,9 +9,3 @@ Configuration for the entity storage authentication admin service.
9
9
  > `optional` **minPasswordLength**: `number`
10
10
 
11
11
  The minimum password length.
12
-
13
- #### Default
14
-
15
- ```ts
16
- 8
17
- ```
@@ -10,12 +10,6 @@ Options for the EntityStorageAuthenticationAdminService constructor.
10
10
 
11
11
  The entity storage for the users.
12
12
 
13
- #### Default
14
-
15
- ```ts
16
- authentication-user
17
- ```
18
-
19
13
  ***
20
14
 
21
15
  ### config?
@@ -10,12 +10,6 @@ Configuration for the entity storage authentication service.
10
10
 
11
11
  The name of the key to retrieve from the vault for signing JWT.
12
12
 
13
- #### Default
14
-
15
- ```ts
16
- auth-signing
17
- ```
18
-
19
13
  ***
20
14
 
21
15
  ### defaultTtlMinutes?
@@ -23,9 +17,3 @@ auth-signing
23
17
  > `optional` **defaultTtlMinutes**: `number`
24
18
 
25
19
  The default time to live for the JWT.
26
-
27
- #### Default
28
-
29
- ```ts
30
- 1440
31
- ```
@@ -10,12 +10,6 @@ Options for the EntityStorageAuthenticationService constructor.
10
10
 
11
11
  The entity storage for the users.
12
12
 
13
- #### Default
14
-
15
- ```ts
16
- authentication-user
17
- ```
18
-
19
13
  ***
20
14
 
21
15
  ### vaultConnectorType?
@@ -24,12 +18,6 @@ authentication-user
24
18
 
25
19
  The vault for the private keys.
26
20
 
27
- #### Default
28
-
29
- ```ts
30
- vault
31
- ```
32
-
33
21
  ***
34
22
 
35
23
  ### authenticationAdminServiceType?
@@ -38,12 +26,6 @@ vault
38
26
 
39
27
  The admin service.
40
28
 
41
- #### Default
42
-
43
- ```ts
44
- authentication-admin
45
- ```
46
-
47
29
  ***
48
30
 
49
31
  ### config?
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@twin.org/api-auth-entity-storage-service",
3
- "version": "0.0.3-next.20",
4
- "description": "Auth Entity Storage contract implementation and REST endpoint definitions",
3
+ "version": "0.0.3-next.21",
4
+ "description": "Authentication service implementation and REST routes backed by entity storage.",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/twinfoundation/api.git",
@@ -14,9 +14,9 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-auth-entity-storage-models": "0.0.3-next.20",
18
- "@twin.org/api-core": "0.0.3-next.20",
19
- "@twin.org/api-models": "0.0.3-next.20",
17
+ "@twin.org/api-auth-entity-storage-models": "0.0.3-next.21",
18
+ "@twin.org/api-core": "0.0.3-next.21",
19
+ "@twin.org/api-models": "0.0.3-next.21",
20
20
  "@twin.org/context": "next",
21
21
  "@twin.org/core": "next",
22
22
  "@twin.org/crypto": "next",