@absolutejs/auth 0.75.7 → 0.76.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/dist/agents/context.d.ts +2 -6
- package/dist/agents/index.js +5 -6
- package/dist/agents/index.js.map +3 -3
- package/dist/agents/routes.d.ts +4 -10
- package/dist/authContext.d.ts +66 -178
- package/dist/authorization/protectPermission.d.ts +3 -8
- package/dist/cli/migrate.js +19 -15
- package/dist/cli/migrate.js.map +5 -5
- package/dist/htmx/configuredRoutes.d.ts +37 -126
- package/dist/htmx/routes.d.ts +37 -126
- package/dist/index.d.ts +237 -431
- package/dist/index.js +332 -113
- package/dist/index.js.map +17 -17
- package/dist/mfa/challenge.d.ts +53 -7
- package/dist/mfa/management.d.ts +49 -6
- package/dist/mfa/postgresMfaStore.d.ts +31 -1
- package/dist/mfa/rotation.d.ts +1 -1
- package/dist/mfa/routes.d.ts +78 -2
- package/dist/mfa/sms.d.ts +7 -2
- package/dist/mfa/totp.d.ts +8 -2
- package/dist/mfa/types.d.ts +47 -0
- package/dist/routes/protectRoute.d.ts +4 -21
- package/dist/routes/stepUp.d.ts +3 -8
- package/dist/server.js +330 -113
- package/dist/server.js.map +17 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,134 +9,54 @@ export declare const auth: <UserType>(configuration: AuthConfig<UserType>) => Pr
|
|
|
9
9
|
unregisteredSession: import("./types").UnregisteredSessionRecord;
|
|
10
10
|
};
|
|
11
11
|
derive: ({
|
|
12
|
-
readonly absoluteAuthStatus: {
|
|
13
|
-
error: {
|
|
14
|
-
readonly code: "Bad Request";
|
|
15
|
-
readonly message: "Cookies are missing";
|
|
16
|
-
};
|
|
17
|
-
user: null;
|
|
18
|
-
impersonator?: undefined;
|
|
19
|
-
} | {
|
|
20
|
-
error: null;
|
|
21
|
-
impersonator: import("./types").Impersonator | undefined;
|
|
22
|
-
user: NonNullable<UserType> | null;
|
|
23
|
-
};
|
|
24
12
|
readonly authPrincipal: import("./principal").AuthPrincipal<UserType> | undefined;
|
|
13
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn = never>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
14
|
+
readonly code: "Bad Request";
|
|
15
|
+
readonly message: "Cookies are missing";
|
|
16
|
+
} | {
|
|
17
|
+
readonly code: "Unauthorized";
|
|
18
|
+
readonly message: "User is not authenticated";
|
|
19
|
+
}) => AuthFailReturn) | undefined) => import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | AuthReturn | Promise<AuthReturn> | NonNullable<AuthFailReturn>;
|
|
25
20
|
} & {
|
|
26
|
-
readonly
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} | {
|
|
31
|
-
readonly code: "Unauthorized";
|
|
32
|
-
readonly message: "User is not authenticated";
|
|
33
|
-
}) => AuthFailReturn) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn>>;
|
|
34
|
-
<AuthReturn, AuthFailReturn_1 = never>(handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
35
|
-
readonly code: "Bad Request";
|
|
36
|
-
readonly message: "Cookies are missing";
|
|
37
|
-
} | {
|
|
38
|
-
readonly code: "Unauthorized";
|
|
39
|
-
readonly message: "User is not authenticated";
|
|
40
|
-
}) => AuthFailReturn_1) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_1>>;
|
|
41
|
-
};
|
|
42
|
-
} & {
|
|
43
|
-
readonly requireRecentAuth: {
|
|
44
|
-
<AuthReturn, AuthFailReturn_2 = never>(maxAgeMs: number, handleAuth: (user: UserType) => Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
45
|
-
readonly code: "Unauthorized";
|
|
46
|
-
readonly message: "Recent authentication required";
|
|
47
|
-
}) => AuthFailReturn_2) | undefined): Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | Awaited<AuthFailReturn_2>>;
|
|
48
|
-
<AuthReturn, AuthFailReturn_3 = never>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
49
|
-
readonly code: "Unauthorized";
|
|
50
|
-
readonly message: "Recent authentication required";
|
|
51
|
-
}) => AuthFailReturn_3) | undefined): Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | Awaited<AuthFailReturn_3>>;
|
|
52
|
-
};
|
|
21
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
22
|
+
readonly code: "Unauthorized";
|
|
23
|
+
readonly message: "Recent authentication required";
|
|
24
|
+
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
53
25
|
} & {
|
|
54
|
-
readonly protectAgent: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}) => AuthFailReturn_4): Promise<Response | AuthReturn | Awaited<AuthFailReturn_4>>;
|
|
59
|
-
<AuthReturn, AuthFailReturn_5 = never>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn, handleAuthFail?: (error: {
|
|
60
|
-
code: "Forbidden" | "Unauthorized";
|
|
61
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
62
|
-
}) => AuthFailReturn_5): Promise<Response | AuthReturn | Awaited<AuthFailReturn_5>>;
|
|
63
|
-
};
|
|
26
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
27
|
+
code: "Forbidden" | "Unauthorized";
|
|
28
|
+
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
29
|
+
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
64
30
|
}) | ({
|
|
65
|
-
readonly absoluteAuthStatus: {
|
|
66
|
-
error: {
|
|
67
|
-
readonly code: "Bad Request";
|
|
68
|
-
readonly message: "Cookies are missing";
|
|
69
|
-
};
|
|
70
|
-
user: null;
|
|
71
|
-
impersonator?: undefined;
|
|
72
|
-
} | {
|
|
73
|
-
error: null;
|
|
74
|
-
impersonator: import("./types").Impersonator | undefined;
|
|
75
|
-
user: NonNullable<UserType> | null;
|
|
76
|
-
};
|
|
77
31
|
readonly authPrincipal: import("./principal").AuthPrincipal<UserType> | undefined;
|
|
32
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn = never>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
33
|
+
readonly code: "Bad Request";
|
|
34
|
+
readonly message: "Cookies are missing";
|
|
35
|
+
} | {
|
|
36
|
+
readonly code: "Unauthorized";
|
|
37
|
+
readonly message: "User is not authenticated";
|
|
38
|
+
}) => AuthFailReturn) | undefined) => import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | AuthReturn | Promise<AuthReturn> | NonNullable<AuthFailReturn>;
|
|
78
39
|
} & {
|
|
79
|
-
readonly
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
} | {
|
|
84
|
-
readonly code: "Unauthorized";
|
|
85
|
-
readonly message: "User is not authenticated";
|
|
86
|
-
}) => AuthFailReturn) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn>>;
|
|
87
|
-
<AuthReturn, AuthFailReturn_1 = never>(handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
88
|
-
readonly code: "Bad Request";
|
|
89
|
-
readonly message: "Cookies are missing";
|
|
90
|
-
} | {
|
|
91
|
-
readonly code: "Unauthorized";
|
|
92
|
-
readonly message: "User is not authenticated";
|
|
93
|
-
}) => AuthFailReturn_1) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_1>>;
|
|
94
|
-
};
|
|
40
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
41
|
+
readonly code: "Unauthorized";
|
|
42
|
+
readonly message: "Recent authentication required";
|
|
43
|
+
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
95
44
|
} & {
|
|
96
|
-
readonly
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
} & {
|
|
107
|
-
readonly protectPermission: {
|
|
108
|
-
<AuthReturn, AuthFailReturn_6 = never>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
109
|
-
readonly code: "Bad Request";
|
|
110
|
-
readonly message: "Cookies are missing";
|
|
111
|
-
} | {
|
|
112
|
-
readonly code: "Forbidden";
|
|
113
|
-
readonly message: "Insufficient permissions";
|
|
114
|
-
} | {
|
|
115
|
-
readonly code: "Unauthorized";
|
|
116
|
-
readonly message: "User is not authenticated";
|
|
117
|
-
}) => AuthFailReturn_6) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_6>>;
|
|
118
|
-
<AuthReturn, AuthFailReturn_7 = never>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
119
|
-
readonly code: "Bad Request";
|
|
120
|
-
readonly message: "Cookies are missing";
|
|
121
|
-
} | {
|
|
122
|
-
readonly code: "Forbidden";
|
|
123
|
-
readonly message: "Insufficient permissions";
|
|
124
|
-
} | {
|
|
125
|
-
readonly code: "Unauthorized";
|
|
126
|
-
readonly message: "User is not authenticated";
|
|
127
|
-
}) => AuthFailReturn_7) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_7>>;
|
|
128
|
-
};
|
|
45
|
+
readonly protectPermission: <AuthReturn, AuthFailReturn_3>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
46
|
+
readonly code: "Bad Request";
|
|
47
|
+
readonly message: "Cookies are missing";
|
|
48
|
+
} | {
|
|
49
|
+
readonly code: "Forbidden";
|
|
50
|
+
readonly message: "Insufficient permissions";
|
|
51
|
+
} | {
|
|
52
|
+
readonly code: "Unauthorized";
|
|
53
|
+
readonly message: "User is not authenticated";
|
|
54
|
+
}) => AuthFailReturn_3) | undefined) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | AuthReturn | NonNullable<AuthFailReturn_3>>;
|
|
129
55
|
} & {
|
|
130
|
-
readonly protectAgent: {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}) => AuthFailReturn_4): Promise<Response | AuthReturn | Awaited<AuthFailReturn_4>>;
|
|
135
|
-
<AuthReturn, AuthFailReturn_5 = never>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn, handleAuthFail?: (error: {
|
|
136
|
-
code: "Forbidden" | "Unauthorized";
|
|
137
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
138
|
-
}) => AuthFailReturn_5): Promise<Response | AuthReturn | Awaited<AuthFailReturn_5>>;
|
|
139
|
-
};
|
|
56
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
57
|
+
code: "Forbidden" | "Unauthorized";
|
|
58
|
+
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
59
|
+
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
140
60
|
});
|
|
141
61
|
}, {
|
|
142
62
|
typebox: {};
|
|
@@ -160,22 +80,14 @@ export declare const auth: <UserType>(configuration: AuthConfig<UserType>) => Pr
|
|
|
160
80
|
macroFn: {};
|
|
161
81
|
parser: {};
|
|
162
82
|
response: import("elysia/types").ExtractErrorFromHandle<{
|
|
163
|
-
readonly
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
<AuthReturn, AuthFailReturn_1 = never>(handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
172
|
-
readonly code: "Bad Request";
|
|
173
|
-
readonly message: "Cookies are missing";
|
|
174
|
-
} | {
|
|
175
|
-
readonly code: "Unauthorized";
|
|
176
|
-
readonly message: "User is not authenticated";
|
|
177
|
-
}) => AuthFailReturn_1) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_1>>;
|
|
178
|
-
};
|
|
83
|
+
readonly authPrincipal: import("./principal").AuthPrincipal<UserType> | undefined;
|
|
84
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn = never>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
85
|
+
readonly code: "Bad Request";
|
|
86
|
+
readonly message: "Cookies are missing";
|
|
87
|
+
} | {
|
|
88
|
+
readonly code: "Unauthorized";
|
|
89
|
+
readonly message: "User is not authenticated";
|
|
90
|
+
}) => AuthFailReturn) | undefined) => import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | AuthReturn | Promise<AuthReturn> | NonNullable<AuthFailReturn>;
|
|
179
91
|
}>;
|
|
180
92
|
} & ({
|
|
181
93
|
schema: {};
|
|
@@ -189,16 +101,10 @@ export declare const auth: <UserType>(configuration: AuthConfig<UserType>) => Pr
|
|
|
189
101
|
macroFn: {};
|
|
190
102
|
parser: {};
|
|
191
103
|
response: import("elysia/types").ExtractErrorFromHandle<{
|
|
192
|
-
readonly requireRecentAuth: {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}) => AuthFailReturn_2) | undefined): Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | Awaited<AuthFailReturn_2>>;
|
|
197
|
-
<AuthReturn, AuthFailReturn_3 = never>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
198
|
-
readonly code: "Unauthorized";
|
|
199
|
-
readonly message: "Recent authentication required";
|
|
200
|
-
}) => AuthFailReturn_3) | undefined): Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | Awaited<AuthFailReturn_3>>;
|
|
201
|
-
};
|
|
104
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
105
|
+
readonly code: "Unauthorized";
|
|
106
|
+
readonly message: "Recent authentication required";
|
|
107
|
+
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
202
108
|
}>;
|
|
203
109
|
} & (import("elysia/types").DefaultMetadata | {
|
|
204
110
|
schema: {};
|
|
@@ -212,28 +118,16 @@ export declare const auth: <UserType>(configuration: AuthConfig<UserType>) => Pr
|
|
|
212
118
|
macroFn: {};
|
|
213
119
|
parser: {};
|
|
214
120
|
response: import("elysia/types").ExtractErrorFromHandle<{
|
|
215
|
-
readonly protectPermission: {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}) => AuthFailReturn_6) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_6>>;
|
|
226
|
-
<AuthReturn, AuthFailReturn_7 = never>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
227
|
-
readonly code: "Bad Request";
|
|
228
|
-
readonly message: "Cookies are missing";
|
|
229
|
-
} | {
|
|
230
|
-
readonly code: "Forbidden";
|
|
231
|
-
readonly message: "Insufficient permissions";
|
|
232
|
-
} | {
|
|
233
|
-
readonly code: "Unauthorized";
|
|
234
|
-
readonly message: "User is not authenticated";
|
|
235
|
-
}) => AuthFailReturn_7) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_7>>;
|
|
236
|
-
};
|
|
121
|
+
readonly protectPermission: <AuthReturn, AuthFailReturn_3>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
122
|
+
readonly code: "Bad Request";
|
|
123
|
+
readonly message: "Cookies are missing";
|
|
124
|
+
} | {
|
|
125
|
+
readonly code: "Forbidden";
|
|
126
|
+
readonly message: "Insufficient permissions";
|
|
127
|
+
} | {
|
|
128
|
+
readonly code: "Unauthorized";
|
|
129
|
+
readonly message: "User is not authenticated";
|
|
130
|
+
}) => AuthFailReturn_3) | undefined) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | AuthReturn | NonNullable<AuthFailReturn_3>>;
|
|
237
131
|
}>;
|
|
238
132
|
}))))) & {
|
|
239
133
|
schema: {};
|
|
@@ -242,16 +136,10 @@ export declare const auth: <UserType>(configuration: AuthConfig<UserType>) => Pr
|
|
|
242
136
|
macroFn: {};
|
|
243
137
|
parser: {};
|
|
244
138
|
response: import("elysia/types").ExtractErrorFromHandle<{
|
|
245
|
-
readonly protectAgent: {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}) => AuthFailReturn_4): Promise<Response | AuthReturn | Awaited<AuthFailReturn_4>>;
|
|
250
|
-
<AuthReturn, AuthFailReturn_5 = never>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn, handleAuthFail?: (error: {
|
|
251
|
-
code: "Forbidden" | "Unauthorized";
|
|
252
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
253
|
-
}) => AuthFailReturn_5): Promise<Response | AuthReturn | Awaited<AuthFailReturn_5>>;
|
|
254
|
-
};
|
|
139
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
140
|
+
code: "Forbidden" | "Unauthorized";
|
|
141
|
+
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
142
|
+
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
255
143
|
}>;
|
|
256
144
|
}), {}, import("elysia/types").DefaultEphemeral, {
|
|
257
145
|
derive: {};
|
|
@@ -271,134 +159,54 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
271
159
|
unregisteredSession: import("./types").UnregisteredSessionRecord;
|
|
272
160
|
};
|
|
273
161
|
derive: ({
|
|
274
|
-
readonly absoluteAuthStatus: {
|
|
275
|
-
error: {
|
|
276
|
-
readonly code: "Bad Request";
|
|
277
|
-
readonly message: "Cookies are missing";
|
|
278
|
-
};
|
|
279
|
-
user: null;
|
|
280
|
-
impersonator?: undefined;
|
|
281
|
-
} | {
|
|
282
|
-
error: null;
|
|
283
|
-
impersonator: import("./types").Impersonator | undefined;
|
|
284
|
-
user: NonNullable<UserType> | null;
|
|
285
|
-
};
|
|
286
162
|
readonly authPrincipal: import("./principal").AuthPrincipal<UserType> | undefined;
|
|
163
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn = never>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
164
|
+
readonly code: "Bad Request";
|
|
165
|
+
readonly message: "Cookies are missing";
|
|
166
|
+
} | {
|
|
167
|
+
readonly code: "Unauthorized";
|
|
168
|
+
readonly message: "User is not authenticated";
|
|
169
|
+
}) => AuthFailReturn) | undefined) => import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | AuthReturn | Promise<AuthReturn> | NonNullable<AuthFailReturn>;
|
|
287
170
|
} & {
|
|
288
|
-
readonly
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
} | {
|
|
293
|
-
readonly code: "Unauthorized";
|
|
294
|
-
readonly message: "User is not authenticated";
|
|
295
|
-
}) => AuthFailReturn) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn>>;
|
|
296
|
-
<AuthReturn, AuthFailReturn_1 = never>(handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
297
|
-
readonly code: "Bad Request";
|
|
298
|
-
readonly message: "Cookies are missing";
|
|
299
|
-
} | {
|
|
300
|
-
readonly code: "Unauthorized";
|
|
301
|
-
readonly message: "User is not authenticated";
|
|
302
|
-
}) => AuthFailReturn_1) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_1>>;
|
|
303
|
-
};
|
|
304
|
-
} & {
|
|
305
|
-
readonly requireRecentAuth: {
|
|
306
|
-
<AuthReturn, AuthFailReturn_2 = never>(maxAgeMs: number, handleAuth: (user: UserType) => Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
307
|
-
readonly code: "Unauthorized";
|
|
308
|
-
readonly message: "Recent authentication required";
|
|
309
|
-
}) => AuthFailReturn_2) | undefined): Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | Awaited<AuthFailReturn_2>>;
|
|
310
|
-
<AuthReturn, AuthFailReturn_3 = never>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
311
|
-
readonly code: "Unauthorized";
|
|
312
|
-
readonly message: "Recent authentication required";
|
|
313
|
-
}) => AuthFailReturn_3) | undefined): Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | Awaited<AuthFailReturn_3>>;
|
|
314
|
-
};
|
|
171
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
172
|
+
readonly code: "Unauthorized";
|
|
173
|
+
readonly message: "Recent authentication required";
|
|
174
|
+
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
315
175
|
} & {
|
|
316
|
-
readonly protectAgent: {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}) => AuthFailReturn_4): Promise<Response | AuthReturn | Awaited<AuthFailReturn_4>>;
|
|
321
|
-
<AuthReturn, AuthFailReturn_5 = never>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn, handleAuthFail?: (error: {
|
|
322
|
-
code: "Forbidden" | "Unauthorized";
|
|
323
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
324
|
-
}) => AuthFailReturn_5): Promise<Response | AuthReturn | Awaited<AuthFailReturn_5>>;
|
|
325
|
-
};
|
|
176
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
177
|
+
code: "Forbidden" | "Unauthorized";
|
|
178
|
+
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
179
|
+
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
326
180
|
}) | ({
|
|
327
|
-
readonly absoluteAuthStatus: {
|
|
328
|
-
error: {
|
|
329
|
-
readonly code: "Bad Request";
|
|
330
|
-
readonly message: "Cookies are missing";
|
|
331
|
-
};
|
|
332
|
-
user: null;
|
|
333
|
-
impersonator?: undefined;
|
|
334
|
-
} | {
|
|
335
|
-
error: null;
|
|
336
|
-
impersonator: import("./types").Impersonator | undefined;
|
|
337
|
-
user: NonNullable<UserType> | null;
|
|
338
|
-
};
|
|
339
181
|
readonly authPrincipal: import("./principal").AuthPrincipal<UserType> | undefined;
|
|
182
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn = never>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
183
|
+
readonly code: "Bad Request";
|
|
184
|
+
readonly message: "Cookies are missing";
|
|
185
|
+
} | {
|
|
186
|
+
readonly code: "Unauthorized";
|
|
187
|
+
readonly message: "User is not authenticated";
|
|
188
|
+
}) => AuthFailReturn) | undefined) => import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | AuthReturn | Promise<AuthReturn> | NonNullable<AuthFailReturn>;
|
|
340
189
|
} & {
|
|
341
|
-
readonly
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
} | {
|
|
346
|
-
readonly code: "Unauthorized";
|
|
347
|
-
readonly message: "User is not authenticated";
|
|
348
|
-
}) => AuthFailReturn) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn>>;
|
|
349
|
-
<AuthReturn, AuthFailReturn_1 = never>(handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
350
|
-
readonly code: "Bad Request";
|
|
351
|
-
readonly message: "Cookies are missing";
|
|
352
|
-
} | {
|
|
353
|
-
readonly code: "Unauthorized";
|
|
354
|
-
readonly message: "User is not authenticated";
|
|
355
|
-
}) => AuthFailReturn_1) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_1>>;
|
|
356
|
-
};
|
|
357
|
-
} & {
|
|
358
|
-
readonly requireRecentAuth: {
|
|
359
|
-
<AuthReturn, AuthFailReturn_2 = never>(maxAgeMs: number, handleAuth: (user: UserType) => Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
360
|
-
readonly code: "Unauthorized";
|
|
361
|
-
readonly message: "Recent authentication required";
|
|
362
|
-
}) => AuthFailReturn_2) | undefined): Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | Awaited<AuthFailReturn_2>>;
|
|
363
|
-
<AuthReturn, AuthFailReturn_3 = never>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
364
|
-
readonly code: "Unauthorized";
|
|
365
|
-
readonly message: "Recent authentication required";
|
|
366
|
-
}) => AuthFailReturn_3) | undefined): Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | Awaited<AuthFailReturn_3>>;
|
|
367
|
-
};
|
|
190
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
191
|
+
readonly code: "Unauthorized";
|
|
192
|
+
readonly message: "Recent authentication required";
|
|
193
|
+
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
368
194
|
} & {
|
|
369
|
-
readonly protectPermission: {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}) => AuthFailReturn_6) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_6>>;
|
|
380
|
-
<AuthReturn, AuthFailReturn_7 = never>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
381
|
-
readonly code: "Bad Request";
|
|
382
|
-
readonly message: "Cookies are missing";
|
|
383
|
-
} | {
|
|
384
|
-
readonly code: "Forbidden";
|
|
385
|
-
readonly message: "Insufficient permissions";
|
|
386
|
-
} | {
|
|
387
|
-
readonly code: "Unauthorized";
|
|
388
|
-
readonly message: "User is not authenticated";
|
|
389
|
-
}) => AuthFailReturn_7) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_7>>;
|
|
390
|
-
};
|
|
195
|
+
readonly protectPermission: <AuthReturn, AuthFailReturn_3>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
196
|
+
readonly code: "Bad Request";
|
|
197
|
+
readonly message: "Cookies are missing";
|
|
198
|
+
} | {
|
|
199
|
+
readonly code: "Forbidden";
|
|
200
|
+
readonly message: "Insufficient permissions";
|
|
201
|
+
} | {
|
|
202
|
+
readonly code: "Unauthorized";
|
|
203
|
+
readonly message: "User is not authenticated";
|
|
204
|
+
}) => AuthFailReturn_3) | undefined) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | AuthReturn | NonNullable<AuthFailReturn_3>>;
|
|
391
205
|
} & {
|
|
392
|
-
readonly protectAgent: {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}) => AuthFailReturn_4): Promise<Response | AuthReturn | Awaited<AuthFailReturn_4>>;
|
|
397
|
-
<AuthReturn, AuthFailReturn_5 = never>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn, handleAuthFail?: (error: {
|
|
398
|
-
code: "Forbidden" | "Unauthorized";
|
|
399
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
400
|
-
}) => AuthFailReturn_5): Promise<Response | AuthReturn | Awaited<AuthFailReturn_5>>;
|
|
401
|
-
};
|
|
206
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
207
|
+
code: "Forbidden" | "Unauthorized";
|
|
208
|
+
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
209
|
+
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
402
210
|
});
|
|
403
211
|
}, {
|
|
404
212
|
typebox: {};
|
|
@@ -422,22 +230,14 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
422
230
|
macroFn: {};
|
|
423
231
|
parser: {};
|
|
424
232
|
response: import("elysia/types").ExtractErrorFromHandle<{
|
|
425
|
-
readonly
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
<AuthReturn, AuthFailReturn_1 = never>(handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
434
|
-
readonly code: "Bad Request";
|
|
435
|
-
readonly message: "Cookies are missing";
|
|
436
|
-
} | {
|
|
437
|
-
readonly code: "Unauthorized";
|
|
438
|
-
readonly message: "User is not authenticated";
|
|
439
|
-
}) => AuthFailReturn_1) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_1>>;
|
|
440
|
-
};
|
|
233
|
+
readonly authPrincipal: import("./principal").AuthPrincipal<UserType> | undefined;
|
|
234
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn = never>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
235
|
+
readonly code: "Bad Request";
|
|
236
|
+
readonly message: "Cookies are missing";
|
|
237
|
+
} | {
|
|
238
|
+
readonly code: "Unauthorized";
|
|
239
|
+
readonly message: "User is not authenticated";
|
|
240
|
+
}) => AuthFailReturn) | undefined) => import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | AuthReturn | Promise<AuthReturn> | NonNullable<AuthFailReturn>;
|
|
441
241
|
}>;
|
|
442
242
|
} & ({
|
|
443
243
|
schema: {};
|
|
@@ -451,16 +251,10 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
451
251
|
macroFn: {};
|
|
452
252
|
parser: {};
|
|
453
253
|
response: import("elysia/types").ExtractErrorFromHandle<{
|
|
454
|
-
readonly requireRecentAuth: {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}) => AuthFailReturn_2) | undefined): Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | Awaited<AuthFailReturn_2>>;
|
|
459
|
-
<AuthReturn, AuthFailReturn_3 = never>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
460
|
-
readonly code: "Unauthorized";
|
|
461
|
-
readonly message: "Recent authentication required";
|
|
462
|
-
}) => AuthFailReturn_3) | undefined): Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | Awaited<AuthFailReturn_3>>;
|
|
463
|
-
};
|
|
254
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
255
|
+
readonly code: "Unauthorized";
|
|
256
|
+
readonly message: "Recent authentication required";
|
|
257
|
+
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
464
258
|
}>;
|
|
465
259
|
} & (import("elysia/types").DefaultMetadata | {
|
|
466
260
|
schema: {};
|
|
@@ -474,28 +268,16 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
474
268
|
macroFn: {};
|
|
475
269
|
parser: {};
|
|
476
270
|
response: import("elysia/types").ExtractErrorFromHandle<{
|
|
477
|
-
readonly protectPermission: {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}) => AuthFailReturn_6) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_6>>;
|
|
488
|
-
<AuthReturn, AuthFailReturn_7 = never>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
489
|
-
readonly code: "Bad Request";
|
|
490
|
-
readonly message: "Cookies are missing";
|
|
491
|
-
} | {
|
|
492
|
-
readonly code: "Forbidden";
|
|
493
|
-
readonly message: "Insufficient permissions";
|
|
494
|
-
} | {
|
|
495
|
-
readonly code: "Unauthorized";
|
|
496
|
-
readonly message: "User is not authenticated";
|
|
497
|
-
}) => AuthFailReturn_7) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_7>>;
|
|
498
|
-
};
|
|
271
|
+
readonly protectPermission: <AuthReturn, AuthFailReturn_3>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
272
|
+
readonly code: "Bad Request";
|
|
273
|
+
readonly message: "Cookies are missing";
|
|
274
|
+
} | {
|
|
275
|
+
readonly code: "Forbidden";
|
|
276
|
+
readonly message: "Insufficient permissions";
|
|
277
|
+
} | {
|
|
278
|
+
readonly code: "Unauthorized";
|
|
279
|
+
readonly message: "User is not authenticated";
|
|
280
|
+
}) => AuthFailReturn_3) | undefined) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Forbidden", "Insufficient permissions", 403> | AuthReturn | NonNullable<AuthFailReturn_3>>;
|
|
499
281
|
}>;
|
|
500
282
|
}))))) & {
|
|
501
283
|
schema: {};
|
|
@@ -504,16 +286,10 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
504
286
|
macroFn: {};
|
|
505
287
|
parser: {};
|
|
506
288
|
response: import("elysia/types").ExtractErrorFromHandle<{
|
|
507
|
-
readonly protectAgent: {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}) => AuthFailReturn_4): Promise<Response | AuthReturn | Awaited<AuthFailReturn_4>>;
|
|
512
|
-
<AuthReturn, AuthFailReturn_5 = never>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn, handleAuthFail?: (error: {
|
|
513
|
-
code: "Forbidden" | "Unauthorized";
|
|
514
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
515
|
-
}) => AuthFailReturn_5): Promise<Response | AuthReturn | Awaited<AuthFailReturn_5>>;
|
|
516
|
-
};
|
|
289
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
290
|
+
code: "Forbidden" | "Unauthorized";
|
|
291
|
+
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
292
|
+
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
517
293
|
}>;
|
|
518
294
|
}, {}, import("elysia/types").DefaultEphemeral, {
|
|
519
295
|
derive: {};
|
|
@@ -1160,38 +936,16 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
1160
936
|
session: import("./types").SessionRecord<UserType> & import("./types").SessionRecord<import(".").AuthHtmxUser>;
|
|
1161
937
|
unregisteredSession: import("./types").UnregisteredSessionRecord;
|
|
1162
938
|
};
|
|
1163
|
-
derive: {} |
|
|
1164
|
-
readonly absoluteAuthStatus: {
|
|
1165
|
-
error: {
|
|
1166
|
-
readonly code: "Bad Request";
|
|
1167
|
-
readonly message: "Cookies are missing";
|
|
1168
|
-
};
|
|
1169
|
-
user: null;
|
|
1170
|
-
impersonator?: undefined;
|
|
1171
|
-
} | {
|
|
1172
|
-
error: null;
|
|
1173
|
-
impersonator: import("./types").Impersonator | undefined;
|
|
1174
|
-
user: import(".").AuthHtmxUser | null;
|
|
1175
|
-
};
|
|
939
|
+
derive: {} | {
|
|
1176
940
|
readonly authPrincipal: import("./principal").AuthPrincipal<import(".").AuthHtmxUser> | undefined;
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
}) => AuthFailReturn) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn>>;
|
|
1186
|
-
<AuthReturn, AuthFailReturn_1 = never>(handleAuth: (user: import(".").AuthHtmxUser) => AuthReturn, handleAuthFail?: ((error: {
|
|
1187
|
-
readonly code: "Bad Request";
|
|
1188
|
-
readonly message: "Cookies are missing";
|
|
1189
|
-
} | {
|
|
1190
|
-
readonly code: "Unauthorized";
|
|
1191
|
-
readonly message: "User is not authenticated";
|
|
1192
|
-
}) => AuthFailReturn_1) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_1>>;
|
|
1193
|
-
};
|
|
1194
|
-
});
|
|
941
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn = never>(handleAuth: (user: import(".").AuthHtmxUser) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
942
|
+
readonly code: "Bad Request";
|
|
943
|
+
readonly message: "Cookies are missing";
|
|
944
|
+
} | {
|
|
945
|
+
readonly code: "Unauthorized";
|
|
946
|
+
readonly message: "User is not authenticated";
|
|
947
|
+
}) => AuthFailReturn) | undefined) => import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | AuthReturn | Promise<AuthReturn> | NonNullable<AuthFailReturn>;
|
|
948
|
+
};
|
|
1195
949
|
}, {
|
|
1196
950
|
typebox: {};
|
|
1197
951
|
error: [];
|
|
@@ -1214,22 +968,14 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
1214
968
|
macroFn: {};
|
|
1215
969
|
parser: {};
|
|
1216
970
|
response: import("elysia/types").ExtractErrorFromHandle<{
|
|
1217
|
-
readonly
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
<AuthReturn, AuthFailReturn_1 = never>(handleAuth: (user: import(".").AuthHtmxUser) => AuthReturn, handleAuthFail?: ((error: {
|
|
1226
|
-
readonly code: "Bad Request";
|
|
1227
|
-
readonly message: "Cookies are missing";
|
|
1228
|
-
} | {
|
|
1229
|
-
readonly code: "Unauthorized";
|
|
1230
|
-
readonly message: "User is not authenticated";
|
|
1231
|
-
}) => AuthFailReturn_1) | undefined): Promise<(import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401>) | AuthReturn | Awaited<AuthFailReturn_1>>;
|
|
1232
|
-
};
|
|
971
|
+
readonly authPrincipal: import("./principal").AuthPrincipal<import(".").AuthHtmxUser> | undefined;
|
|
972
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn = never>(handleAuth: (user: import(".").AuthHtmxUser) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
973
|
+
readonly code: "Bad Request";
|
|
974
|
+
readonly message: "Cookies are missing";
|
|
975
|
+
} | {
|
|
976
|
+
readonly code: "Unauthorized";
|
|
977
|
+
readonly message: "User is not authenticated";
|
|
978
|
+
}) => AuthFailReturn) | undefined) => import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | AuthReturn | Promise<AuthReturn> | NonNullable<AuthFailReturn>;
|
|
1233
979
|
}>;
|
|
1234
980
|
} & {
|
|
1235
981
|
schema: {};
|
|
@@ -1430,6 +1176,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
1430
1176
|
200: {
|
|
1431
1177
|
backupCodesRemaining: number;
|
|
1432
1178
|
enabled: boolean;
|
|
1179
|
+
factors: import(".").MfaPublicFactor[];
|
|
1433
1180
|
smsBackup: {
|
|
1434
1181
|
enabled: boolean;
|
|
1435
1182
|
phone: string | null;
|
|
@@ -1478,16 +1225,52 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
1478
1225
|
error: never;
|
|
1479
1226
|
};
|
|
1480
1227
|
};
|
|
1228
|
+
} & {
|
|
1229
|
+
[x: string]: {
|
|
1230
|
+
factors: {
|
|
1231
|
+
":factorId": {
|
|
1232
|
+
delete: {
|
|
1233
|
+
body: unknown;
|
|
1234
|
+
params: {
|
|
1235
|
+
factorId: string;
|
|
1236
|
+
};
|
|
1237
|
+
query: unknown;
|
|
1238
|
+
headers: unknown;
|
|
1239
|
+
response: {
|
|
1240
|
+
401: "Recent authentication required" | "Authentication required";
|
|
1241
|
+
404: "MFA factor not found";
|
|
1242
|
+
200: {
|
|
1243
|
+
readonly status: "removed";
|
|
1244
|
+
};
|
|
1245
|
+
422: {
|
|
1246
|
+
type: "validation";
|
|
1247
|
+
title: "Validation Error";
|
|
1248
|
+
status: 422;
|
|
1249
|
+
detail?: string;
|
|
1250
|
+
on: string;
|
|
1251
|
+
found?: unknown;
|
|
1252
|
+
property?: string;
|
|
1253
|
+
expected?: string;
|
|
1254
|
+
};
|
|
1255
|
+
};
|
|
1256
|
+
error: never;
|
|
1257
|
+
};
|
|
1258
|
+
};
|
|
1259
|
+
};
|
|
1260
|
+
};
|
|
1481
1261
|
} & {
|
|
1482
1262
|
[x: string]: {
|
|
1483
1263
|
post: {
|
|
1484
|
-
body:
|
|
1264
|
+
body: {
|
|
1265
|
+
label?: string | undefined;
|
|
1266
|
+
};
|
|
1485
1267
|
params: {};
|
|
1486
1268
|
query: unknown;
|
|
1487
1269
|
headers: unknown;
|
|
1488
1270
|
response: {
|
|
1489
1271
|
401: "Recent authentication required" | "Authentication required";
|
|
1490
1272
|
200: {
|
|
1273
|
+
readonly factorId: string;
|
|
1491
1274
|
readonly secret: string;
|
|
1492
1275
|
readonly uri: string;
|
|
1493
1276
|
};
|
|
@@ -1509,6 +1292,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
1509
1292
|
[x: string]: {
|
|
1510
1293
|
post: {
|
|
1511
1294
|
body: {
|
|
1295
|
+
factorId?: string | undefined;
|
|
1512
1296
|
code: string;
|
|
1513
1297
|
};
|
|
1514
1298
|
params: {};
|
|
@@ -1538,6 +1322,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
1538
1322
|
[x: string]: {
|
|
1539
1323
|
post: {
|
|
1540
1324
|
body: {
|
|
1325
|
+
label?: string | undefined;
|
|
1541
1326
|
phone: string;
|
|
1542
1327
|
};
|
|
1543
1328
|
params: {};
|
|
@@ -1548,6 +1333,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
1548
1333
|
401: "Recent authentication required" | "Authentication required";
|
|
1549
1334
|
501: "SMS MFA is not configured";
|
|
1550
1335
|
200: {
|
|
1336
|
+
readonly factorId: string;
|
|
1551
1337
|
readonly phone: string;
|
|
1552
1338
|
};
|
|
1553
1339
|
422: {
|
|
@@ -1570,6 +1356,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
1570
1356
|
[x: string]: {
|
|
1571
1357
|
post: {
|
|
1572
1358
|
body: {
|
|
1359
|
+
factorId?: string | undefined;
|
|
1573
1360
|
code: string;
|
|
1574
1361
|
};
|
|
1575
1362
|
params: {};
|
|
@@ -1597,13 +1384,46 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
1597
1384
|
error: never;
|
|
1598
1385
|
};
|
|
1599
1386
|
};
|
|
1387
|
+
} & {
|
|
1388
|
+
[x: string]: {
|
|
1389
|
+
get: {
|
|
1390
|
+
body: unknown;
|
|
1391
|
+
params: {};
|
|
1392
|
+
query: unknown;
|
|
1393
|
+
headers: unknown;
|
|
1394
|
+
response: {
|
|
1395
|
+
401: "No MFA challenge in progress";
|
|
1396
|
+
200: {
|
|
1397
|
+
backupCodesAvailable: boolean;
|
|
1398
|
+
factors: Array<{
|
|
1399
|
+
id: string;
|
|
1400
|
+
label: string;
|
|
1401
|
+
phone: string | null;
|
|
1402
|
+
type: "sms" | "totp";
|
|
1403
|
+
}>;
|
|
1404
|
+
};
|
|
1405
|
+
422: {
|
|
1406
|
+
type: "validation";
|
|
1407
|
+
title: "Validation Error";
|
|
1408
|
+
status: 422;
|
|
1409
|
+
detail?: string;
|
|
1410
|
+
on: string;
|
|
1411
|
+
found?: unknown;
|
|
1412
|
+
property?: string;
|
|
1413
|
+
expected?: string;
|
|
1414
|
+
};
|
|
1415
|
+
};
|
|
1416
|
+
error: never;
|
|
1417
|
+
};
|
|
1418
|
+
};
|
|
1600
1419
|
} & {
|
|
1601
1420
|
[x: string]: {
|
|
1602
1421
|
post: {
|
|
1603
1422
|
body: {
|
|
1604
1423
|
code?: string | undefined;
|
|
1605
1424
|
action?: "verify" | "send" | undefined;
|
|
1606
|
-
|
|
1425
|
+
factorId?: string | undefined;
|
|
1426
|
+
factor?: "sms" | "backup_codes" | "totp" | undefined;
|
|
1607
1427
|
};
|
|
1608
1428
|
params: {};
|
|
1609
1429
|
query: unknown;
|
|
@@ -1612,6 +1432,8 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
1612
1432
|
400: string;
|
|
1613
1433
|
401: "SMS code expired" | "Too many attempts" | "SMS challenge is no longer active" | "No MFA challenge in progress" | "Invalid MFA code";
|
|
1614
1434
|
200: {
|
|
1435
|
+
readonly factorId: string;
|
|
1436
|
+
readonly phone: string;
|
|
1615
1437
|
readonly status: "sent";
|
|
1616
1438
|
} | {
|
|
1617
1439
|
readonly status: "authenticated";
|
|
@@ -3703,9 +3525,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
3703
3525
|
query: unknown;
|
|
3704
3526
|
headers: unknown;
|
|
3705
3527
|
response: {
|
|
3706
|
-
|
|
3707
|
-
401: "User is not authenticated";
|
|
3708
|
-
200: Response;
|
|
3528
|
+
200: {};
|
|
3709
3529
|
422: {
|
|
3710
3530
|
type: "validation";
|
|
3711
3531
|
title: "Validation Error";
|
|
@@ -3734,9 +3554,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
3734
3554
|
query: unknown;
|
|
3735
3555
|
headers: unknown;
|
|
3736
3556
|
response: {
|
|
3737
|
-
|
|
3738
|
-
401: "User is not authenticated";
|
|
3739
|
-
200: Response;
|
|
3557
|
+
200: {};
|
|
3740
3558
|
422: {
|
|
3741
3559
|
type: "validation";
|
|
3742
3560
|
title: "Validation Error";
|
|
@@ -3766,9 +3584,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
3766
3584
|
query: unknown;
|
|
3767
3585
|
headers: unknown;
|
|
3768
3586
|
response: {
|
|
3769
|
-
|
|
3770
|
-
401: "User is not authenticated";
|
|
3771
|
-
200: Response;
|
|
3587
|
+
200: {};
|
|
3772
3588
|
422: {
|
|
3773
3589
|
type: "validation";
|
|
3774
3590
|
title: "Validation Error";
|
|
@@ -3797,9 +3613,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
3797
3613
|
query: unknown;
|
|
3798
3614
|
headers: unknown;
|
|
3799
3615
|
response: {
|
|
3800
|
-
|
|
3801
|
-
401: "User is not authenticated";
|
|
3802
|
-
200: Response;
|
|
3616
|
+
200: {};
|
|
3803
3617
|
422: {
|
|
3804
3618
|
type: "validation";
|
|
3805
3619
|
title: "Validation Error";
|
|
@@ -3828,9 +3642,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
3828
3642
|
query: unknown;
|
|
3829
3643
|
headers: unknown;
|
|
3830
3644
|
response: {
|
|
3831
|
-
|
|
3832
|
-
401: "User is not authenticated";
|
|
3833
|
-
200: Response;
|
|
3645
|
+
200: {};
|
|
3834
3646
|
422: {
|
|
3835
3647
|
type: "validation";
|
|
3836
3648
|
title: "Validation Error";
|
|
@@ -3887,9 +3699,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
3887
3699
|
query: unknown;
|
|
3888
3700
|
headers: unknown;
|
|
3889
3701
|
response: {
|
|
3890
|
-
|
|
3891
|
-
401: "User is not authenticated";
|
|
3892
|
-
200: Response;
|
|
3702
|
+
200: {};
|
|
3893
3703
|
422: {
|
|
3894
3704
|
type: "validation";
|
|
3895
3705
|
title: "Validation Error";
|
|
@@ -3920,9 +3730,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
3920
3730
|
query: unknown;
|
|
3921
3731
|
headers: unknown;
|
|
3922
3732
|
response: {
|
|
3923
|
-
|
|
3924
|
-
401: "User is not authenticated";
|
|
3925
|
-
200: Response;
|
|
3733
|
+
200: {};
|
|
3926
3734
|
422: {
|
|
3927
3735
|
type: "validation";
|
|
3928
3736
|
title: "Validation Error";
|
|
@@ -3974,9 +3782,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
|
|
|
3974
3782
|
query: unknown;
|
|
3975
3783
|
headers: unknown;
|
|
3976
3784
|
response: {
|
|
3977
|
-
|
|
3978
|
-
401: "User is not authenticated";
|
|
3979
|
-
200: Response;
|
|
3785
|
+
200: {};
|
|
3980
3786
|
422: {
|
|
3981
3787
|
type: "validation";
|
|
3982
3788
|
title: "Validation Error";
|
|
@@ -4186,9 +3992,9 @@ export * from './mfa/types';
|
|
|
4186
3992
|
export * from './verification/types';
|
|
4187
3993
|
export { consumeBackupCode, generateBackupCodes } from './mfa/backupCodes';
|
|
4188
3994
|
export { createMfaGate } from './mfa/gate';
|
|
4189
|
-
export { mfaChallenge } from './mfa/challenge';
|
|
3995
|
+
export { mfaChallenge, type MfaChallengeOptions } from './mfa/challenge';
|
|
4190
3996
|
export { mfaRoutes } from './mfa/routes';
|
|
4191
|
-
export { mfaManagementRoutes, type MfaStatus } from './mfa/management';
|
|
3997
|
+
export { mfaManagementRoutes, type MfaPublicFactor, type MfaStatus } from './mfa/management';
|
|
4192
3998
|
export { rotateMfaEncryptionKey } from './mfa/rotation';
|
|
4193
3999
|
export type { MfaKeyRotationResult } from './mfa/rotation';
|
|
4194
4000
|
export { mfaTotpRoutes } from './mfa/totp';
|