@twin.org/api-auth-entity-storage-service 0.0.2-next.8 → 0.0.3-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.
Files changed (53) hide show
  1. package/dist/es/entities/authenticationUser.js +53 -0
  2. package/dist/es/entities/authenticationUser.js.map +1 -0
  3. package/dist/es/index.js +18 -0
  4. package/dist/es/index.js.map +1 -0
  5. package/dist/es/models/IAuthHeaderProcessorConfig.js +4 -0
  6. package/dist/es/models/IAuthHeaderProcessorConfig.js.map +1 -0
  7. package/dist/es/models/IAuthHeaderProcessorConstructorOptions.js +2 -0
  8. package/dist/es/models/IAuthHeaderProcessorConstructorOptions.js.map +1 -0
  9. package/dist/es/models/IEntityStorageAuthenticationAdminServiceConfig.js +4 -0
  10. package/dist/es/models/IEntityStorageAuthenticationAdminServiceConfig.js.map +1 -0
  11. package/dist/es/models/IEntityStorageAuthenticationAdminServiceConstructorOptions.js +2 -0
  12. package/dist/es/models/IEntityStorageAuthenticationAdminServiceConstructorOptions.js.map +1 -0
  13. package/dist/es/models/IEntityStorageAuthenticationServiceConfig.js +4 -0
  14. package/dist/es/models/IEntityStorageAuthenticationServiceConfig.js.map +1 -0
  15. package/dist/es/models/IEntityStorageAuthenticationServiceConstructorOptions.js +2 -0
  16. package/dist/es/models/IEntityStorageAuthenticationServiceConstructorOptions.js.map +1 -0
  17. package/dist/es/processors/authHeaderProcessor.js +120 -0
  18. package/dist/es/processors/authHeaderProcessor.js.map +1 -0
  19. package/dist/es/restEntryPoints.js +10 -0
  20. package/dist/es/restEntryPoints.js.map +1 -0
  21. package/dist/es/routes/entityStorageAuthenticationRoutes.js +248 -0
  22. package/dist/es/routes/entityStorageAuthenticationRoutes.js.map +1 -0
  23. package/dist/es/schema.js +11 -0
  24. package/dist/es/schema.js.map +1 -0
  25. package/dist/es/services/entityStorageAuthenticationAdminService.js +146 -0
  26. package/dist/es/services/entityStorageAuthenticationAdminService.js.map +1 -0
  27. package/dist/es/services/entityStorageAuthenticationService.js +136 -0
  28. package/dist/es/services/entityStorageAuthenticationService.js.map +1 -0
  29. package/dist/es/utils/passwordHelper.js +29 -0
  30. package/dist/es/utils/passwordHelper.js.map +1 -0
  31. package/dist/es/utils/tokenHelper.js +100 -0
  32. package/dist/es/utils/tokenHelper.js.map +1 -0
  33. package/dist/types/entities/authenticationUser.d.ts +4 -0
  34. package/dist/types/index.d.ts +15 -15
  35. package/dist/types/models/IAuthHeaderProcessorConstructorOptions.d.ts +1 -1
  36. package/dist/types/models/IEntityStorageAuthenticationAdminServiceConstructorOptions.d.ts +1 -1
  37. package/dist/types/models/IEntityStorageAuthenticationServiceConstructorOptions.d.ts +1 -1
  38. package/dist/types/processors/authHeaderProcessor.d.ts +14 -9
  39. package/dist/types/services/entityStorageAuthenticationAdminService.d.ts +10 -4
  40. package/dist/types/services/entityStorageAuthenticationService.d.ts +8 -4
  41. package/dist/types/utils/passwordHelper.d.ts +4 -0
  42. package/dist/types/utils/tokenHelper.d.ts +7 -2
  43. package/docs/changelog.md +107 -0
  44. package/docs/reference/classes/AuthHeaderProcessor.md +28 -20
  45. package/docs/reference/classes/AuthenticationUser.md +8 -0
  46. package/docs/reference/classes/EntityStorageAuthenticationAdminService.md +25 -5
  47. package/docs/reference/classes/EntityStorageAuthenticationService.md +18 -10
  48. package/docs/reference/classes/PasswordHelper.md +8 -0
  49. package/docs/reference/classes/TokenHelper.md +21 -7
  50. package/locales/en.json +3 -6
  51. package/package.json +29 -11
  52. package/dist/cjs/index.cjs +0 -811
  53. package/dist/esm/index.mjs +0 -797
@@ -1,5 +1,5 @@
1
1
  import type { IAuthenticationAdminComponent } from "@twin.org/api-auth-entity-storage-models";
2
- import type { IEntityStorageAuthenticationAdminServiceConstructorOptions } from "../models/IEntityStorageAuthenticationAdminServiceConstructorOptions";
2
+ import type { IEntityStorageAuthenticationAdminServiceConstructorOptions } from "../models/IEntityStorageAuthenticationAdminServiceConstructorOptions.js";
3
3
  /**
4
4
  * Implementation of the authentication component using entity storage.
5
5
  */
@@ -7,20 +7,26 @@ export declare class EntityStorageAuthenticationAdminService implements IAuthent
7
7
  /**
8
8
  * Runtime name for the class.
9
9
  */
10
- readonly CLASS_NAME: string;
10
+ static readonly CLASS_NAME: string;
11
11
  /**
12
12
  * Create a new instance of EntityStorageAuthentication.
13
13
  * @param options The dependencies for the identity connector.
14
14
  */
15
15
  constructor(options?: IEntityStorageAuthenticationAdminServiceConstructorOptions);
16
+ /**
17
+ * Returns the class name of the component.
18
+ * @returns The class name of the component.
19
+ */
20
+ className(): string;
16
21
  /**
17
22
  * Create a login for the user.
18
23
  * @param email The email address for the user.
19
24
  * @param password The password for the user.
20
- * @param identity The DID to associate with the account.
25
+ * @param userIdentity The DID to associate with the account.
26
+ * @param organizationIdentity The organization of the user.
21
27
  * @returns Nothing.
22
28
  */
23
- create(email: string, password: string, identity: string): Promise<void>;
29
+ create(email: string, password: string, userIdentity: string, organizationIdentity: string): Promise<void>;
24
30
  /**
25
31
  * Remove the current user.
26
32
  * @param email The email address of the user to remove.
@@ -1,5 +1,5 @@
1
1
  import type { IAuthenticationComponent } from "@twin.org/api-auth-entity-storage-models";
2
- import type { IEntityStorageAuthenticationServiceConstructorOptions } from "../models/IEntityStorageAuthenticationServiceConstructorOptions";
2
+ import type { IEntityStorageAuthenticationServiceConstructorOptions } from "../models/IEntityStorageAuthenticationServiceConstructorOptions.js";
3
3
  /**
4
4
  * Implementation of the authentication component using entity storage.
5
5
  */
@@ -7,19 +7,23 @@ export declare class EntityStorageAuthenticationService implements IAuthenticati
7
7
  /**
8
8
  * Runtime name for the class.
9
9
  */
10
- readonly CLASS_NAME: string;
10
+ static readonly CLASS_NAME: string;
11
11
  /**
12
12
  * Create a new instance of EntityStorageAuthentication.
13
13
  * @param options The dependencies for the identity connector.
14
14
  */
15
15
  constructor(options?: IEntityStorageAuthenticationServiceConstructorOptions);
16
+ /**
17
+ * Returns the class name of the component.
18
+ * @returns The class name of the component.
19
+ */
20
+ className(): string;
16
21
  /**
17
22
  * The service needs to be started when the application is initialized.
18
- * @param nodeIdentity The identity of the node.
19
23
  * @param nodeLoggingComponentType The node logging component type.
20
24
  * @returns Nothing.
21
25
  */
22
- start(nodeIdentity: string, nodeLoggingComponentType?: string): Promise<void>;
26
+ start(nodeLoggingComponentType?: string): Promise<void>;
23
27
  /**
24
28
  * Perform a login for the user.
25
29
  * @param email The email address for the user.
@@ -2,6 +2,10 @@
2
2
  * Helper class for password operations.
3
3
  */
4
4
  export declare class PasswordHelper {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Hash the password for the user.
7
11
  * @param passwordBytes The password bytes.
@@ -4,15 +4,20 @@ import { type IHttpHeaders, type IJwtHeader, type IJwtPayload } from "@twin.org/
4
4
  * Helper class for token operations.
5
5
  */
6
6
  export declare class TokenHelper {
7
+ /**
8
+ * Runtime name for the class.
9
+ */
10
+ static readonly CLASS_NAME: string;
7
11
  /**
8
12
  * Create a new token.
9
13
  * @param vaultConnector The vault connector.
10
14
  * @param signingKeyName The signing key name.
11
- * @param subject The subject for the token.
15
+ * @param userIdentity The subject for the token.
16
+ * @param organizationIdentity The organization for the token.
12
17
  * @param ttlMinutes The time to live for the token in minutes.
13
18
  * @returns The new token and its expiry date.
14
19
  */
15
- static createToken(vaultConnector: IVaultConnector, signingKeyName: string, subject: string, ttlMinutes: number): Promise<{
20
+ static createToken(vaultConnector: IVaultConnector, signingKeyName: string, userIdentity: string, organizationIdentity: string | undefined, ttlMinutes: number): Promise<{
16
21
  token: string;
17
22
  expiry: number;
18
23
  }>;
package/docs/changelog.md CHANGED
@@ -1,5 +1,112 @@
1
1
  # @twin.org/api-auth-entity-storage-service - Changelog
2
2
 
3
+ ## [0.0.3-next.1](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.3-next.0...api-auth-entity-storage-service-v0.0.3-next.1) (2025-11-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
9
+ * add json-ld mime type processor and auth admin component ([8861791](https://github.com/twinfoundation/api/commit/88617916e23bfbca023dbae1976fe421983a02ff))
10
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
11
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
12
+ * remove unused namespace ([08478f2](https://github.com/twinfoundation/api/commit/08478f27efda9beb0271fdb22f6972e918361965))
13
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
14
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
15
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
16
+ * use new extractBearer method ([3e0cc54](https://github.com/twinfoundation/api/commit/3e0cc5462c06f59a6b744386eeff8326e5abbc95))
17
+ * use new extractBearerToken method ([df654e9](https://github.com/twinfoundation/api/commit/df654e9caee5bd62f0be36f7be9902c8fab6ead6))
18
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
19
+
20
+
21
+ ### Dependencies
22
+
23
+ * The following workspace dependencies were updated
24
+ * dependencies
25
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.3-next.0 to 0.0.3-next.1
26
+ * @twin.org/api-core bumped from 0.0.3-next.0 to 0.0.3-next.1
27
+ * @twin.org/api-models bumped from 0.0.3-next.0 to 0.0.3-next.1
28
+
29
+ ## [0.0.2-next.13](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.2-next.12...api-auth-entity-storage-service-v0.0.2-next.13) (2025-10-09)
30
+
31
+
32
+ ### Miscellaneous Chores
33
+
34
+ * **api-auth-entity-storage-service:** Synchronize repo versions
35
+
36
+
37
+ ### Dependencies
38
+
39
+ * The following workspace dependencies were updated
40
+ * dependencies
41
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.2-next.12 to 0.0.2-next.13
42
+ * @twin.org/api-core bumped from 0.0.2-next.12 to 0.0.2-next.13
43
+ * @twin.org/api-models bumped from 0.0.2-next.12 to 0.0.2-next.13
44
+
45
+ ## [0.0.2-next.12](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.2-next.11...api-auth-entity-storage-service-v0.0.2-next.12) (2025-10-09)
46
+
47
+
48
+ ### Features
49
+
50
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
51
+
52
+
53
+ ### Dependencies
54
+
55
+ * The following workspace dependencies were updated
56
+ * dependencies
57
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.2-next.11 to 0.0.2-next.12
58
+ * @twin.org/api-core bumped from 0.0.2-next.11 to 0.0.2-next.12
59
+ * @twin.org/api-models bumped from 0.0.2-next.11 to 0.0.2-next.12
60
+
61
+ ## [0.0.2-next.11](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.2-next.10...api-auth-entity-storage-service-v0.0.2-next.11) (2025-09-29)
62
+
63
+
64
+ ### Features
65
+
66
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
67
+
68
+
69
+ ### Dependencies
70
+
71
+ * The following workspace dependencies were updated
72
+ * dependencies
73
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.2-next.10 to 0.0.2-next.11
74
+ * @twin.org/api-core bumped from 0.0.2-next.10 to 0.0.2-next.11
75
+ * @twin.org/api-models bumped from 0.0.2-next.10 to 0.0.2-next.11
76
+
77
+ ## [0.0.2-next.10](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.2-next.9...api-auth-entity-storage-service-v0.0.2-next.10) (2025-09-23)
78
+
79
+
80
+ ### Features
81
+
82
+ * use new extractBearer method ([3e0cc54](https://github.com/twinfoundation/api/commit/3e0cc5462c06f59a6b744386eeff8326e5abbc95))
83
+ * use new extractBearerToken method ([df654e9](https://github.com/twinfoundation/api/commit/df654e9caee5bd62f0be36f7be9902c8fab6ead6))
84
+
85
+
86
+ ### Dependencies
87
+
88
+ * The following workspace dependencies were updated
89
+ * dependencies
90
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.2-next.9 to 0.0.2-next.10
91
+ * @twin.org/api-core bumped from 0.0.2-next.9 to 0.0.2-next.10
92
+ * @twin.org/api-models bumped from 0.0.2-next.9 to 0.0.2-next.10
93
+
94
+ ## [0.0.2-next.9](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.2-next.8...api-auth-entity-storage-service-v0.0.2-next.9) (2025-08-29)
95
+
96
+
97
+ ### Features
98
+
99
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
100
+
101
+
102
+ ### Dependencies
103
+
104
+ * The following workspace dependencies were updated
105
+ * dependencies
106
+ * @twin.org/api-auth-entity-storage-models bumped from 0.0.2-next.8 to 0.0.2-next.9
107
+ * @twin.org/api-core bumped from 0.0.2-next.8 to 0.0.2-next.9
108
+ * @twin.org/api-models bumped from 0.0.2-next.8 to 0.0.2-next.9
109
+
3
110
  ## [0.0.2-next.8](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-service-v0.0.2-next.7...api-auth-entity-storage-service-v0.0.2-next.8) (2025-08-21)
4
111
 
5
112
 
@@ -30,30 +30,38 @@ Options for the processor.
30
30
 
31
31
  ### CLASS\_NAME
32
32
 
33
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
35
  Runtime name for the class.
36
36
 
37
+ ## Methods
38
+
39
+ ### className()
40
+
41
+ > **className**(): `string`
42
+
43
+ Returns the class name of the component.
44
+
45
+ #### Returns
46
+
47
+ `string`
48
+
49
+ The class name of the component.
50
+
37
51
  #### Implementation of
38
52
 
39
- `IBaseRouteProcessor.CLASS_NAME`
53
+ `IBaseRouteProcessor.className`
40
54
 
41
- ## Methods
55
+ ***
42
56
 
43
57
  ### start()
44
58
 
45
- > **start**(`nodeIdentity`, `nodeLoggingComponentType?`): `Promise`\<`void`\>
59
+ > **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
46
60
 
47
61
  The service needs to be started when the application is initialized.
48
62
 
49
63
  #### Parameters
50
64
 
51
- ##### nodeIdentity
52
-
53
- `string`
54
-
55
- The identity of the node.
56
-
57
65
  ##### nodeLoggingComponentType?
58
66
 
59
67
  `string`
@@ -74,7 +82,7 @@ Nothing.
74
82
 
75
83
  ### pre()
76
84
 
77
- > **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
85
+ > **pre**(`request`, `response`, `route`, `contextIds`, `processorState`): `Promise`\<`void`\>
78
86
 
79
87
  Pre process the REST request for the specified route.
80
88
 
@@ -96,13 +104,13 @@ The outgoing response.
96
104
 
97
105
  The route to process.
98
106
 
99
- `undefined` | `IBaseRoute`
107
+ `IBaseRoute` | `undefined`
100
108
 
101
- ##### requestIdentity
109
+ ##### contextIds
102
110
 
103
- `IHttpRequestIdentity`
111
+ `IContextIds`
104
112
 
105
- The identity context for the request.
113
+ The context IDs of the request.
106
114
 
107
115
  ##### processorState
108
116
 
@@ -120,7 +128,7 @@ The state handed through the processors.
120
128
 
121
129
  ### post()
122
130
 
123
- > **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
131
+ > **post**(`request`, `response`, `route`, `contextIds`, `processorState`): `Promise`\<`void`\>
124
132
 
125
133
  Post process the REST request for the specified route.
126
134
 
@@ -142,13 +150,13 @@ The outgoing response.
142
150
 
143
151
  The route to process.
144
152
 
145
- `undefined` | `IBaseRoute`
153
+ `IBaseRoute` | `undefined`
146
154
 
147
- ##### requestIdentity
155
+ ##### contextIds
148
156
 
149
- `IHttpRequestIdentity`
157
+ `IContextIds`
150
158
 
151
- The identity context for the request.
159
+ The context IDs of the request.
152
160
 
153
161
  ##### processorState
154
162
 
@@ -43,3 +43,11 @@ The salt for the password.
43
43
  > **identity**: `string`
44
44
 
45
45
  The user identity.
46
+
47
+ ***
48
+
49
+ ### organization
50
+
51
+ > **organization**: `string`
52
+
53
+ The users organization.
@@ -30,19 +30,33 @@ The dependencies for the identity connector.
30
30
 
31
31
  ### CLASS\_NAME
32
32
 
33
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
35
  Runtime name for the class.
36
36
 
37
+ ## Methods
38
+
39
+ ### className()
40
+
41
+ > **className**(): `string`
42
+
43
+ Returns the class name of the component.
44
+
45
+ #### Returns
46
+
47
+ `string`
48
+
49
+ The class name of the component.
50
+
37
51
  #### Implementation of
38
52
 
39
- `IAuthenticationAdminComponent.CLASS_NAME`
53
+ `IAuthenticationAdminComponent.className`
40
54
 
41
- ## Methods
55
+ ***
42
56
 
43
57
  ### create()
44
58
 
45
- > **create**(`email`, `password`, `identity`): `Promise`\<`void`\>
59
+ > **create**(`email`, `password`, `userIdentity`, `organizationIdentity`): `Promise`\<`void`\>
46
60
 
47
61
  Create a login for the user.
48
62
 
@@ -60,12 +74,18 @@ The email address for the user.
60
74
 
61
75
  The password for the user.
62
76
 
63
- ##### identity
77
+ ##### userIdentity
64
78
 
65
79
  `string`
66
80
 
67
81
  The DID to associate with the account.
68
82
 
83
+ ##### organizationIdentity
84
+
85
+ `string`
86
+
87
+ The organization of the user.
88
+
69
89
  #### Returns
70
90
 
71
91
  `Promise`\<`void`\>
@@ -30,30 +30,38 @@ The dependencies for the identity connector.
30
30
 
31
31
  ### CLASS\_NAME
32
32
 
33
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
35
  Runtime name for the class.
36
36
 
37
+ ## Methods
38
+
39
+ ### className()
40
+
41
+ > **className**(): `string`
42
+
43
+ Returns the class name of the component.
44
+
45
+ #### Returns
46
+
47
+ `string`
48
+
49
+ The class name of the component.
50
+
37
51
  #### Implementation of
38
52
 
39
- `IAuthenticationComponent.CLASS_NAME`
53
+ `IAuthenticationComponent.className`
40
54
 
41
- ## Methods
55
+ ***
42
56
 
43
57
  ### start()
44
58
 
45
- > **start**(`nodeIdentity`, `nodeLoggingComponentType?`): `Promise`\<`void`\>
59
+ > **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
46
60
 
47
61
  The service needs to be started when the application is initialized.
48
62
 
49
63
  #### Parameters
50
64
 
51
- ##### nodeIdentity
52
-
53
- `string`
54
-
55
- The identity of the node.
56
-
57
65
  ##### nodeLoggingComponentType?
58
66
 
59
67
  `string`
@@ -12,6 +12,14 @@ Helper class for password operations.
12
12
 
13
13
  `PasswordHelper`
14
14
 
15
+ ## Properties
16
+
17
+ ### CLASS\_NAME
18
+
19
+ > `readonly` `static` **CLASS\_NAME**: `string`
20
+
21
+ Runtime name for the class.
22
+
15
23
  ## Methods
16
24
 
17
25
  ### hashPassword()
@@ -12,11 +12,19 @@ Helper class for token operations.
12
12
 
13
13
  `TokenHelper`
14
14
 
15
+ ## Properties
16
+
17
+ ### CLASS\_NAME
18
+
19
+ > `readonly` `static` **CLASS\_NAME**: `string`
20
+
21
+ Runtime name for the class.
22
+
15
23
  ## Methods
16
24
 
17
25
  ### createToken()
18
26
 
19
- > `static` **createToken**(`vaultConnector`, `signingKeyName`, `subject`, `ttlMinutes`): `Promise`\<\{ `token`: `string`; `expiry`: `number`; \}\>
27
+ > `static` **createToken**(`vaultConnector`, `signingKeyName`, `userIdentity`, `organizationIdentity`, `ttlMinutes`): `Promise`\<\{ `token`: `string`; `expiry`: `number`; \}\>
20
28
 
21
29
  Create a new token.
22
30
 
@@ -34,12 +42,18 @@ The vault connector.
34
42
 
35
43
  The signing key name.
36
44
 
37
- ##### subject
45
+ ##### userIdentity
38
46
 
39
47
  `string`
40
48
 
41
49
  The subject for the token.
42
50
 
51
+ ##### organizationIdentity
52
+
53
+ The organization for the token.
54
+
55
+ `string` | `undefined`
56
+
43
57
  ##### ttlMinutes
44
58
 
45
59
  `number`
@@ -56,7 +70,7 @@ The new token and its expiry date.
56
70
 
57
71
  ### verify()
58
72
 
59
- > `static` **verify**(`vaultConnector`, `signingKeyName`, `token`): `Promise`\<\{ `header`: `IJwtHeader`; `payload`: `IJwtPayload`; \}\>
73
+ > `static` **verify**(`vaultConnector`, `signingKeyName`, `token`): `Promise`\<\{ `header`: `JWTHeaderParameters`; `payload`: `JWTPayload`; \}\>
60
74
 
61
75
  Verify the token.
62
76
 
@@ -78,11 +92,11 @@ The signing key name.
78
92
 
79
93
  The token to verify.
80
94
 
81
- `undefined` | `string`
95
+ `string` | `undefined`
82
96
 
83
97
  #### Returns
84
98
 
85
- `Promise`\<\{ `header`: `IJwtHeader`; `payload`: `IJwtPayload`; \}\>
99
+ `Promise`\<\{ `header`: `JWTHeaderParameters`; `payload`: `JWTPayload`; \}\>
86
100
 
87
101
  The verified details.
88
102
 
@@ -94,7 +108,7 @@ UnauthorizedError if the token is missing, invalid or expired.
94
108
 
95
109
  ### extractTokenFromHeaders()
96
110
 
97
- > `static` **extractTokenFromHeaders**(`headers?`, `cookieName?`): `undefined` \| \{ `token`: `string`; `location`: `"authorization"` \| `"cookie"`; \}
111
+ > `static` **extractTokenFromHeaders**(`headers?`, `cookieName?`): \{ `token`: `string`; `location`: `"authorization"` \| `"cookie"`; \} \| `undefined`
98
112
 
99
113
  Extract the auth token from the headers, either from the authorization header or the cookie header.
100
114
 
@@ -114,6 +128,6 @@ The name of the cookie to extract the token from.
114
128
 
115
129
  #### Returns
116
130
 
117
- `undefined` \| \{ `token`: `string`; `location`: `"authorization"` \| `"cookie"`; \}
131
+ \{ `token`: `string`; `location`: `"authorization"` \| `"cookie"`; \} \| `undefined`
118
132
 
119
133
  The token if found.
package/locales/en.json CHANGED
@@ -2,25 +2,22 @@
2
2
  "error": {
3
3
  "entityStorageAuthenticationService": {
4
4
  "loginFailed": "Login failed",
5
- "refreshFailed": "Refresh failed",
6
5
  "userNotFound": "The user with the specified e-mail could not be found",
7
6
  "passwordMismatch": "The password does not match the user's password"
8
7
  },
9
8
  "entityStorageAuthenticationAdminService": {
10
9
  "userExists": "The user with the specified e-mail already exists",
11
- "createFailed": "Creating the user failed",
12
- "removeFailed": "Removing the user failed",
10
+ "createUserFailed": "Creating the user failed",
11
+ "removeUserFailed": "Removing the user failed",
13
12
  "updatePasswordFailed": "Updating the user's password failed",
14
13
  "passwordTooShort": "The password is too short, it must be at least {minLength} characters long",
15
14
  "userNotFound": "The user with the specified e-mail could not be found \"{notFoundId}\"",
16
15
  "currentPasswordMismatch": "The current password is incorrect"
17
16
  },
18
- "entityStorageAuthenticationProcessor": {
19
- "initializeFailed": "The JSON Web token authentication processor could not be initialized"
20
- },
21
17
  "tokenHelper": {
22
18
  "missing": "The JSON Web token could not be found in the authorization header",
23
19
  "payloadMissingSubject": "The JSON Web token payload does not contain a subject",
20
+ "payloadMissingOrganization": "The JSON Web token payload does not contain an organization",
24
21
  "expired": "The JSON Web token has expired"
25
22
  }
26
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-auth-entity-storage-service",
3
- "version": "0.0.2-next.8",
3
+ "version": "0.0.3-next.1",
4
4
  "description": "Auth Entity Storage contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,9 +14,10 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-auth-entity-storage-models": "0.0.2-next.8",
18
- "@twin.org/api-core": "0.0.2-next.8",
19
- "@twin.org/api-models": "0.0.2-next.8",
17
+ "@twin.org/api-auth-entity-storage-models": "0.0.3-next.1",
18
+ "@twin.org/api-core": "0.0.3-next.1",
19
+ "@twin.org/api-models": "0.0.3-next.1",
20
+ "@twin.org/context": "next",
20
21
  "@twin.org/core": "next",
21
22
  "@twin.org/crypto": "next",
22
23
  "@twin.org/entity": "next",
@@ -26,21 +27,38 @@
26
27
  "@twin.org/vault-models": "next",
27
28
  "@twin.org/web": "next"
28
29
  },
29
- "main": "./dist/cjs/index.cjs",
30
- "module": "./dist/esm/index.mjs",
30
+ "main": "./dist/es/index.js",
31
31
  "types": "./dist/types/index.d.ts",
32
32
  "exports": {
33
33
  ".": {
34
34
  "types": "./dist/types/index.d.ts",
35
- "require": "./dist/cjs/index.cjs",
36
- "import": "./dist/esm/index.mjs"
35
+ "import": "./dist/es/index.js",
36
+ "default": "./dist/es/index.js"
37
37
  }
38
38
  },
39
39
  "files": [
40
- "dist/cjs",
41
- "dist/esm",
40
+ "dist/es",
42
41
  "dist/types",
43
42
  "locales",
44
43
  "docs"
45
- ]
44
+ ],
45
+ "keywords": [
46
+ "twin",
47
+ "trade",
48
+ "iota",
49
+ "framework",
50
+ "blockchain",
51
+ "api",
52
+ "entity",
53
+ "storage",
54
+ "persistence",
55
+ "database",
56
+ "service",
57
+ "microservice",
58
+ "business-logic"
59
+ ],
60
+ "bugs": {
61
+ "url": "git+https://github.com/twinfoundation/api/issues"
62
+ },
63
+ "homepage": "https://twindev.org"
46
64
  }