@twin.org/api-auth-entity-storage-models 0.0.3-next.21 → 0.0.3-next.23

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 (55) hide show
  1. package/dist/es/index.js +9 -1
  2. package/dist/es/index.js.map +1 -1
  3. package/dist/es/models/IAuthenticationAuditComponent.js +2 -0
  4. package/dist/es/models/IAuthenticationAuditComponent.js.map +1 -0
  5. package/dist/es/models/IAuthenticationAuditEntry.js +2 -0
  6. package/dist/es/models/IAuthenticationAuditEntry.js.map +1 -0
  7. package/dist/es/models/IAuthenticationRateActionConfig.js +4 -0
  8. package/dist/es/models/IAuthenticationRateActionConfig.js.map +1 -0
  9. package/dist/es/models/IAuthenticationRateComponent.js +2 -0
  10. package/dist/es/models/IAuthenticationRateComponent.js.map +1 -0
  11. package/dist/es/models/api/IAuditCreateRequest.js +2 -0
  12. package/dist/es/models/api/IAuditCreateRequest.js.map +1 -0
  13. package/dist/es/models/api/IAuditQueryRequest.js +2 -0
  14. package/dist/es/models/api/IAuditQueryRequest.js.map +1 -0
  15. package/dist/es/models/api/IAuditQueryResponse.js +2 -0
  16. package/dist/es/models/api/IAuditQueryResponse.js.map +1 -0
  17. package/dist/es/models/authAuditEvent.js +49 -0
  18. package/dist/es/models/authAuditEvent.js.map +1 -0
  19. package/dist/types/index.d.ts +9 -1
  20. package/dist/types/models/IAuthenticationAuditComponent.d.ts +40 -0
  21. package/dist/types/models/IAuthenticationAuditEntry.d.ts +50 -0
  22. package/dist/types/models/IAuthenticationRateActionConfig.d.ts +13 -0
  23. package/dist/types/models/IAuthenticationRateComponent.d.ts +46 -0
  24. package/dist/types/models/api/IAuditCreateRequest.d.ts +10 -0
  25. package/dist/types/models/api/IAuditQueryRequest.d.ts +47 -0
  26. package/dist/types/models/api/IAuditQueryResponse.d.ts +19 -0
  27. package/dist/types/models/authAuditEvent.d.ts +49 -0
  28. package/docs/changelog.md +14 -0
  29. package/docs/reference/index.md +15 -0
  30. package/docs/reference/interfaces/IAdminUserCreateRequest.md +1 -1
  31. package/docs/reference/interfaces/IAdminUserGetByIdentityRequest.md +1 -1
  32. package/docs/reference/interfaces/IAdminUserGetRequest.md +1 -1
  33. package/docs/reference/interfaces/IAdminUserGetResponse.md +1 -1
  34. package/docs/reference/interfaces/IAdminUserRemoveRequest.md +1 -1
  35. package/docs/reference/interfaces/IAdminUserUpdatePasswordRequest.md +3 -3
  36. package/docs/reference/interfaces/IAdminUserUpdateRequest.md +2 -2
  37. package/docs/reference/interfaces/IAuditCreateRequest.md +11 -0
  38. package/docs/reference/interfaces/IAuditQueryRequest.md +65 -0
  39. package/docs/reference/interfaces/IAuditQueryResponse.md +23 -0
  40. package/docs/reference/interfaces/IAuthenticationAdminComponent.md +6 -6
  41. package/docs/reference/interfaces/IAuthenticationAuditComponent.md +103 -0
  42. package/docs/reference/interfaces/IAuthenticationAuditEntry.md +91 -0
  43. package/docs/reference/interfaces/IAuthenticationComponent.md +4 -4
  44. package/docs/reference/interfaces/IAuthenticationRateActionConfig.md +19 -0
  45. package/docs/reference/interfaces/IAuthenticationRateComponent.md +165 -0
  46. package/docs/reference/interfaces/IAuthenticationUser.md +6 -6
  47. package/docs/reference/interfaces/ILoginRequest.md +1 -1
  48. package/docs/reference/interfaces/ILoginResponse.md +4 -4
  49. package/docs/reference/interfaces/ILogoutRequest.md +3 -3
  50. package/docs/reference/interfaces/IRefreshTokenRequest.md +3 -3
  51. package/docs/reference/interfaces/IRefreshTokenResponse.md +4 -4
  52. package/docs/reference/interfaces/IUpdatePasswordRequest.md +1 -1
  53. package/docs/reference/type-aliases/AuthAuditEvent.md +5 -0
  54. package/docs/reference/variables/AuthAuditEvent.md +67 -0
  55. package/package.json +1 -1
package/dist/es/index.js CHANGED
@@ -1,19 +1,27 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  export * from "./models/api/IAdminUserCreateRequest.js";
4
- export * from "./models/api/IAdminUserGetRequest.js";
5
4
  export * from "./models/api/IAdminUserGetByIdentityRequest.js";
5
+ export * from "./models/api/IAdminUserGetRequest.js";
6
6
  export * from "./models/api/IAdminUserGetResponse.js";
7
7
  export * from "./models/api/IAdminUserRemoveRequest.js";
8
8
  export * from "./models/api/IAdminUserUpdatePasswordRequest.js";
9
9
  export * from "./models/api/IAdminUserUpdateRequest.js";
10
+ export * from "./models/api/IAuditCreateRequest.js";
11
+ export * from "./models/api/IAuditQueryRequest.js";
12
+ export * from "./models/api/IAuditQueryResponse.js";
10
13
  export * from "./models/api/ILoginRequest.js";
11
14
  export * from "./models/api/ILoginResponse.js";
12
15
  export * from "./models/api/ILogoutRequest.js";
13
16
  export * from "./models/api/IRefreshTokenRequest.js";
14
17
  export * from "./models/api/IRefreshTokenResponse.js";
15
18
  export * from "./models/api/IUpdatePasswordRequest.js";
19
+ export * from "./models/authAuditEvent.js";
16
20
  export * from "./models/IAuthenticationAdminComponent.js";
21
+ export * from "./models/IAuthenticationAuditComponent.js";
22
+ export * from "./models/IAuthenticationAuditEntry.js";
17
23
  export * from "./models/IAuthenticationComponent.js";
24
+ export * from "./models/IAuthenticationRateActionConfig.js";
25
+ export * from "./models/IAuthenticationRateComponent.js";
18
26
  export * from "./models/IAuthenticationUser.js";
19
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,iDAAiD,CAAC;AAChE,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./models/api/IAdminUserCreateRequest.js\";\nexport * from \"./models/api/IAdminUserGetRequest.js\";\nexport * from \"./models/api/IAdminUserGetByIdentityRequest.js\";\nexport * from \"./models/api/IAdminUserGetResponse.js\";\nexport * from \"./models/api/IAdminUserRemoveRequest.js\";\nexport * from \"./models/api/IAdminUserUpdatePasswordRequest.js\";\nexport * from \"./models/api/IAdminUserUpdateRequest.js\";\nexport * from \"./models/api/ILoginRequest.js\";\nexport * from \"./models/api/ILoginResponse.js\";\nexport * from \"./models/api/ILogoutRequest.js\";\nexport * from \"./models/api/IRefreshTokenRequest.js\";\nexport * from \"./models/api/IRefreshTokenResponse.js\";\nexport * from \"./models/api/IUpdatePasswordRequest.js\";\nexport * from \"./models/IAuthenticationAdminComponent.js\";\nexport * from \"./models/IAuthenticationComponent.js\";\nexport * from \"./models/IAuthenticationUser.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,iDAAiD,CAAC;AAChE,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./models/api/IAdminUserCreateRequest.js\";\nexport * from \"./models/api/IAdminUserGetByIdentityRequest.js\";\nexport * from \"./models/api/IAdminUserGetRequest.js\";\nexport * from \"./models/api/IAdminUserGetResponse.js\";\nexport * from \"./models/api/IAdminUserRemoveRequest.js\";\nexport * from \"./models/api/IAdminUserUpdatePasswordRequest.js\";\nexport * from \"./models/api/IAdminUserUpdateRequest.js\";\nexport * from \"./models/api/IAuditCreateRequest.js\";\nexport * from \"./models/api/IAuditQueryRequest.js\";\nexport * from \"./models/api/IAuditQueryResponse.js\";\nexport * from \"./models/api/ILoginRequest.js\";\nexport * from \"./models/api/ILoginResponse.js\";\nexport * from \"./models/api/ILogoutRequest.js\";\nexport * from \"./models/api/IRefreshTokenRequest.js\";\nexport * from \"./models/api/IRefreshTokenResponse.js\";\nexport * from \"./models/api/IUpdatePasswordRequest.js\";\nexport * from \"./models/authAuditEvent.js\";\nexport * from \"./models/IAuthenticationAdminComponent.js\";\nexport * from \"./models/IAuthenticationAuditComponent.js\";\nexport * from \"./models/IAuthenticationAuditEntry.js\";\nexport * from \"./models/IAuthenticationComponent.js\";\nexport * from \"./models/IAuthenticationRateActionConfig.js\";\nexport * from \"./models/IAuthenticationRateComponent.js\";\nexport * from \"./models/IAuthenticationUser.js\";\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAuthenticationAuditComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAuthenticationAuditComponent.js","sourceRoot":"","sources":["../../../src/models/IAuthenticationAuditComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { AuthAuditEvent } from \"./authAuditEvent.js\";\nimport type { IAuthenticationAuditEntry } from \"./IAuthenticationAuditEntry.js\";\n\n/**\n * Contract definition for authentication audit component.\n */\nexport interface IAuthenticationAuditComponent extends IComponent {\n\t/**\n\t * Create a new audit entry.\n\t * @param entry The audit entry to be logged.\n\t * @returns The unique identifier of the created audit entry.\n\t */\n\tcreate(entry: Omit<IAuthenticationAuditEntry, \"id\" | \"dateCreated\">): Promise<string>;\n\n\t/**\n\t * Query the audit entries.\n\t * @param options The query options.\n\t * @param options.actorId The actor identifier to filter the audit entries, optional.\n\t * @param options.organizationId The organization identifier to filter the audit entries, optional.\n\t * @param options.tenantId The tenant identifier to filter the audit entries, optional.\n\t * @param options.nodeId The node identifier to filter the audit entries, optional.\n\t * @param options.event The audit event to filter the audit entries, optional.\n\t * @param options.startDate The start date to filter the audit entries, optional.\n\t * @param options.endDate The end date to filter the audit entries, optional.\n\t * @param cursor The cursor for pagination.\n\t * @param limit The maximum number of entries to return.\n\t * @returns The audit entries.\n\t */\n\tquery(\n\t\toptions?: {\n\t\t\tactorId?: string;\n\t\t\torganizationId?: string;\n\t\t\ttenantId?: string;\n\t\t\tnodeId?: string;\n\t\t\tevent?: AuthAuditEvent | string;\n\t\t\tstartDate?: string;\n\t\t\tendDate?: string;\n\t\t},\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\tentries: IAuthenticationAuditEntry[];\n\t\tcursor?: string;\n\t}>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAuthenticationAuditEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAuthenticationAuditEntry.js","sourceRoot":"","sources":["../../../src/models/IAuthenticationAuditEntry.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { AuthAuditEvent } from \"./authAuditEvent.js\";\n\n/**\n * Contract definition for authentication audit entry.\n */\nexport interface IAuthenticationAuditEntry {\n\t/**\n\t * The unique identifier for the audit entry.\n\t */\n\tid: string;\n\n\t/**\n\t * The audit event that occurred.\n\t */\n\tevent: AuthAuditEvent | string;\n\n\t/**\n\t * The timestamp of the audit entry in ISO 8601 format.\n\t */\n\tdateCreated: string;\n\n\t/**\n\t * The actor identifier, could be e-mail, username, or other unique identifier.\n\t */\n\tactorId?: string;\n\n\t/**\n\t * The node identifier associated with the audit entry, if applicable.\n\t */\n\tnodeId?: string;\n\n\t/**\n\t * The organization identifier associated with the audit entry, if applicable.\n\t */\n\torganizationId?: string;\n\n\t/**\n\t * The tenant identifier associated with the audit entry, if applicable.\n\t */\n\ttenantId?: string;\n\n\t/**\n\t * The hashed IP addresses of the client.\n\t */\n\tipAddressHashes?: string[];\n\n\t/**\n\t * The user agent string of the client.\n\t */\n\tuserAgent?: string;\n\n\t/**\n\t * The correlation ID for request tracing.\n\t */\n\tcorrelationId?: string;\n\n\t/**\n\t * Additional data related to the audit entry, such as IP address, user agent, etc.\n\t */\n\tdata?: unknown;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2026 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IAuthenticationRateActionConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAuthenticationRateActionConfig.js","sourceRoot":"","sources":["../../../src/models/IAuthenticationRateActionConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Configuration for an authentication rate limited action.\n */\nexport interface IAuthenticationRateActionConfig {\n\t/**\n\t * Maximum number of failed attempts allowed per window.\n\t */\n\tmaxAttempts: number;\n\n\t/**\n\t * Rate limit window duration in minutes.\n\t */\n\twindowMinutes: number;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAuthenticationRateComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAuthenticationRateComponent.js","sourceRoot":"","sources":["../../../src/models/IAuthenticationRateComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IAuthenticationRateActionConfig } from \"./IAuthenticationRateActionConfig.js\";\n\n/**\n * Contract definition for authentication rate component.\n */\nexport interface IAuthenticationRateComponent extends IComponent {\n\t/**\n\t * The service needs to be started when the application is initialized.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns Nothing.\n\t */\n\tstart(nodeLoggingComponentType?: string): Promise<void>;\n\n\t/**\n\t * The component needs to be stopped when the node is closed.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns Nothing.\n\t */\n\tstop(nodeLoggingComponentType?: string): Promise<void>;\n\n\t/**\n\t * Register or update rate-limit configuration for an action.\n\t * @param action The action name.\n\t * @param config The action configuration.\n\t * @returns Nothing.\n\t */\n\tregisterAction(action: string, config: IAuthenticationRateActionConfig): Promise<void>;\n\n\t/**\n\t * Unregister rate-limit configuration for an action.\n\t * @param action The action name.\n\t * @returns Nothing.\n\t */\n\tunregisterAction(action: string): Promise<void>;\n\n\t/**\n\t * Check the authentication rate for a given action and identifier.\n\t * @param action The action to be checked.\n\t * @param identifier The identifier to be checked.\n\t * @returns The result of the rate check.\n\t */\n\tcheck(action: string, identifier: string): Promise<string>;\n\n\t/**\n\t * Clear the authentication rate entry for the given action and identifier.\n\t * @param action The action to clear.\n\t * @param identifier The identifier to clear.\n\t * @returns Nothing.\n\t */\n\tclear(action: string, identifier: string): Promise<void>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAuditCreateRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAuditCreateRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAuditCreateRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IAuthenticationAuditEntry } from \"../IAuthenticationAuditEntry.js\";\n\n/**\n * Create an authentication audit entry.\n */\nexport interface IAuditCreateRequest {\n\t/**\n\t * The body of the request.\n\t */\n\tbody: Omit<IAuthenticationAuditEntry, \"id\" | \"dateCreated\">;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAuditQueryRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAuditQueryRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAuditQueryRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { AuthAuditEvent } from \"../authAuditEvent.js\";\n\n/**\n * Query authentication audit entries.\n */\nexport interface IAuditQueryRequest {\n\t/**\n\t * The query parameters for the request.\n\t */\n\tquery?: {\n\t\t/**\n\t\t * The actor identifier to filter by.\n\t\t */\n\t\tactorId?: string;\n\n\t\t/**\n\t\t * The organization identifier to filter by.\n\t\t */\n\t\torganizationId?: string;\n\n\t\t/**\n\t\t * The tenant identifier to filter by.\n\t\t */\n\t\ttenantId?: string;\n\n\t\t/**\n\t\t * The node identifier to filter by.\n\t\t */\n\t\tnodeId?: string;\n\n\t\t/**\n\t\t * The event to filter by.\n\t\t */\n\t\tevent?: AuthAuditEvent | string;\n\n\t\t/**\n\t\t * The inclusive start date for filtering, in ISO 8601 format.\n\t\t */\n\t\tstartDate?: string;\n\n\t\t/**\n\t\t * The inclusive end date for filtering, in ISO 8601 format.\n\t\t */\n\t\tendDate?: string;\n\n\t\t/**\n\t\t * The pagination cursor.\n\t\t */\n\t\tcursor?: string;\n\n\t\t/**\n\t\t * The maximum number of results to return.\n\t\t */\n\t\tlimit?: string;\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAuditQueryResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAuditQueryResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IAuditQueryResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IAuthenticationAuditEntry } from \"../IAuthenticationAuditEntry.js\";\n\n/**\n * Response from querying authentication audit entries.\n */\nexport interface IAuditQueryResponse {\n\t/**\n\t * The response body.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The returned audit entries.\n\t\t */\n\t\tentries: IAuthenticationAuditEntry[];\n\n\t\t/**\n\t\t * The cursor to retrieve the next page, if any.\n\t\t */\n\t\tcursor?: string;\n\t};\n}\n"]}
@@ -0,0 +1,49 @@
1
+ // Copyright 2026 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * Supported authentication audit events.
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ export const AuthAuditEvent = {
8
+ /**
9
+ * Login success.
10
+ */
11
+ LoginSuccess: "login-success",
12
+ /**
13
+ * Login failure.
14
+ */
15
+ LoginFailure: "login-failure",
16
+ /**
17
+ * Logout.
18
+ */
19
+ Logout: "logout",
20
+ /**
21
+ * Token refreshed.
22
+ */
23
+ TokenRefreshed: "token-refreshed",
24
+ /**
25
+ * Account created.
26
+ */
27
+ AccountCreated: "account-created",
28
+ /**
29
+ * Account deleted.
30
+ */
31
+ AccountDeleted: "account-deleted",
32
+ /**
33
+ * Account updated.
34
+ */
35
+ AccountUpdated: "account-updated",
36
+ /**
37
+ * Account locked.
38
+ */
39
+ AccountLocked: "account-locked",
40
+ /**
41
+ * Account unlocked.
42
+ */
43
+ AccountUnlocked: "account-unlocked",
44
+ /**
45
+ * Password changed.
46
+ */
47
+ PasswordChanged: "password-changed"
48
+ };
49
+ //# sourceMappingURL=authAuditEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authAuditEvent.js","sourceRoot":"","sources":["../../../src/models/authAuditEvent.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B;;OAEG;IACH,YAAY,EAAE,eAAe;IAE7B;;OAEG;IACH,YAAY,EAAE,eAAe;IAE7B;;OAEG;IACH,MAAM,EAAE,QAAQ;IAEhB;;OAEG;IACH,cAAc,EAAE,iBAAiB;IAEjC;;OAEG;IACH,cAAc,EAAE,iBAAiB;IAEjC;;OAEG;IACH,cAAc,EAAE,iBAAiB;IAEjC;;OAEG;IACH,cAAc,EAAE,iBAAiB;IAEjC;;OAEG;IACH,aAAa,EAAE,gBAAgB;IAE/B;;OAEG;IACH,eAAe,EAAE,kBAAkB;IAEnC;;OAEG;IACH,eAAe,EAAE,kBAAkB;CAC1B,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Supported authentication audit events.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const AuthAuditEvent = {\n\t/**\n\t * Login success.\n\t */\n\tLoginSuccess: \"login-success\",\n\n\t/**\n\t * Login failure.\n\t */\n\tLoginFailure: \"login-failure\",\n\n\t/**\n\t * Logout.\n\t */\n\tLogout: \"logout\",\n\n\t/**\n\t * Token refreshed.\n\t */\n\tTokenRefreshed: \"token-refreshed\",\n\n\t/**\n\t * Account created.\n\t */\n\tAccountCreated: \"account-created\",\n\n\t/**\n\t * Account deleted.\n\t */\n\tAccountDeleted: \"account-deleted\",\n\n\t/**\n\t * Account updated.\n\t */\n\tAccountUpdated: \"account-updated\",\n\n\t/**\n\t * Account locked.\n\t */\n\tAccountLocked: \"account-locked\",\n\n\t/**\n\t * Account unlocked.\n\t */\n\tAccountUnlocked: \"account-unlocked\",\n\n\t/**\n\t * Password changed.\n\t */\n\tPasswordChanged: \"password-changed\"\n} as const;\n\n/**\n * Supported authentication audit event values.\n */\nexport type AuthAuditEvent = (typeof AuthAuditEvent)[keyof typeof AuthAuditEvent];\n"]}
@@ -1,16 +1,24 @@
1
1
  export * from "./models/api/IAdminUserCreateRequest.js";
2
- export * from "./models/api/IAdminUserGetRequest.js";
3
2
  export * from "./models/api/IAdminUserGetByIdentityRequest.js";
3
+ export * from "./models/api/IAdminUserGetRequest.js";
4
4
  export * from "./models/api/IAdminUserGetResponse.js";
5
5
  export * from "./models/api/IAdminUserRemoveRequest.js";
6
6
  export * from "./models/api/IAdminUserUpdatePasswordRequest.js";
7
7
  export * from "./models/api/IAdminUserUpdateRequest.js";
8
+ export * from "./models/api/IAuditCreateRequest.js";
9
+ export * from "./models/api/IAuditQueryRequest.js";
10
+ export * from "./models/api/IAuditQueryResponse.js";
8
11
  export * from "./models/api/ILoginRequest.js";
9
12
  export * from "./models/api/ILoginResponse.js";
10
13
  export * from "./models/api/ILogoutRequest.js";
11
14
  export * from "./models/api/IRefreshTokenRequest.js";
12
15
  export * from "./models/api/IRefreshTokenResponse.js";
13
16
  export * from "./models/api/IUpdatePasswordRequest.js";
17
+ export * from "./models/authAuditEvent.js";
14
18
  export * from "./models/IAuthenticationAdminComponent.js";
19
+ export * from "./models/IAuthenticationAuditComponent.js";
20
+ export * from "./models/IAuthenticationAuditEntry.js";
15
21
  export * from "./models/IAuthenticationComponent.js";
22
+ export * from "./models/IAuthenticationRateActionConfig.js";
23
+ export * from "./models/IAuthenticationRateComponent.js";
16
24
  export * from "./models/IAuthenticationUser.js";
@@ -0,0 +1,40 @@
1
+ import type { IComponent } from "@twin.org/core";
2
+ import type { AuthAuditEvent } from "./authAuditEvent.js";
3
+ import type { IAuthenticationAuditEntry } from "./IAuthenticationAuditEntry.js";
4
+ /**
5
+ * Contract definition for authentication audit component.
6
+ */
7
+ export interface IAuthenticationAuditComponent extends IComponent {
8
+ /**
9
+ * Create a new audit entry.
10
+ * @param entry The audit entry to be logged.
11
+ * @returns The unique identifier of the created audit entry.
12
+ */
13
+ create(entry: Omit<IAuthenticationAuditEntry, "id" | "dateCreated">): Promise<string>;
14
+ /**
15
+ * Query the audit entries.
16
+ * @param options The query options.
17
+ * @param options.actorId The actor identifier to filter the audit entries, optional.
18
+ * @param options.organizationId The organization identifier to filter the audit entries, optional.
19
+ * @param options.tenantId The tenant identifier to filter the audit entries, optional.
20
+ * @param options.nodeId The node identifier to filter the audit entries, optional.
21
+ * @param options.event The audit event to filter the audit entries, optional.
22
+ * @param options.startDate The start date to filter the audit entries, optional.
23
+ * @param options.endDate The end date to filter the audit entries, optional.
24
+ * @param cursor The cursor for pagination.
25
+ * @param limit The maximum number of entries to return.
26
+ * @returns The audit entries.
27
+ */
28
+ query(options?: {
29
+ actorId?: string;
30
+ organizationId?: string;
31
+ tenantId?: string;
32
+ nodeId?: string;
33
+ event?: AuthAuditEvent | string;
34
+ startDate?: string;
35
+ endDate?: string;
36
+ }, cursor?: string, limit?: number): Promise<{
37
+ entries: IAuthenticationAuditEntry[];
38
+ cursor?: string;
39
+ }>;
40
+ }
@@ -0,0 +1,50 @@
1
+ import type { AuthAuditEvent } from "./authAuditEvent.js";
2
+ /**
3
+ * Contract definition for authentication audit entry.
4
+ */
5
+ export interface IAuthenticationAuditEntry {
6
+ /**
7
+ * The unique identifier for the audit entry.
8
+ */
9
+ id: string;
10
+ /**
11
+ * The audit event that occurred.
12
+ */
13
+ event: AuthAuditEvent | string;
14
+ /**
15
+ * The timestamp of the audit entry in ISO 8601 format.
16
+ */
17
+ dateCreated: string;
18
+ /**
19
+ * The actor identifier, could be e-mail, username, or other unique identifier.
20
+ */
21
+ actorId?: string;
22
+ /**
23
+ * The node identifier associated with the audit entry, if applicable.
24
+ */
25
+ nodeId?: string;
26
+ /**
27
+ * The organization identifier associated with the audit entry, if applicable.
28
+ */
29
+ organizationId?: string;
30
+ /**
31
+ * The tenant identifier associated with the audit entry, if applicable.
32
+ */
33
+ tenantId?: string;
34
+ /**
35
+ * The hashed IP addresses of the client.
36
+ */
37
+ ipAddressHashes?: string[];
38
+ /**
39
+ * The user agent string of the client.
40
+ */
41
+ userAgent?: string;
42
+ /**
43
+ * The correlation ID for request tracing.
44
+ */
45
+ correlationId?: string;
46
+ /**
47
+ * Additional data related to the audit entry, such as IP address, user agent, etc.
48
+ */
49
+ data?: unknown;
50
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Configuration for an authentication rate limited action.
3
+ */
4
+ export interface IAuthenticationRateActionConfig {
5
+ /**
6
+ * Maximum number of failed attempts allowed per window.
7
+ */
8
+ maxAttempts: number;
9
+ /**
10
+ * Rate limit window duration in minutes.
11
+ */
12
+ windowMinutes: number;
13
+ }
@@ -0,0 +1,46 @@
1
+ import type { IComponent } from "@twin.org/core";
2
+ import type { IAuthenticationRateActionConfig } from "./IAuthenticationRateActionConfig.js";
3
+ /**
4
+ * Contract definition for authentication rate component.
5
+ */
6
+ export interface IAuthenticationRateComponent extends IComponent {
7
+ /**
8
+ * The service needs to be started when the application is initialized.
9
+ * @param nodeLoggingComponentType The node logging component type.
10
+ * @returns Nothing.
11
+ */
12
+ start(nodeLoggingComponentType?: string): Promise<void>;
13
+ /**
14
+ * The component needs to be stopped when the node is closed.
15
+ * @param nodeLoggingComponentType The node logging component type.
16
+ * @returns Nothing.
17
+ */
18
+ stop(nodeLoggingComponentType?: string): Promise<void>;
19
+ /**
20
+ * Register or update rate-limit configuration for an action.
21
+ * @param action The action name.
22
+ * @param config The action configuration.
23
+ * @returns Nothing.
24
+ */
25
+ registerAction(action: string, config: IAuthenticationRateActionConfig): Promise<void>;
26
+ /**
27
+ * Unregister rate-limit configuration for an action.
28
+ * @param action The action name.
29
+ * @returns Nothing.
30
+ */
31
+ unregisterAction(action: string): Promise<void>;
32
+ /**
33
+ * Check the authentication rate for a given action and identifier.
34
+ * @param action The action to be checked.
35
+ * @param identifier The identifier to be checked.
36
+ * @returns The result of the rate check.
37
+ */
38
+ check(action: string, identifier: string): Promise<string>;
39
+ /**
40
+ * Clear the authentication rate entry for the given action and identifier.
41
+ * @param action The action to clear.
42
+ * @param identifier The identifier to clear.
43
+ * @returns Nothing.
44
+ */
45
+ clear(action: string, identifier: string): Promise<void>;
46
+ }
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticationAuditEntry } from "../IAuthenticationAuditEntry.js";
2
+ /**
3
+ * Create an authentication audit entry.
4
+ */
5
+ export interface IAuditCreateRequest {
6
+ /**
7
+ * The body of the request.
8
+ */
9
+ body: Omit<IAuthenticationAuditEntry, "id" | "dateCreated">;
10
+ }
@@ -0,0 +1,47 @@
1
+ import type { AuthAuditEvent } from "../authAuditEvent.js";
2
+ /**
3
+ * Query authentication audit entries.
4
+ */
5
+ export interface IAuditQueryRequest {
6
+ /**
7
+ * The query parameters for the request.
8
+ */
9
+ query?: {
10
+ /**
11
+ * The actor identifier to filter by.
12
+ */
13
+ actorId?: string;
14
+ /**
15
+ * The organization identifier to filter by.
16
+ */
17
+ organizationId?: string;
18
+ /**
19
+ * The tenant identifier to filter by.
20
+ */
21
+ tenantId?: string;
22
+ /**
23
+ * The node identifier to filter by.
24
+ */
25
+ nodeId?: string;
26
+ /**
27
+ * The event to filter by.
28
+ */
29
+ event?: AuthAuditEvent | string;
30
+ /**
31
+ * The inclusive start date for filtering, in ISO 8601 format.
32
+ */
33
+ startDate?: string;
34
+ /**
35
+ * The inclusive end date for filtering, in ISO 8601 format.
36
+ */
37
+ endDate?: string;
38
+ /**
39
+ * The pagination cursor.
40
+ */
41
+ cursor?: string;
42
+ /**
43
+ * The maximum number of results to return.
44
+ */
45
+ limit?: string;
46
+ };
47
+ }
@@ -0,0 +1,19 @@
1
+ import type { IAuthenticationAuditEntry } from "../IAuthenticationAuditEntry.js";
2
+ /**
3
+ * Response from querying authentication audit entries.
4
+ */
5
+ export interface IAuditQueryResponse {
6
+ /**
7
+ * The response body.
8
+ */
9
+ body: {
10
+ /**
11
+ * The returned audit entries.
12
+ */
13
+ entries: IAuthenticationAuditEntry[];
14
+ /**
15
+ * The cursor to retrieve the next page, if any.
16
+ */
17
+ cursor?: string;
18
+ };
19
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Supported authentication audit events.
3
+ */
4
+ export declare const AuthAuditEvent: {
5
+ /**
6
+ * Login success.
7
+ */
8
+ readonly LoginSuccess: "login-success";
9
+ /**
10
+ * Login failure.
11
+ */
12
+ readonly LoginFailure: "login-failure";
13
+ /**
14
+ * Logout.
15
+ */
16
+ readonly Logout: "logout";
17
+ /**
18
+ * Token refreshed.
19
+ */
20
+ readonly TokenRefreshed: "token-refreshed";
21
+ /**
22
+ * Account created.
23
+ */
24
+ readonly AccountCreated: "account-created";
25
+ /**
26
+ * Account deleted.
27
+ */
28
+ readonly AccountDeleted: "account-deleted";
29
+ /**
30
+ * Account updated.
31
+ */
32
+ readonly AccountUpdated: "account-updated";
33
+ /**
34
+ * Account locked.
35
+ */
36
+ readonly AccountLocked: "account-locked";
37
+ /**
38
+ * Account unlocked.
39
+ */
40
+ readonly AccountUnlocked: "account-unlocked";
41
+ /**
42
+ * Password changed.
43
+ */
44
+ readonly PasswordChanged: "password-changed";
45
+ };
46
+ /**
47
+ * Supported authentication audit event values.
48
+ */
49
+ export type AuthAuditEvent = (typeof AuthAuditEvent)[keyof typeof AuthAuditEvent];
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.23](https://github.com/twinfoundation/api/compare/api-auth-entity-storage-models-v0.0.3-next.22...api-auth-entity-storage-models-v0.0.3-next.23) (2026-04-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * auth enhancements ([#93](https://github.com/twinfoundation/api/issues/93)) ([921a50c](https://github.com/twinfoundation/api/commit/921a50cd89d26e530a6be6174a5a803060fa0eb6))
9
+
10
+ ## [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)
11
+
12
+
13
+ ### Miscellaneous Chores
14
+
15
+ * **api-auth-entity-storage-models:** Synchronize repo versions
16
+
3
17
  ## [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
18
 
5
19
 
@@ -3,7 +3,11 @@
3
3
  ## Interfaces
4
4
 
5
5
  - [IAuthenticationAdminComponent](interfaces/IAuthenticationAdminComponent.md)
6
+ - [IAuthenticationAuditComponent](interfaces/IAuthenticationAuditComponent.md)
7
+ - [IAuthenticationAuditEntry](interfaces/IAuthenticationAuditEntry.md)
6
8
  - [IAuthenticationComponent](interfaces/IAuthenticationComponent.md)
9
+ - [IAuthenticationRateActionConfig](interfaces/IAuthenticationRateActionConfig.md)
10
+ - [IAuthenticationRateComponent](interfaces/IAuthenticationRateComponent.md)
7
11
  - [IAuthenticationUser](interfaces/IAuthenticationUser.md)
8
12
  - [IAdminUserCreateRequest](interfaces/IAdminUserCreateRequest.md)
9
13
  - [IAdminUserGetByIdentityRequest](interfaces/IAdminUserGetByIdentityRequest.md)
@@ -12,9 +16,20 @@
12
16
  - [IAdminUserRemoveRequest](interfaces/IAdminUserRemoveRequest.md)
13
17
  - [IAdminUserUpdatePasswordRequest](interfaces/IAdminUserUpdatePasswordRequest.md)
14
18
  - [IAdminUserUpdateRequest](interfaces/IAdminUserUpdateRequest.md)
19
+ - [IAuditCreateRequest](interfaces/IAuditCreateRequest.md)
20
+ - [IAuditQueryRequest](interfaces/IAuditQueryRequest.md)
21
+ - [IAuditQueryResponse](interfaces/IAuditQueryResponse.md)
15
22
  - [ILoginRequest](interfaces/ILoginRequest.md)
16
23
  - [ILoginResponse](interfaces/ILoginResponse.md)
17
24
  - [ILogoutRequest](interfaces/ILogoutRequest.md)
18
25
  - [IRefreshTokenRequest](interfaces/IRefreshTokenRequest.md)
19
26
  - [IRefreshTokenResponse](interfaces/IRefreshTokenResponse.md)
20
27
  - [IUpdatePasswordRequest](interfaces/IUpdatePasswordRequest.md)
28
+
29
+ ## Type Aliases
30
+
31
+ - [AuthAuditEvent](type-aliases/AuthAuditEvent.md)
32
+
33
+ ## Variables
34
+
35
+ - [AuthAuditEvent](variables/AuthAuditEvent.md)
@@ -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
 
@@ -0,0 +1,11 @@
1
+ # Interface: IAuditCreateRequest
2
+
3
+ Create an authentication audit entry.
4
+
5
+ ## Properties
6
+
7
+ ### body {#body}
8
+
9
+ > **body**: `Omit`\<[`IAuthenticationAuditEntry`](IAuthenticationAuditEntry.md), `"id"` \| `"dateCreated"`\>
10
+
11
+ The body of the request.