@absolutejs/auth 0.55.4 → 0.55.6
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 +6 -1
- package/dist/agents/context.d.ts +8 -8
- package/dist/agents/index.js +36 -6
- package/dist/agents/index.js.map +6 -5
- package/dist/agents/routes.d.ts +134 -27
- package/dist/apikeys/routes.d.ts +2 -2
- package/dist/authContext.d.ts +193 -0
- package/dist/authorization/protectPermission.d.ts +4 -4
- package/dist/compliance/routes.d.ts +2 -2
- package/dist/credentials/login.d.ts +6 -6
- package/dist/credentials/register.d.ts +2 -2
- package/dist/credentials/routes.d.ts +6 -6
- package/dist/htmx/configuredRoutes.d.ts +542 -0
- package/dist/htmx/routes.d.ts +4 -4
- package/dist/index.d.ts +3399 -8
- package/dist/index.js +658 -508
- package/dist/index.js.map +15 -12
- package/dist/mfa/challenge.d.ts +2 -2
- package/dist/mfa/management.d.ts +2 -2
- package/dist/mfa/routes.d.ts +4 -4
- package/dist/mfa/sms.d.ts +4 -4
- package/dist/mfa/totp.d.ts +2 -2
- package/dist/oidc/routes.d.ts +14 -14
- package/dist/organizations/routes.d.ts +4 -3
- package/dist/passwordless/routes.d.ts +7 -6
- package/dist/pluginIdentity.d.ts +2 -0
- package/dist/portal/routes.d.ts +3 -3
- package/dist/roles/routes.d.ts +4 -3
- package/dist/routes/callback.d.ts +2 -2
- package/dist/routes/profile.d.ts +2 -2
- package/dist/routes/protectRoute.d.ts +6 -6
- package/dist/routes/refresh.d.ts +3 -3
- package/dist/routes/revoke.d.ts +3 -3
- package/dist/routes/sessions.d.ts +5 -5
- package/dist/routes/signout.d.ts +3 -3
- package/dist/routes/stepUp.d.ts +4 -4
- package/dist/routes/userStatus.d.ts +2 -2
- package/dist/server.d.ts +4 -3
- package/dist/server.js +657 -508
- package/dist/server.js.map +16 -13
- package/dist/session/access.d.ts +3 -3
- package/dist/session/cleanup.d.ts +3 -3
- package/dist/session/state.d.ts +3 -3
- package/dist/session/types.d.ts +1 -0
- package/dist/sso/discoveryRoute.d.ts +1 -1
- package/dist/sso/oidcRoutes.d.ts +4 -4
- package/dist/sso/samlIdpRoutes.d.ts +3 -3
- package/dist/sso/samlRoutes.d.ts +7 -6
- package/dist/webauthn/routes.d.ts +2 -2
- package/package.json +1 -1
- package/dist/authInstance.d.ts +0 -7
- package/dist/session/internalData.d.ts +0 -34
package/dist/agents/routes.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
1
2
|
import { type AgentAuthConfig } from './config';
|
|
2
3
|
import { agentAuthChallenge } from './context';
|
|
3
4
|
import { agentRegistrationDiscoveryMetadata } from './registration';
|
|
4
5
|
export { agentAuthChallenge, agentRegistrationDiscoveryMetadata };
|
|
5
|
-
export declare const agentAuthPlugin: (config?: AgentAuthConfig) =>
|
|
6
|
+
export declare const agentAuthPlugin: (config?: AgentAuthConfig) => Elysia<"", {
|
|
6
7
|
decorator: {};
|
|
7
8
|
store: {};
|
|
8
9
|
derive: {
|
|
@@ -27,6 +28,132 @@ export declare const agentAuthPlugin: (config?: AgentAuthConfig) => import("elys
|
|
|
27
28
|
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
28
29
|
}) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
29
30
|
}>;
|
|
31
|
+
}, {} | {
|
|
32
|
+
[x: string]: {
|
|
33
|
+
get: {
|
|
34
|
+
body: unknown;
|
|
35
|
+
params: {};
|
|
36
|
+
query: unknown;
|
|
37
|
+
headers: unknown;
|
|
38
|
+
response: {
|
|
39
|
+
200: {
|
|
40
|
+
resource: string;
|
|
41
|
+
scopes_supported: string[];
|
|
42
|
+
resource_name?: string | undefined;
|
|
43
|
+
resource_logo_uri?: string | undefined;
|
|
44
|
+
authorization_servers: string[];
|
|
45
|
+
bearer_methods_supported: string[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
} | ({
|
|
51
|
+
[x: string]: {
|
|
52
|
+
get: {
|
|
53
|
+
body: unknown;
|
|
54
|
+
params: {};
|
|
55
|
+
query: unknown;
|
|
56
|
+
headers: unknown;
|
|
57
|
+
response: {
|
|
58
|
+
200: {
|
|
59
|
+
resource: string;
|
|
60
|
+
scopes_supported: string[];
|
|
61
|
+
resource_name?: string | undefined;
|
|
62
|
+
resource_logo_uri?: string | undefined;
|
|
63
|
+
authorization_servers: string[];
|
|
64
|
+
bearer_methods_supported: string[];
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
} & {
|
|
70
|
+
[x: string]: {
|
|
71
|
+
get: {
|
|
72
|
+
body: unknown;
|
|
73
|
+
params: {};
|
|
74
|
+
query: unknown;
|
|
75
|
+
headers: unknown;
|
|
76
|
+
response: {
|
|
77
|
+
200: Response;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
} & {
|
|
82
|
+
[x: string]: {
|
|
83
|
+
get: {
|
|
84
|
+
body: unknown;
|
|
85
|
+
params: {};
|
|
86
|
+
query: unknown;
|
|
87
|
+
headers: unknown;
|
|
88
|
+
response: {
|
|
89
|
+
200: Response;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
} & {
|
|
94
|
+
[x: string]: {
|
|
95
|
+
post: {
|
|
96
|
+
body: unknown;
|
|
97
|
+
params: {};
|
|
98
|
+
query: unknown;
|
|
99
|
+
headers: unknown;
|
|
100
|
+
response: {
|
|
101
|
+
200: Response;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
} & {
|
|
106
|
+
[x: string]: {
|
|
107
|
+
post: {
|
|
108
|
+
body: unknown;
|
|
109
|
+
params: {};
|
|
110
|
+
query: unknown;
|
|
111
|
+
headers: unknown;
|
|
112
|
+
response: {
|
|
113
|
+
200: Response;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
} & {
|
|
118
|
+
[x: string]: {
|
|
119
|
+
post: {
|
|
120
|
+
body: unknown;
|
|
121
|
+
params: {};
|
|
122
|
+
query: unknown;
|
|
123
|
+
headers: unknown;
|
|
124
|
+
response: {
|
|
125
|
+
200: Response;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
}), {
|
|
130
|
+
derive: {};
|
|
131
|
+
resolve: {};
|
|
132
|
+
schema: {};
|
|
133
|
+
standaloneSchema: {};
|
|
134
|
+
response: {};
|
|
135
|
+
}, {
|
|
136
|
+
derive: {};
|
|
137
|
+
resolve: {};
|
|
138
|
+
schema: {};
|
|
139
|
+
standaloneSchema: {};
|
|
140
|
+
response: {};
|
|
141
|
+
}>;
|
|
142
|
+
export declare const agentAuthRoutes: (config?: AgentAuthConfig) => Elysia<"", {
|
|
143
|
+
decorator: {};
|
|
144
|
+
store: {};
|
|
145
|
+
derive: {};
|
|
146
|
+
resolve: {};
|
|
147
|
+
}, {
|
|
148
|
+
typebox: {};
|
|
149
|
+
error: {};
|
|
150
|
+
}, {
|
|
151
|
+
schema: {};
|
|
152
|
+
standaloneSchema: {};
|
|
153
|
+
macro: {};
|
|
154
|
+
macroFn: {};
|
|
155
|
+
parser: {};
|
|
156
|
+
response: {};
|
|
30
157
|
}, {}, {
|
|
31
158
|
derive: {};
|
|
32
159
|
resolve: {};
|
|
@@ -39,15 +166,10 @@ export declare const agentAuthPlugin: (config?: AgentAuthConfig) => import("elys
|
|
|
39
166
|
schema: {};
|
|
40
167
|
standaloneSchema: {};
|
|
41
168
|
response: {};
|
|
42
|
-
}> |
|
|
169
|
+
}> | Elysia<"", {
|
|
43
170
|
decorator: {};
|
|
44
171
|
store: {};
|
|
45
|
-
derive: {
|
|
46
|
-
readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: import("./types").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
47
|
-
code: "Forbidden" | "Unauthorized";
|
|
48
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
49
|
-
}) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
50
|
-
};
|
|
172
|
+
derive: {};
|
|
51
173
|
resolve: {};
|
|
52
174
|
}, {
|
|
53
175
|
typebox: {};
|
|
@@ -58,12 +180,7 @@ export declare const agentAuthPlugin: (config?: AgentAuthConfig) => import("elys
|
|
|
58
180
|
macro: {};
|
|
59
181
|
macroFn: {};
|
|
60
182
|
parser: {};
|
|
61
|
-
response:
|
|
62
|
-
readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: import("./types").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
63
|
-
code: "Forbidden" | "Unauthorized";
|
|
64
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
65
|
-
}) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
66
|
-
}>;
|
|
183
|
+
response: {};
|
|
67
184
|
}, {
|
|
68
185
|
[x: string]: {
|
|
69
186
|
get: {
|
|
@@ -95,15 +212,10 @@ export declare const agentAuthPlugin: (config?: AgentAuthConfig) => import("elys
|
|
|
95
212
|
schema: {};
|
|
96
213
|
standaloneSchema: {};
|
|
97
214
|
response: {};
|
|
98
|
-
}> |
|
|
215
|
+
}> | Elysia<"", {
|
|
99
216
|
decorator: {};
|
|
100
217
|
store: {};
|
|
101
|
-
derive: {
|
|
102
|
-
readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: import("./types").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
103
|
-
code: "Forbidden" | "Unauthorized";
|
|
104
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
105
|
-
}) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
106
|
-
};
|
|
218
|
+
derive: {};
|
|
107
219
|
resolve: {};
|
|
108
220
|
}, {
|
|
109
221
|
typebox: {};
|
|
@@ -114,12 +226,7 @@ export declare const agentAuthPlugin: (config?: AgentAuthConfig) => import("elys
|
|
|
114
226
|
macro: {};
|
|
115
227
|
macroFn: {};
|
|
116
228
|
parser: {};
|
|
117
|
-
response:
|
|
118
|
-
readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: import("./types").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
119
|
-
code: "Forbidden" | "Unauthorized";
|
|
120
|
-
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
121
|
-
}) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
122
|
-
}>;
|
|
229
|
+
response: {};
|
|
123
230
|
}, {
|
|
124
231
|
[x: string]: {
|
|
125
232
|
get: {
|
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,193 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { AgentAuthConfig } from './agents/config';
|
|
3
|
+
import type { AuditEmitter } from './audit/config';
|
|
4
|
+
import type { AuthorizationConfig } from './authorization/config';
|
|
5
|
+
import type { AuthSessionStore } from './session/types';
|
|
6
|
+
export declare const createAuthContext: <UserType>({ agentAuth, authSessionStore, authorization, emit, seedSource }: {
|
|
7
|
+
agentAuth?: AgentAuthConfig;
|
|
8
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
9
|
+
authorization?: AuthorizationConfig<UserType>;
|
|
10
|
+
emit?: AuditEmitter;
|
|
11
|
+
seedSource?: object;
|
|
12
|
+
}) => Elysia<"", {
|
|
13
|
+
decorator: {};
|
|
14
|
+
store: {
|
|
15
|
+
session: import("./types").SessionRecord<UserType>;
|
|
16
|
+
unregisteredSession: import("./types").UnregisteredSessionRecord;
|
|
17
|
+
};
|
|
18
|
+
derive: ({
|
|
19
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
20
|
+
readonly code: "Bad Request";
|
|
21
|
+
readonly message: "Cookies are missing";
|
|
22
|
+
} | {
|
|
23
|
+
readonly code: "Unauthorized";
|
|
24
|
+
readonly message: "User is not authenticated";
|
|
25
|
+
}) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
26
|
+
} & {
|
|
27
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
28
|
+
readonly code: "Unauthorized";
|
|
29
|
+
readonly message: "Recent authentication required";
|
|
30
|
+
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
31
|
+
} & {
|
|
32
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
33
|
+
code: "Forbidden" | "Unauthorized";
|
|
34
|
+
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
35
|
+
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
36
|
+
}) | ({
|
|
37
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
38
|
+
readonly code: "Bad Request";
|
|
39
|
+
readonly message: "Cookies are missing";
|
|
40
|
+
} | {
|
|
41
|
+
readonly code: "Unauthorized";
|
|
42
|
+
readonly message: "User is not authenticated";
|
|
43
|
+
}) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
44
|
+
} & {
|
|
45
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
46
|
+
readonly code: "Unauthorized";
|
|
47
|
+
readonly message: "Recent authentication required";
|
|
48
|
+
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
49
|
+
} & {
|
|
50
|
+
readonly protectPermission: <AuthReturn, AuthFailReturn_3>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
51
|
+
readonly code: "Bad Request";
|
|
52
|
+
readonly message: "Cookies are missing";
|
|
53
|
+
} | {
|
|
54
|
+
readonly code: "Forbidden";
|
|
55
|
+
readonly message: "Insufficient permissions";
|
|
56
|
+
} | {
|
|
57
|
+
readonly code: "Unauthorized";
|
|
58
|
+
readonly message: "User is not authenticated";
|
|
59
|
+
}) => AuthFailReturn_3) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaCustomStatusResponse<"Forbidden", "Insufficient permissions", 403> | AuthReturn | NonNullable<AuthFailReturn_3>>;
|
|
60
|
+
} & {
|
|
61
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
62
|
+
code: "Forbidden" | "Unauthorized";
|
|
63
|
+
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
64
|
+
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
65
|
+
});
|
|
66
|
+
resolve: {};
|
|
67
|
+
}, {
|
|
68
|
+
typebox: {};
|
|
69
|
+
error: {};
|
|
70
|
+
} & {
|
|
71
|
+
typebox: {};
|
|
72
|
+
error: {};
|
|
73
|
+
}, ({
|
|
74
|
+
schema: {};
|
|
75
|
+
standaloneSchema: {};
|
|
76
|
+
macro: {};
|
|
77
|
+
macroFn: {};
|
|
78
|
+
parser: {};
|
|
79
|
+
response: {};
|
|
80
|
+
} & {
|
|
81
|
+
schema: import("elysia").UnwrapRoute<{
|
|
82
|
+
cookie: import("@sinclair/typebox").TObject<{
|
|
83
|
+
user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
|
|
84
|
+
}>;
|
|
85
|
+
}, {}, "">;
|
|
86
|
+
standaloneSchema: {};
|
|
87
|
+
macro: {};
|
|
88
|
+
macroFn: {};
|
|
89
|
+
parser: {};
|
|
90
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
91
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
92
|
+
readonly code: "Bad Request";
|
|
93
|
+
readonly message: "Cookies are missing";
|
|
94
|
+
} | {
|
|
95
|
+
readonly code: "Unauthorized";
|
|
96
|
+
readonly message: "User is not authenticated";
|
|
97
|
+
}) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
98
|
+
}>;
|
|
99
|
+
} & {
|
|
100
|
+
schema: import("elysia").UnwrapRoute<{
|
|
101
|
+
cookie: import("@sinclair/typebox").TObject<{
|
|
102
|
+
user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
|
|
103
|
+
}>;
|
|
104
|
+
}, {}, "">;
|
|
105
|
+
standaloneSchema: {};
|
|
106
|
+
macro: {};
|
|
107
|
+
macroFn: {};
|
|
108
|
+
parser: {};
|
|
109
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
110
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
111
|
+
readonly code: "Unauthorized";
|
|
112
|
+
readonly message: "Recent authentication required";
|
|
113
|
+
}) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
|
|
114
|
+
}>;
|
|
115
|
+
} & ({
|
|
116
|
+
schema: {};
|
|
117
|
+
standaloneSchema: {};
|
|
118
|
+
macro: {};
|
|
119
|
+
macroFn: {};
|
|
120
|
+
parser: {};
|
|
121
|
+
response: {};
|
|
122
|
+
} | {
|
|
123
|
+
schema: import("elysia").UnwrapRoute<{
|
|
124
|
+
cookie: import("@sinclair/typebox").TObject<{
|
|
125
|
+
user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
|
|
126
|
+
}>;
|
|
127
|
+
}, {}, "">;
|
|
128
|
+
standaloneSchema: {};
|
|
129
|
+
macro: {};
|
|
130
|
+
macroFn: {};
|
|
131
|
+
parser: {};
|
|
132
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
133
|
+
readonly protectPermission: <AuthReturn, AuthFailReturn_3>(check: import(".").PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
134
|
+
readonly code: "Bad Request";
|
|
135
|
+
readonly message: "Cookies are missing";
|
|
136
|
+
} | {
|
|
137
|
+
readonly code: "Forbidden";
|
|
138
|
+
readonly message: "Insufficient permissions";
|
|
139
|
+
} | {
|
|
140
|
+
readonly code: "Unauthorized";
|
|
141
|
+
readonly message: "User is not authenticated";
|
|
142
|
+
}) => AuthFailReturn_3) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaCustomStatusResponse<"Forbidden", "Insufficient permissions", 403> | AuthReturn | NonNullable<AuthFailReturn_3>>;
|
|
143
|
+
}>;
|
|
144
|
+
})) & {
|
|
145
|
+
schema: {};
|
|
146
|
+
standaloneSchema: {};
|
|
147
|
+
macro: {};
|
|
148
|
+
macroFn: {};
|
|
149
|
+
parser: {};
|
|
150
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
151
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
|
|
152
|
+
code: "Forbidden" | "Unauthorized";
|
|
153
|
+
message: "Agent is not authenticated" | "Insufficient agent scopes";
|
|
154
|
+
}) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
|
|
155
|
+
}>;
|
|
156
|
+
}, {}, {
|
|
157
|
+
derive: {};
|
|
158
|
+
resolve: {};
|
|
159
|
+
schema: {};
|
|
160
|
+
standaloneSchema: {};
|
|
161
|
+
response: {};
|
|
162
|
+
}, ({
|
|
163
|
+
derive: {};
|
|
164
|
+
resolve: {};
|
|
165
|
+
schema: {};
|
|
166
|
+
standaloneSchema: {};
|
|
167
|
+
response: {};
|
|
168
|
+
} & {
|
|
169
|
+
derive: {};
|
|
170
|
+
resolve: {};
|
|
171
|
+
schema: {};
|
|
172
|
+
standaloneSchema: {};
|
|
173
|
+
response: {};
|
|
174
|
+
}) | ({
|
|
175
|
+
derive: {};
|
|
176
|
+
resolve: {};
|
|
177
|
+
schema: {};
|
|
178
|
+
standaloneSchema: {};
|
|
179
|
+
response: {};
|
|
180
|
+
} & {
|
|
181
|
+
derive: {};
|
|
182
|
+
resolve: {};
|
|
183
|
+
schema: {};
|
|
184
|
+
standaloneSchema: {};
|
|
185
|
+
response: {};
|
|
186
|
+
} & {
|
|
187
|
+
derive: {};
|
|
188
|
+
resolve: {};
|
|
189
|
+
schema: {};
|
|
190
|
+
standaloneSchema: {};
|
|
191
|
+
response: {};
|
|
192
|
+
})>;
|
|
193
|
+
export type AuthInstance<UserType> = ReturnType<typeof createAuthContext<UserType>>;
|
|
@@ -13,11 +13,11 @@ type PermissionFailError = {
|
|
|
13
13
|
export declare const protectPermissionPlugin: <UserType>({ authSessionStore, emit, hasPermission }: AuthorizationPluginProps<UserType>) => Elysia<"", {
|
|
14
14
|
decorator: {};
|
|
15
15
|
store: {
|
|
16
|
-
session: import("
|
|
17
|
-
unregisteredSession: import("
|
|
16
|
+
session: import("..").SessionRecord<UserType>;
|
|
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<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> |
|
|
20
|
+
readonly protectPermission: <AuthReturn, AuthFailReturn>(check: PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: PermissionFailError) => AuthFailReturn) => Promise<AuthReturn | import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | NonNullable<AuthFailReturn> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | 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<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> |
|
|
37
|
+
readonly protectPermission: <AuthReturn, AuthFailReturn>(check: PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: PermissionFailError) => AuthFailReturn) => Promise<AuthReturn | import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | NonNullable<AuthFailReturn> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaCustomStatusResponse<"Forbidden", "Insufficient permissions", 403>>;
|
|
38
38
|
}>;
|
|
39
39
|
}, {}, {
|
|
40
40
|
derive: {};
|
|
@@ -3,8 +3,8 @@ import type { CompliancePluginProps } from './config';
|
|
|
3
3
|
export declare const complianceRoutes: <UserType>({ authSessionStore, complianceRoute, deleteUserData, emit, exportUserData, getUserId }: CompliancePluginProps<UserType>) => Elysia<"", {
|
|
4
4
|
decorator: {};
|
|
5
5
|
store: {
|
|
6
|
-
session: import("
|
|
7
|
-
unregisteredSession: import("
|
|
6
|
+
session: import("..").SessionRecord<UserType>;
|
|
7
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
8
8
|
};
|
|
9
9
|
derive: {};
|
|
10
10
|
resolve: {};
|
|
@@ -3,8 +3,8 @@ import { type CredentialRouteProps } from './config';
|
|
|
3
3
|
export declare const credentialsLogin: <UserType>({ authSessionStore, checkBreachesOnLogin, cookieSecure, credentialStore, getUserByEmail, isMfaRequired, lockoutGuard, loginRoute, onCredentialsLoginError, onCredentialsLoginSuccess, passwordVerifier, rehashOnLogin, requireEmailVerification, sessionDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
|
|
4
4
|
decorator: {};
|
|
5
5
|
store: {
|
|
6
|
-
session: import("
|
|
7
|
-
unregisteredSession: import("
|
|
6
|
+
session: import("..").SessionRecord<UserType>;
|
|
7
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
8
8
|
};
|
|
9
9
|
derive: {};
|
|
10
10
|
resolve: {};
|
|
@@ -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
|
};
|
|
@@ -3,8 +3,8 @@ import { type CredentialRouteProps } from './config';
|
|
|
3
3
|
export declare const credentialsRegister: <UserType>({ authSessionStore, cookieSecure, credentialStore, onCreateCredentialUser, onCredentialsLoginSuccess, onRegistrationSuccess, onSendEmail, passwordPolicy, registerRoute, requireEmailVerification, sessionDurationMs, verificationTokenDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
|
|
4
4
|
decorator: {};
|
|
5
5
|
store: {
|
|
6
|
-
session: import("
|
|
7
|
-
unregisteredSession: import("
|
|
6
|
+
session: import("..").SessionRecord<UserType>;
|
|
7
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
8
8
|
};
|
|
9
9
|
derive: {};
|
|
10
10
|
resolve: {};
|
|
@@ -3,8 +3,8 @@ import type { CredentialRouteProps } from './config';
|
|
|
3
3
|
export declare const credentialRoutes: <UserType>(config: CredentialRouteProps<UserType>) => Elysia<"", {
|
|
4
4
|
decorator: {};
|
|
5
5
|
store: {
|
|
6
|
-
session: import("
|
|
7
|
-
unregisteredSession: import("
|
|
6
|
+
session: import("..").SessionRecord<UserType>;
|
|
7
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
8
8
|
};
|
|
9
9
|
derive: {};
|
|
10
10
|
resolve: {};
|
|
@@ -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
|
};
|