@absolutejs/auth 0.55.0 → 0.55.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/README.md +7 -0
- package/dist/agents/index.js +43 -36
- package/dist/agents/index.js.map +3 -3
- package/dist/agents/routes.d.ts +32 -0
- package/dist/apikeys/routes.d.ts +2 -2
- package/dist/authInstance.d.ts +12 -0
- package/dist/authorization/protectPermission.d.ts +2 -2
- package/dist/credentials/login.d.ts +4 -4
- package/dist/credentials/routes.d.ts +4 -4
- package/dist/index.d.ts +3 -303
- package/dist/index.js +154 -143
- package/dist/index.js.map +5 -5
- package/dist/mfa/routes.d.ts +2 -2
- package/dist/mfa/sms.d.ts +2 -2
- package/dist/oidc/routes.d.ts +14 -14
- package/dist/organizations/routes.d.ts +1 -1
- package/dist/portal/routes.d.ts +3 -3
- package/dist/roles/routes.d.ts +1 -1
- package/dist/routes/protectRoute.d.ts +2 -2
- package/dist/routes/refresh.d.ts +1 -1
- package/dist/routes/revoke.d.ts +1 -1
- package/dist/routes/sessions.d.ts +3 -3
- package/dist/server.d.ts +18 -0
- package/dist/server.js +29362 -0
- package/dist/server.js.map +287 -0
- package/dist/sso/discoveryRoute.d.ts +1 -1
- package/dist/sso/oidcRoutes.d.ts +2 -2
- package/dist/sso/samlRoutes.d.ts +4 -4
- package/dist/utils.d.ts +1 -1
- package/package.json +9 -4
package/dist/agents/routes.d.ts
CHANGED
|
@@ -13,6 +13,38 @@ export declare const agentAuthChallenge: ({ config, error, requiredScopes }: {
|
|
|
13
13
|
}) => string;
|
|
14
14
|
export declare const agentResourceMetadataUrl: (config: AgentAuthConfig) => string;
|
|
15
15
|
export { agentRegistrationDiscoveryMetadata };
|
|
16
|
+
export declare const agentAuthContextPlugin: (config?: AgentAuthConfig) => Elysia<"", {
|
|
17
|
+
decorator: {};
|
|
18
|
+
store: {};
|
|
19
|
+
derive: {};
|
|
20
|
+
resolve: {};
|
|
21
|
+
}, {
|
|
22
|
+
typebox: {};
|
|
23
|
+
error: {};
|
|
24
|
+
}, {
|
|
25
|
+
schema: {};
|
|
26
|
+
standaloneSchema: {};
|
|
27
|
+
macro: {};
|
|
28
|
+
macroFn: {};
|
|
29
|
+
parser: {};
|
|
30
|
+
response: {};
|
|
31
|
+
}, {}, {
|
|
32
|
+
derive: {};
|
|
33
|
+
resolve: {};
|
|
34
|
+
schema: {};
|
|
35
|
+
standaloneSchema: {};
|
|
36
|
+
response: {};
|
|
37
|
+
}, {
|
|
38
|
+
derive: {
|
|
39
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
40
|
+
};
|
|
41
|
+
resolve: {};
|
|
42
|
+
schema: {};
|
|
43
|
+
standaloneSchema: {};
|
|
44
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
45
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
46
|
+
}>;
|
|
47
|
+
}>;
|
|
16
48
|
export declare const agentAuthPlugin: (config?: AgentAuthConfig) => Elysia<"", {
|
|
17
49
|
decorator: {};
|
|
18
50
|
store: {};
|
package/dist/apikeys/routes.d.ts
CHANGED
|
@@ -46,9 +46,9 @@ export declare const apiKeysRoutes: ({ accessTokenStore, accessTokenTtlMs, apiCl
|
|
|
46
46
|
[x: string]: {
|
|
47
47
|
post: {
|
|
48
48
|
body: {
|
|
49
|
-
grant_type?: string | undefined;
|
|
50
|
-
scope?: string | undefined;
|
|
51
49
|
client_id?: string | undefined;
|
|
50
|
+
scope?: string | undefined;
|
|
51
|
+
grant_type?: string | undefined;
|
|
52
52
|
client_secret?: string | undefined;
|
|
53
53
|
};
|
|
54
54
|
params: {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Elysia } from 'elysia';
|
|
2
|
+
import type { agentAuthContextPlugin } from './agents/routes';
|
|
3
|
+
import type { protectRoutePlugin } from './routes/protectRoute';
|
|
4
|
+
import type { stepUpPlugin } from './routes/stepUp';
|
|
5
|
+
/** Merge the stable context contributed by independent Auth plugins without
|
|
6
|
+
* exposing the configurable route graph in consumer declarations. */
|
|
7
|
+
type MergeAuthContext<Base, Extra> = Base extends Elysia<infer Path, infer Singleton, infer Definitions, infer Metadata, infer Routes, infer Ephemeral, infer Volatile> ? Extra extends Elysia<infer ExtraPath, infer ExtraSingleton, infer ExtraDefinitions, infer ExtraMetadata, infer ExtraRoutes, infer ExtraEphemeral, infer ExtraVolatile> ? Elysia<Path & ExtraPath, Singleton & ExtraSingleton, Definitions & ExtraDefinitions, Metadata & ExtraMetadata, Routes & ExtraRoutes, Ephemeral & ExtraEphemeral, Volatile & ExtraVolatile> : never : never;
|
|
8
|
+
/** The consumer-facing context contributed by `auth()`. Configurable auth
|
|
9
|
+
* routes are available at runtime but intentionally omitted from this type:
|
|
10
|
+
* their user-defined paths cannot form useful literal route declarations. */
|
|
11
|
+
export type AuthInstance<UserType> = MergeAuthContext<MergeAuthContext<ReturnType<typeof protectRoutePlugin<UserType>>, ReturnType<typeof stepUpPlugin<UserType>>>, ReturnType<typeof agentAuthContextPlugin>>;
|
|
12
|
+
export {};
|
|
@@ -17,7 +17,7 @@ export declare const protectPermissionPlugin: <UserType>({ authSessionStore, emi
|
|
|
17
17
|
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
18
18
|
};
|
|
19
19
|
derive: {
|
|
20
|
-
readonly protectPermission: <AuthReturn, AuthFailReturn>(check: PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: PermissionFailError) => AuthFailReturn) => Promise<
|
|
20
|
+
readonly protectPermission: <AuthReturn, AuthFailReturn>(check: PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: PermissionFailError) => AuthFailReturn) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn> | import("elysia").ElysiaCustomStatusResponse<"Forbidden", "Insufficient permissions", 403>>;
|
|
21
21
|
};
|
|
22
22
|
resolve: {};
|
|
23
23
|
}, {
|
|
@@ -34,7 +34,7 @@ export declare const protectPermissionPlugin: <UserType>({ authSessionStore, emi
|
|
|
34
34
|
macroFn: {};
|
|
35
35
|
parser: {};
|
|
36
36
|
response: import("elysia").ExtractErrorFromHandle<{
|
|
37
|
-
readonly protectPermission: <AuthReturn, AuthFailReturn>(check: PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: PermissionFailError) => AuthFailReturn) => Promise<
|
|
37
|
+
readonly protectPermission: <AuthReturn, AuthFailReturn>(check: PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: PermissionFailError) => AuthFailReturn) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn> | import("elysia").ElysiaCustomStatusResponse<"Forbidden", "Insufficient permissions", 403>>;
|
|
38
38
|
}>;
|
|
39
39
|
}, {}, {
|
|
40
40
|
derive: {};
|
|
@@ -39,10 +39,6 @@ export declare const credentialsLogin: <UserType>({ authSessionStore, checkBreac
|
|
|
39
39
|
readonly passwordCompromised: boolean;
|
|
40
40
|
readonly status: "authenticated";
|
|
41
41
|
};
|
|
42
|
-
429: {
|
|
43
|
-
readonly retryAfterMs: number | undefined;
|
|
44
|
-
readonly status: "account_locked";
|
|
45
|
-
};
|
|
46
42
|
422: {
|
|
47
43
|
type: "validation";
|
|
48
44
|
on: string;
|
|
@@ -52,6 +48,10 @@ export declare const credentialsLogin: <UserType>({ authSessionStore, checkBreac
|
|
|
52
48
|
property?: string;
|
|
53
49
|
expected?: string;
|
|
54
50
|
};
|
|
51
|
+
429: {
|
|
52
|
+
readonly retryAfterMs: number | undefined;
|
|
53
|
+
readonly status: "account_locked";
|
|
54
|
+
};
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
};
|
|
@@ -107,10 +107,6 @@ export declare const credentialRoutes: <UserType>(config: CredentialRouteProps<U
|
|
|
107
107
|
readonly passwordCompromised: boolean;
|
|
108
108
|
readonly status: "authenticated";
|
|
109
109
|
};
|
|
110
|
-
429: {
|
|
111
|
-
readonly retryAfterMs: number | undefined;
|
|
112
|
-
readonly status: "account_locked";
|
|
113
|
-
};
|
|
114
110
|
422: {
|
|
115
111
|
type: "validation";
|
|
116
112
|
on: string;
|
|
@@ -120,6 +116,10 @@ export declare const credentialRoutes: <UserType>(config: CredentialRouteProps<U
|
|
|
120
116
|
property?: string;
|
|
121
117
|
expected?: string;
|
|
122
118
|
};
|
|
119
|
+
429: {
|
|
120
|
+
readonly retryAfterMs: number | undefined;
|
|
121
|
+
readonly status: "account_locked";
|
|
122
|
+
};
|
|
123
123
|
};
|
|
124
124
|
};
|
|
125
125
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import { agentAuthPlugin } from './agents/routes';
|
|
3
|
-
import { protectRoutePlugin } from './routes/protectRoute';
|
|
4
|
-
import { stepUpPlugin } from './routes/stepUp';
|
|
5
2
|
import { AuthConfig } from './types';
|
|
6
|
-
/** The minimal reference instance capturing ONLY the global, consumer-facing
|
|
7
|
-
* context `auth()` contributes: the `protectRoute` + step-up derives, typed by
|
|
8
|
-
* `UserType`. `auth()` also mounts ~28 route plugins, but their paths are
|
|
9
|
-
* CONFIGURABLE (`authorizeRoute`, `callbackRoute`, …), so Elysia keys those
|
|
10
|
-
* routes by `string` — there is no literal route type to expose, and inferring
|
|
11
|
-
* the whole chain trips TS7056 / a 2^N union blow-up. This typed context is the
|
|
12
|
-
* precise surface consumers actually use (`protectRoute((user) => …)` yields
|
|
13
|
-
* `UserType`); the routes are reached by path at runtime / direct fetch. */
|
|
14
|
-
type MergeAuthContext<Base, Extra> = Base extends Elysia<infer Path, infer Singleton, infer Definitions, infer Metadata, infer Routes, infer Ephemeral, infer Volatile> ? Extra extends Elysia<infer ExtraPath, infer ExtraSingleton, infer ExtraDefinitions, infer ExtraMetadata, infer ExtraRoutes, infer ExtraEphemeral, infer ExtraVolatile> ? Elysia<Path & ExtraPath, Singleton & ExtraSingleton, Definitions & ExtraDefinitions, Metadata & ExtraMetadata, Routes & ExtraRoutes, Ephemeral & ExtraEphemeral, Volatile & ExtraVolatile> : never : never;
|
|
15
|
-
export type AuthInstance<UserType> = MergeAuthContext<MergeAuthContext<ReturnType<typeof protectRoutePlugin<UserType>>, ReturnType<typeof stepUpPlugin<UserType>>>, ReturnType<typeof agentAuthPlugin>>;
|
|
16
3
|
export declare const auth: <UserType>({ providersConfiguration, authorizeRoute, cookieSecure, callbackRoute, profileRoute, signoutRoute, statusRoute, refreshRoute, revokeRoute, cleanupIntervalMs, maxSessions, sessionDurationMs, authSessionStore, audit, credentials, customProviders, mfa, passwordless, lockout, sessions, sso, scim, apikeys, agentAuth, oidc, organizations, roles, portal, authorization, compliance, webauthn, webhooks, htmx, tracing, resolveAuthIntent, onAuthorizeSuccess, onAuthorizeError, onProfileSuccess, onProfileError, onCallbackSuccess, onLinkIdentity, onLinkIdentityConflict, onLinkConnector, onCallbackError, onStatus, onRefreshSuccess, onRefreshError, onSignOut, onRevocationSuccess, onRevocationError, onSessionCleanup }: AuthConfig<UserType>) => Promise<Elysia<"", {
|
|
17
4
|
decorator: {};
|
|
18
5
|
store: {
|
|
@@ -45,12 +32,7 @@ export declare const auth: <UserType>({ providersConfiguration, authorizeRoute,
|
|
|
45
32
|
} & {
|
|
46
33
|
decorator: {};
|
|
47
34
|
store: {};
|
|
48
|
-
derive: {
|
|
49
|
-
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
50
|
-
code: "Forbidden" | "Unauthorized";
|
|
51
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
52
|
-
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
53
|
-
};
|
|
35
|
+
derive: {};
|
|
54
36
|
resolve: {};
|
|
55
37
|
}, {
|
|
56
38
|
typebox: {};
|
|
@@ -96,133 +78,14 @@ export declare const auth: <UserType>({ providersConfiguration, authorizeRoute,
|
|
|
96
78
|
macro: {};
|
|
97
79
|
macroFn: {};
|
|
98
80
|
parser: {};
|
|
99
|
-
response: import("elysia").ExtractErrorFromHandle<{
|
|
100
|
-
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
101
|
-
code: "Forbidden" | "Unauthorized";
|
|
102
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
103
|
-
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
104
|
-
}>;
|
|
105
|
-
}, {}, {
|
|
106
|
-
derive: {};
|
|
107
|
-
resolve: {};
|
|
108
|
-
schema: {};
|
|
109
|
-
standaloneSchema: {};
|
|
110
81
|
response: {};
|
|
111
|
-
}, {
|
|
82
|
+
}, {}, {
|
|
112
83
|
derive: {};
|
|
113
84
|
resolve: {};
|
|
114
85
|
schema: {};
|
|
115
86
|
standaloneSchema: {};
|
|
116
87
|
response: {};
|
|
117
|
-
}> | Elysia<"", {
|
|
118
|
-
decorator: {};
|
|
119
|
-
store: {
|
|
120
|
-
session: import("./types").SessionRecord<UserType>;
|
|
121
|
-
unregisteredSession: import("./types").UnregisteredSessionRecord;
|
|
122
|
-
};
|
|
123
|
-
derive: {
|
|
124
|
-
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
125
|
-
readonly code: "Bad Request";
|
|
126
|
-
readonly message: "Cookies are missing";
|
|
127
|
-
} | {
|
|
128
|
-
readonly code: "Unauthorized";
|
|
129
|
-
readonly message: "User is not authenticated";
|
|
130
|
-
}) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
131
|
-
};
|
|
132
|
-
resolve: {};
|
|
133
|
-
} & {
|
|
134
|
-
decorator: {};
|
|
135
|
-
store: {
|
|
136
|
-
session: import("./types").SessionRecord<UserType>;
|
|
137
|
-
unregisteredSession: import("./types").UnregisteredSessionRecord;
|
|
138
|
-
};
|
|
139
|
-
derive: {
|
|
140
|
-
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
141
|
-
readonly code: "Unauthorized";
|
|
142
|
-
readonly message: "Recent authentication required";
|
|
143
|
-
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
144
|
-
};
|
|
145
|
-
resolve: {};
|
|
146
88
|
} & {
|
|
147
|
-
decorator: {};
|
|
148
|
-
store: {};
|
|
149
|
-
derive: {
|
|
150
|
-
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
151
|
-
code: "Forbidden" | "Unauthorized";
|
|
152
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
153
|
-
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
154
|
-
};
|
|
155
|
-
resolve: {};
|
|
156
|
-
}, {
|
|
157
|
-
typebox: {};
|
|
158
|
-
error: {};
|
|
159
|
-
}, {
|
|
160
|
-
schema: import("elysia").UnwrapRoute<{
|
|
161
|
-
cookie: import("@sinclair/typebox").TObject<{
|
|
162
|
-
user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
|
|
163
|
-
}>;
|
|
164
|
-
}, {}, "">;
|
|
165
|
-
standaloneSchema: {};
|
|
166
|
-
macro: {};
|
|
167
|
-
macroFn: {};
|
|
168
|
-
parser: {};
|
|
169
|
-
response: import("elysia").ExtractErrorFromHandle<{
|
|
170
|
-
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
171
|
-
readonly code: "Bad Request";
|
|
172
|
-
readonly message: "Cookies are missing";
|
|
173
|
-
} | {
|
|
174
|
-
readonly code: "Unauthorized";
|
|
175
|
-
readonly message: "User is not authenticated";
|
|
176
|
-
}) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
177
|
-
}>;
|
|
178
|
-
} & {
|
|
179
|
-
schema: import("elysia").UnwrapRoute<{
|
|
180
|
-
cookie: import("@sinclair/typebox").TObject<{
|
|
181
|
-
user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
|
|
182
|
-
}>;
|
|
183
|
-
}, {}, "">;
|
|
184
|
-
standaloneSchema: {};
|
|
185
|
-
macro: {};
|
|
186
|
-
macroFn: {};
|
|
187
|
-
parser: {};
|
|
188
|
-
response: import("elysia").ExtractErrorFromHandle<{
|
|
189
|
-
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
190
|
-
readonly code: "Unauthorized";
|
|
191
|
-
readonly message: "Recent authentication required";
|
|
192
|
-
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
193
|
-
}>;
|
|
194
|
-
} & {
|
|
195
|
-
schema: {};
|
|
196
|
-
standaloneSchema: {};
|
|
197
|
-
macro: {};
|
|
198
|
-
macroFn: {};
|
|
199
|
-
parser: {};
|
|
200
|
-
response: import("elysia").ExtractErrorFromHandle<{
|
|
201
|
-
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
202
|
-
code: "Forbidden" | "Unauthorized";
|
|
203
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
204
|
-
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
205
|
-
}>;
|
|
206
|
-
}, {
|
|
207
|
-
[x: string]: {
|
|
208
|
-
get: {
|
|
209
|
-
body: unknown;
|
|
210
|
-
params: {};
|
|
211
|
-
query: unknown;
|
|
212
|
-
headers: unknown;
|
|
213
|
-
response: {
|
|
214
|
-
200: {
|
|
215
|
-
resource: string;
|
|
216
|
-
scopes_supported: string[];
|
|
217
|
-
resource_name?: string | undefined;
|
|
218
|
-
resource_logo_uri?: string | undefined;
|
|
219
|
-
authorization_servers: string[];
|
|
220
|
-
bearer_methods_supported: string[];
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
}, {
|
|
226
89
|
derive: {};
|
|
227
90
|
resolve: {};
|
|
228
91
|
schema: {};
|
|
@@ -234,38 +97,7 @@ export declare const auth: <UserType>({ providersConfiguration, authorizeRoute,
|
|
|
234
97
|
schema: {};
|
|
235
98
|
standaloneSchema: {};
|
|
236
99
|
response: {};
|
|
237
|
-
}> | Elysia<"", {
|
|
238
|
-
decorator: {};
|
|
239
|
-
store: {
|
|
240
|
-
session: import("./types").SessionRecord<UserType>;
|
|
241
|
-
unregisteredSession: import("./types").UnregisteredSessionRecord;
|
|
242
|
-
};
|
|
243
|
-
derive: {
|
|
244
|
-
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
245
|
-
readonly code: "Bad Request";
|
|
246
|
-
readonly message: "Cookies are missing";
|
|
247
|
-
} | {
|
|
248
|
-
readonly code: "Unauthorized";
|
|
249
|
-
readonly message: "User is not authenticated";
|
|
250
|
-
}) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
251
|
-
};
|
|
252
|
-
resolve: {};
|
|
253
|
-
} & {
|
|
254
|
-
decorator: {};
|
|
255
|
-
store: {
|
|
256
|
-
session: import("./types").SessionRecord<UserType>;
|
|
257
|
-
unregisteredSession: import("./types").UnregisteredSessionRecord;
|
|
258
|
-
};
|
|
259
|
-
derive: {
|
|
260
|
-
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
261
|
-
readonly code: "Unauthorized";
|
|
262
|
-
readonly message: "Recent authentication required";
|
|
263
|
-
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
264
|
-
};
|
|
265
|
-
resolve: {};
|
|
266
100
|
} & {
|
|
267
|
-
decorator: {};
|
|
268
|
-
store: {};
|
|
269
101
|
derive: {
|
|
270
102
|
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
271
103
|
code: "Forbidden" | "Unauthorized";
|
|
@@ -273,149 +105,17 @@ export declare const auth: <UserType>({ providersConfiguration, authorizeRoute,
|
|
|
273
105
|
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
274
106
|
};
|
|
275
107
|
resolve: {};
|
|
276
|
-
}, {
|
|
277
|
-
typebox: {};
|
|
278
|
-
error: {};
|
|
279
|
-
}, {
|
|
280
|
-
schema: import("elysia").UnwrapRoute<{
|
|
281
|
-
cookie: import("@sinclair/typebox").TObject<{
|
|
282
|
-
user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
|
|
283
|
-
}>;
|
|
284
|
-
}, {}, "">;
|
|
285
|
-
standaloneSchema: {};
|
|
286
|
-
macro: {};
|
|
287
|
-
macroFn: {};
|
|
288
|
-
parser: {};
|
|
289
|
-
response: import("elysia").ExtractErrorFromHandle<{
|
|
290
|
-
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
291
|
-
readonly code: "Bad Request";
|
|
292
|
-
readonly message: "Cookies are missing";
|
|
293
|
-
} | {
|
|
294
|
-
readonly code: "Unauthorized";
|
|
295
|
-
readonly message: "User is not authenticated";
|
|
296
|
-
}) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
297
|
-
}>;
|
|
298
|
-
} & {
|
|
299
|
-
schema: import("elysia").UnwrapRoute<{
|
|
300
|
-
cookie: import("@sinclair/typebox").TObject<{
|
|
301
|
-
user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
|
|
302
|
-
}>;
|
|
303
|
-
}, {}, "">;
|
|
304
|
-
standaloneSchema: {};
|
|
305
|
-
macro: {};
|
|
306
|
-
macroFn: {};
|
|
307
|
-
parser: {};
|
|
308
|
-
response: import("elysia").ExtractErrorFromHandle<{
|
|
309
|
-
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
310
|
-
readonly code: "Unauthorized";
|
|
311
|
-
readonly message: "Recent authentication required";
|
|
312
|
-
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
313
|
-
}>;
|
|
314
|
-
} & {
|
|
315
108
|
schema: {};
|
|
316
109
|
standaloneSchema: {};
|
|
317
|
-
macro: {};
|
|
318
|
-
macroFn: {};
|
|
319
|
-
parser: {};
|
|
320
110
|
response: import("elysia").ExtractErrorFromHandle<{
|
|
321
111
|
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
322
112
|
code: "Forbidden" | "Unauthorized";
|
|
323
113
|
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
324
114
|
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
325
115
|
}>;
|
|
326
|
-
}, {
|
|
327
|
-
[x: string]: {
|
|
328
|
-
get: {
|
|
329
|
-
body: unknown;
|
|
330
|
-
params: {};
|
|
331
|
-
query: unknown;
|
|
332
|
-
headers: unknown;
|
|
333
|
-
response: {
|
|
334
|
-
200: {
|
|
335
|
-
resource: string;
|
|
336
|
-
scopes_supported: string[];
|
|
337
|
-
resource_name?: string | undefined;
|
|
338
|
-
resource_logo_uri?: string | undefined;
|
|
339
|
-
authorization_servers: string[];
|
|
340
|
-
bearer_methods_supported: string[];
|
|
341
|
-
};
|
|
342
|
-
};
|
|
343
|
-
};
|
|
344
|
-
};
|
|
345
|
-
} & {
|
|
346
|
-
[x: string]: {
|
|
347
|
-
get: {
|
|
348
|
-
body: unknown;
|
|
349
|
-
params: {};
|
|
350
|
-
query: unknown;
|
|
351
|
-
headers: unknown;
|
|
352
|
-
response: {
|
|
353
|
-
200: Response;
|
|
354
|
-
};
|
|
355
|
-
};
|
|
356
|
-
};
|
|
357
|
-
} & {
|
|
358
|
-
[x: string]: {
|
|
359
|
-
get: {
|
|
360
|
-
body: unknown;
|
|
361
|
-
params: {};
|
|
362
|
-
query: unknown;
|
|
363
|
-
headers: unknown;
|
|
364
|
-
response: {
|
|
365
|
-
200: Response;
|
|
366
|
-
};
|
|
367
|
-
};
|
|
368
|
-
};
|
|
369
|
-
} & {
|
|
370
|
-
[x: string]: {
|
|
371
|
-
post: {
|
|
372
|
-
body: unknown;
|
|
373
|
-
params: {};
|
|
374
|
-
query: unknown;
|
|
375
|
-
headers: unknown;
|
|
376
|
-
response: {
|
|
377
|
-
200: Response;
|
|
378
|
-
};
|
|
379
|
-
};
|
|
380
|
-
};
|
|
381
|
-
} & {
|
|
382
|
-
[x: string]: {
|
|
383
|
-
post: {
|
|
384
|
-
body: unknown;
|
|
385
|
-
params: {};
|
|
386
|
-
query: unknown;
|
|
387
|
-
headers: unknown;
|
|
388
|
-
response: {
|
|
389
|
-
200: Response;
|
|
390
|
-
};
|
|
391
|
-
};
|
|
392
|
-
};
|
|
393
|
-
} & {
|
|
394
|
-
[x: string]: {
|
|
395
|
-
post: {
|
|
396
|
-
body: unknown;
|
|
397
|
-
params: {};
|
|
398
|
-
query: unknown;
|
|
399
|
-
headers: unknown;
|
|
400
|
-
response: {
|
|
401
|
-
200: Response;
|
|
402
|
-
};
|
|
403
|
-
};
|
|
404
|
-
};
|
|
405
|
-
}, {
|
|
406
|
-
derive: {};
|
|
407
|
-
resolve: {};
|
|
408
|
-
schema: {};
|
|
409
|
-
standaloneSchema: {};
|
|
410
|
-
response: {};
|
|
411
|
-
}, {
|
|
412
|
-
derive: {};
|
|
413
|
-
resolve: {};
|
|
414
|
-
schema: {};
|
|
415
|
-
standaloneSchema: {};
|
|
416
|
-
response: {};
|
|
417
116
|
}>>;
|
|
418
117
|
export * from './actions';
|
|
118
|
+
export type { AuthInstance } from './authInstance';
|
|
419
119
|
export * from './types';
|
|
420
120
|
export * from './typebox';
|
|
421
121
|
export * from './vault/config';
|