@3sixty/api-auth-models 0.0.0-stage → 0.20.0-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.
- package/LICENSE +201 -0
- package/README.md +24 -2
- package/dist/es/index.js +15 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IAuthenticationAuditComponent.js +2 -0
- package/dist/es/models/IAuthenticationAuditComponent.js.map +1 -0
- package/dist/es/models/IAuthenticationAuditEntry.js +2 -0
- package/dist/es/models/IAuthenticationAuditEntry.js.map +1 -0
- package/dist/es/models/IAuthenticationRateActionConfig.js +4 -0
- package/dist/es/models/IAuthenticationRateActionConfig.js.map +1 -0
- package/dist/es/models/IAuthenticationRateComponent.js +2 -0
- package/dist/es/models/IAuthenticationRateComponent.js.map +1 -0
- package/dist/es/models/api/IAuditCreateRequest.js +2 -0
- package/dist/es/models/api/IAuditCreateRequest.js.map +1 -0
- package/dist/es/models/api/IAuditGetRequest.js +4 -0
- package/dist/es/models/api/IAuditGetRequest.js.map +1 -0
- package/dist/es/models/api/IAuditGetResponse.js +2 -0
- package/dist/es/models/api/IAuditGetResponse.js.map +1 -0
- package/dist/es/models/api/IAuditQueryRequest.js +2 -0
- package/dist/es/models/api/IAuditQueryRequest.js.map +1 -0
- package/dist/es/models/api/IAuditQueryResponse.js +2 -0
- package/dist/es/models/api/IAuditQueryResponse.js.map +1 -0
- package/dist/es/models/api/IAuditRemoveRequest.js +4 -0
- package/dist/es/models/api/IAuditRemoveRequest.js.map +1 -0
- package/dist/es/models/api/IAuditUpdateRequest.js +2 -0
- package/dist/es/models/api/IAuditUpdateRequest.js.map +1 -0
- package/dist/es/models/authAuditEvent.js +49 -0
- package/dist/es/models/authAuditEvent.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/models/IAuthenticationAuditComponent.d.ts +59 -0
- package/dist/types/models/IAuthenticationAuditEntry.d.ts +50 -0
- package/dist/types/models/IAuthenticationRateActionConfig.d.ts +13 -0
- package/dist/types/models/IAuthenticationRateComponent.d.ts +46 -0
- package/dist/types/models/api/IAuditCreateRequest.d.ts +10 -0
- package/dist/types/models/api/IAuditGetRequest.d.ts +14 -0
- package/dist/types/models/api/IAuditGetResponse.d.ts +10 -0
- package/dist/types/models/api/IAuditQueryRequest.d.ts +47 -0
- package/dist/types/models/api/IAuditQueryResponse.d.ts +19 -0
- package/dist/types/models/api/IAuditRemoveRequest.d.ts +14 -0
- package/dist/types/models/api/IAuditUpdateRequest.d.ts +19 -0
- package/dist/types/models/authAuditEvent.d.ts +49 -0
- package/docs/changelog.md +10 -0
- package/docs/examples.md +60 -0
- package/docs/reference/index.md +23 -0
- package/docs/reference/interfaces/IAuditCreateRequest.md +11 -0
- package/docs/reference/interfaces/IAuditGetRequest.md +17 -0
- package/docs/reference/interfaces/IAuditGetResponse.md +11 -0
- package/docs/reference/interfaces/IAuditQueryRequest.md +65 -0
- package/docs/reference/interfaces/IAuditQueryResponse.md +23 -0
- package/docs/reference/interfaces/IAuditRemoveRequest.md +17 -0
- package/docs/reference/interfaces/IAuditUpdateRequest.md +25 -0
- package/docs/reference/interfaces/IAuthenticationAuditComponent.md +175 -0
- package/docs/reference/interfaces/IAuthenticationAuditEntry.md +91 -0
- package/docs/reference/interfaces/IAuthenticationRateActionConfig.md +19 -0
- package/docs/reference/interfaces/IAuthenticationRateComponent.md +165 -0
- package/docs/reference/type-aliases/AuthAuditEvent.md +5 -0
- package/docs/reference/variables/AuthAuditEvent.md +67 -0
- package/locales/en.json +1 -0
- package/package.json +52 -5
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Interface: IAuthenticationRateActionConfig
|
|
2
|
+
|
|
3
|
+
Configuration for an authentication rate limited action.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### maxAttempts {#maxattempts}
|
|
8
|
+
|
|
9
|
+
> **maxAttempts**: `number`
|
|
10
|
+
|
|
11
|
+
Maximum number of failed attempts allowed per window.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### windowMinutes {#windowminutes}
|
|
16
|
+
|
|
17
|
+
> **windowMinutes**: `number`
|
|
18
|
+
|
|
19
|
+
Rate limit window duration in minutes.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Interface: IAuthenticationRateComponent
|
|
2
|
+
|
|
3
|
+
Contract definition for authentication rate component.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### start() {#start}
|
|
12
|
+
|
|
13
|
+
> **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
14
|
+
|
|
15
|
+
The service needs to be started when the application is initialized.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### nodeLoggingComponentType?
|
|
20
|
+
|
|
21
|
+
`string`
|
|
22
|
+
|
|
23
|
+
The node logging component type.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`Promise`\<`void`\>
|
|
28
|
+
|
|
29
|
+
A promise that resolves when the service has been started.
|
|
30
|
+
|
|
31
|
+
#### Overrides
|
|
32
|
+
|
|
33
|
+
`IComponent.start`
|
|
34
|
+
|
|
35
|
+
***
|
|
36
|
+
|
|
37
|
+
### stop() {#stop}
|
|
38
|
+
|
|
39
|
+
> **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
40
|
+
|
|
41
|
+
The component needs to be stopped when the node is closed.
|
|
42
|
+
|
|
43
|
+
#### Parameters
|
|
44
|
+
|
|
45
|
+
##### nodeLoggingComponentType?
|
|
46
|
+
|
|
47
|
+
`string`
|
|
48
|
+
|
|
49
|
+
The node logging component type.
|
|
50
|
+
|
|
51
|
+
#### Returns
|
|
52
|
+
|
|
53
|
+
`Promise`\<`void`\>
|
|
54
|
+
|
|
55
|
+
A promise that resolves when the service has been stopped.
|
|
56
|
+
|
|
57
|
+
#### Overrides
|
|
58
|
+
|
|
59
|
+
`IComponent.stop`
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### registerAction() {#registeraction}
|
|
64
|
+
|
|
65
|
+
> **registerAction**(`action`, `config`): `Promise`\<`void`\>
|
|
66
|
+
|
|
67
|
+
Register or update rate-limit configuration for an action.
|
|
68
|
+
|
|
69
|
+
#### Parameters
|
|
70
|
+
|
|
71
|
+
##### action
|
|
72
|
+
|
|
73
|
+
`string`
|
|
74
|
+
|
|
75
|
+
The action name.
|
|
76
|
+
|
|
77
|
+
##### config
|
|
78
|
+
|
|
79
|
+
[`IAuthenticationRateActionConfig`](IAuthenticationRateActionConfig.md)
|
|
80
|
+
|
|
81
|
+
The action configuration.
|
|
82
|
+
|
|
83
|
+
#### Returns
|
|
84
|
+
|
|
85
|
+
`Promise`\<`void`\>
|
|
86
|
+
|
|
87
|
+
A promise that resolves when the action configuration has been stored.
|
|
88
|
+
|
|
89
|
+
***
|
|
90
|
+
|
|
91
|
+
### unregisterAction() {#unregisteraction}
|
|
92
|
+
|
|
93
|
+
> **unregisterAction**(`action`): `Promise`\<`void`\>
|
|
94
|
+
|
|
95
|
+
Unregister rate-limit configuration for an action.
|
|
96
|
+
|
|
97
|
+
#### Parameters
|
|
98
|
+
|
|
99
|
+
##### action
|
|
100
|
+
|
|
101
|
+
`string`
|
|
102
|
+
|
|
103
|
+
The action name.
|
|
104
|
+
|
|
105
|
+
#### Returns
|
|
106
|
+
|
|
107
|
+
`Promise`\<`void`\>
|
|
108
|
+
|
|
109
|
+
A promise that resolves when the action configuration has been removed.
|
|
110
|
+
|
|
111
|
+
***
|
|
112
|
+
|
|
113
|
+
### check() {#check}
|
|
114
|
+
|
|
115
|
+
> **check**(`action`, `identifier`): `Promise`\<`string`\>
|
|
116
|
+
|
|
117
|
+
Check the authentication rate for a given action and identifier.
|
|
118
|
+
|
|
119
|
+
#### Parameters
|
|
120
|
+
|
|
121
|
+
##### action
|
|
122
|
+
|
|
123
|
+
`string`
|
|
124
|
+
|
|
125
|
+
The action to be checked.
|
|
126
|
+
|
|
127
|
+
##### identifier
|
|
128
|
+
|
|
129
|
+
`string`
|
|
130
|
+
|
|
131
|
+
The identifier to be checked.
|
|
132
|
+
|
|
133
|
+
#### Returns
|
|
134
|
+
|
|
135
|
+
`Promise`\<`string`\>
|
|
136
|
+
|
|
137
|
+
The result of the rate check.
|
|
138
|
+
|
|
139
|
+
***
|
|
140
|
+
|
|
141
|
+
### clear() {#clear}
|
|
142
|
+
|
|
143
|
+
> **clear**(`action`, `identifier`): `Promise`\<`void`\>
|
|
144
|
+
|
|
145
|
+
Clear the authentication rate entry for the given action and identifier.
|
|
146
|
+
|
|
147
|
+
#### Parameters
|
|
148
|
+
|
|
149
|
+
##### action
|
|
150
|
+
|
|
151
|
+
`string`
|
|
152
|
+
|
|
153
|
+
The action to clear.
|
|
154
|
+
|
|
155
|
+
##### identifier
|
|
156
|
+
|
|
157
|
+
`string`
|
|
158
|
+
|
|
159
|
+
The identifier to clear.
|
|
160
|
+
|
|
161
|
+
#### Returns
|
|
162
|
+
|
|
163
|
+
`Promise`\<`void`\>
|
|
164
|
+
|
|
165
|
+
A promise that resolves when the rate entry has been removed.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Variable: AuthAuditEvent
|
|
2
|
+
|
|
3
|
+
> `const` **AuthAuditEvent**: `object`
|
|
4
|
+
|
|
5
|
+
Supported authentication audit events.
|
|
6
|
+
|
|
7
|
+
## Type Declaration
|
|
8
|
+
|
|
9
|
+
### LoginSuccess {#loginsuccess}
|
|
10
|
+
|
|
11
|
+
> `readonly` **LoginSuccess**: `"login-success"` = `"login-success"`
|
|
12
|
+
|
|
13
|
+
Login success.
|
|
14
|
+
|
|
15
|
+
### LoginFailure {#loginfailure}
|
|
16
|
+
|
|
17
|
+
> `readonly` **LoginFailure**: `"login-failure"` = `"login-failure"`
|
|
18
|
+
|
|
19
|
+
Login failure.
|
|
20
|
+
|
|
21
|
+
### Logout {#logout}
|
|
22
|
+
|
|
23
|
+
> `readonly` **Logout**: `"logout"` = `"logout"`
|
|
24
|
+
|
|
25
|
+
Logout.
|
|
26
|
+
|
|
27
|
+
### TokenRefreshed {#tokenrefreshed}
|
|
28
|
+
|
|
29
|
+
> `readonly` **TokenRefreshed**: `"token-refreshed"` = `"token-refreshed"`
|
|
30
|
+
|
|
31
|
+
Token refreshed.
|
|
32
|
+
|
|
33
|
+
### AccountCreated {#accountcreated}
|
|
34
|
+
|
|
35
|
+
> `readonly` **AccountCreated**: `"account-created"` = `"account-created"`
|
|
36
|
+
|
|
37
|
+
Account created.
|
|
38
|
+
|
|
39
|
+
### AccountDeleted {#accountdeleted}
|
|
40
|
+
|
|
41
|
+
> `readonly` **AccountDeleted**: `"account-deleted"` = `"account-deleted"`
|
|
42
|
+
|
|
43
|
+
Account deleted.
|
|
44
|
+
|
|
45
|
+
### AccountUpdated {#accountupdated}
|
|
46
|
+
|
|
47
|
+
> `readonly` **AccountUpdated**: `"account-updated"` = `"account-updated"`
|
|
48
|
+
|
|
49
|
+
Account updated.
|
|
50
|
+
|
|
51
|
+
### AccountLocked {#accountlocked}
|
|
52
|
+
|
|
53
|
+
> `readonly` **AccountLocked**: `"account-locked"` = `"account-locked"`
|
|
54
|
+
|
|
55
|
+
Account locked.
|
|
56
|
+
|
|
57
|
+
### AccountUnlocked {#accountunlocked}
|
|
58
|
+
|
|
59
|
+
> `readonly` **AccountUnlocked**: `"account-unlocked"` = `"account-unlocked"`
|
|
60
|
+
|
|
61
|
+
Account unlocked.
|
|
62
|
+
|
|
63
|
+
### PasswordChanged {#passwordchanged}
|
|
64
|
+
|
|
65
|
+
> `readonly` **PasswordChanged**: `"password-changed"` = `"password-changed"`
|
|
66
|
+
|
|
67
|
+
Password changed.
|
package/locales/en.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/package.json
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@3sixty/api-auth-models",
|
|
3
|
+
"version": "0.20.0-next.1",
|
|
4
|
+
"description": "Contracts for authentication audit and rate limiting.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/3sixtyglobal/api-auth.git",
|
|
8
|
+
"directory": "packages/api-auth-models"
|
|
9
|
+
},
|
|
10
|
+
"author": "martyn.janes@iota.org",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=24.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@3sixty/core": "next",
|
|
18
|
+
"@3sixty/nameof": "next"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/es/index.js",
|
|
21
|
+
"types": "./dist/types/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/types/index.d.ts",
|
|
25
|
+
"import": "./dist/es/index.js",
|
|
26
|
+
"default": "./dist/es/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist/es",
|
|
31
|
+
"dist/types",
|
|
32
|
+
"locales",
|
|
33
|
+
"docs"
|
|
34
|
+
],
|
|
35
|
+
"keywords": [
|
|
36
|
+
"twin",
|
|
37
|
+
"trade",
|
|
38
|
+
"iota",
|
|
39
|
+
"framework",
|
|
40
|
+
"blockchain",
|
|
41
|
+
"api",
|
|
42
|
+
"auth",
|
|
43
|
+
"audit",
|
|
44
|
+
"rate",
|
|
45
|
+
"models",
|
|
46
|
+
"types",
|
|
47
|
+
"schemas"
|
|
48
|
+
],
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "git+https://github.com/3sixtyglobal/api-auth/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://3sixty.global"
|
|
53
|
+
}
|