@absolutejs/auth 0.25.1 → 0.26.0-beta.0
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/audit/config.d.ts +8 -0
- package/dist/audit/inMemoryAuditStore.d.ts +2 -0
- package/dist/audit/postgresAuditStore.d.ts +142 -0
- package/dist/audit/types.d.ts +18 -0
- package/dist/audit/wrap.d.ts +9 -0
- package/dist/credentials/config.d.ts +61 -0
- package/dist/credentials/emailVerification.d.ts +83 -0
- package/dist/credentials/inMemoryCredentialStore.d.ts +2 -0
- package/dist/credentials/login.d.ts +75 -0
- package/dist/credentials/passwordPolicy.d.ts +14 -0
- package/dist/credentials/passwordReset.d.ts +87 -0
- package/dist/credentials/postgresCredentialStore.d.ts +279 -0
- package/dist/credentials/register.d.ts +54 -0
- package/dist/credentials/routes.d.ts +200 -0
- package/dist/credentials/types.d.ts +26 -0
- package/dist/crypto.d.ts +32 -0
- package/dist/{ui → htmx}/index.js +2 -2
- package/dist/{ui → htmx}/index.js.map +2 -2
- package/dist/{htmxRoutes.d.ts → htmx/routes.d.ts} +4 -4
- package/dist/index.d.ts +427 -27
- package/dist/index.js +3314 -1932
- package/dist/index.js.map +60 -27
- package/dist/{neonLinkedProviders.d.ts → linkedProviders/neonStores.d.ts} +619 -613
- package/dist/{oauthLinkedProviderResolver.d.ts → linkedProviders/oauthResolver.d.ts} +1 -1
- package/dist/lockout/config.d.ts +17 -0
- package/dist/lockout/inMemoryLockoutStore.d.ts +2 -0
- package/dist/lockout/postgresLockoutStore.d.ts +81 -0
- package/dist/lockout/types.d.ts +12 -0
- package/dist/mfa/backupCodes.d.ts +5 -0
- package/dist/mfa/challenge.d.ts +65 -0
- package/dist/mfa/config.d.ts +32 -0
- package/dist/mfa/gate.d.ts +2 -0
- package/dist/mfa/inMemoryMfaStore.d.ts +2 -0
- package/dist/mfa/postgresMfaStore.d.ts +134 -0
- package/dist/mfa/routes.d.ts +117 -0
- package/dist/mfa/secret.d.ts +2 -0
- package/dist/mfa/totp.d.ts +91 -0
- package/dist/mfa/types.d.ts +16 -0
- package/dist/{providerClients.d.ts → providers/clients.d.ts} +35 -19
- package/dist/{authorize.d.ts → routes/authorize.d.ts} +5 -5
- package/dist/{callback.d.ts → routes/callback.d.ts} +4 -4
- package/dist/{profile.d.ts → routes/profile.d.ts} +5 -5
- package/dist/{protectRoute.d.ts → routes/protectRoute.d.ts} +5 -5
- package/dist/{refresh.d.ts → routes/refresh.d.ts} +5 -5
- package/dist/{revoke.d.ts → routes/revoke.d.ts} +6 -6
- package/dist/routes/sessions.d.ts +103 -0
- package/dist/{signout.d.ts → routes/signout.d.ts} +4 -4
- package/dist/routes/stepUp.d.ts +48 -0
- package/dist/{userStatus.d.ts → routes/userStatus.d.ts} +4 -4
- package/dist/{sessionAccess.d.ts → session/access.d.ts} +12 -12
- package/dist/{sessionCleanup.d.ts → session/cleanup.d.ts} +2 -2
- package/dist/{authSessionStores.d.ts → session/inMemoryStore.d.ts} +2 -2
- package/dist/{neonAuthSessionStore.d.ts → session/neonStore.d.ts} +209 -175
- package/dist/session/promote.d.ts +13 -0
- package/dist/session/sessionsConfig.d.ts +9 -0
- package/dist/{sessionStore.d.ts → session/state.d.ts} +1 -1
- package/dist/{sessionTypes.d.ts → session/types.d.ts} +1 -1
- package/dist/session/userSessions.d.ts +16 -0
- package/dist/stores/postgres.d.ts +5 -0
- package/dist/tenancy.d.ts +9 -0
- package/dist/typeGuards.d.ts +2 -2
- package/dist/typebox.d.ts +3 -3
- package/dist/types.d.ts +33 -3
- package/dist/utils.d.ts +9 -9
- package/package.json +19 -16
- /package/dist/{ui → htmx}/index.d.ts +0 -0
- /package/dist/{ui → htmx}/renderers.d.ts +0 -0
- /package/dist/{ui → htmx}/types.d.ts +0 -0
- /package/dist/{linkedProviderStores.d.ts → linkedProviders/inMemoryStores.d.ts} +0 -0
- /package/dist/{linkedProviderResolver.d.ts → linkedProviders/resolver.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import { AuthorizeRoute, ClientProviders, OnAuthorizeError, OnAuthorizeSuccess } from '
|
|
2
|
+
import { AuthorizeRoute, ClientProviders, OnAuthorizeError, OnAuthorizeSuccess } from '../types';
|
|
3
3
|
type AuthorizeProps = {
|
|
4
4
|
clientProviders: ClientProviders;
|
|
5
5
|
authorizeRoute?: AuthorizeRoute;
|
|
@@ -36,8 +36,8 @@ export declare const authorize: ({ clientProviders, authorizeRoute, onAuthorizeS
|
|
|
36
36
|
headers: unknown;
|
|
37
37
|
response: {
|
|
38
38
|
200: Response;
|
|
39
|
-
400: "
|
|
40
|
-
401: "Client provider not found" | "Client variant is required" | "Client variant not found"
|
|
39
|
+
400: "Cookies are missing" | "Provider is required";
|
|
40
|
+
401: "Provider is required" | "Client provider not found" | "Client variant is required" | "Client variant not found";
|
|
41
41
|
422: {
|
|
42
42
|
type: "validation";
|
|
43
43
|
on: string;
|
|
@@ -68,8 +68,8 @@ export declare const authorize: ({ clientProviders, authorizeRoute, onAuthorizeS
|
|
|
68
68
|
headers: unknown;
|
|
69
69
|
response: {
|
|
70
70
|
200: Response;
|
|
71
|
-
400: "
|
|
72
|
-
401: "Client provider not found" | "Client variant is required" | "Client variant not found"
|
|
71
|
+
400: "Cookies are missing" | "Provider is required";
|
|
72
|
+
401: "Provider is required" | "Client provider not found" | "Client variant is required" | "Client variant not found";
|
|
73
73
|
422: {
|
|
74
74
|
type: "validation";
|
|
75
75
|
on: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type { AuthSessionStore } from '
|
|
3
|
-
import { ClientProviders, OnCallbackError, OnCallbackSuccess, OnLinkConnector, OnLinkIdentity, OnLinkIdentityConflict, ResolveAuthIntent, RouteString } from '
|
|
2
|
+
import type { AuthSessionStore } from '../session/types';
|
|
3
|
+
import { ClientProviders, OnCallbackError, OnCallbackSuccess, OnLinkConnector, OnLinkIdentity, OnLinkIdentityConflict, ResolveAuthIntent, RouteString } from '../types';
|
|
4
4
|
type CallbackProps<UserType> = {
|
|
5
5
|
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
clientProviders: ClientProviders;
|
|
@@ -15,8 +15,8 @@ type CallbackProps<UserType> = {
|
|
|
15
15
|
export declare const callback: <UserType>({ authSessionStore, clientProviders, callbackRoute, resolveAuthIntent, onCallbackSuccess, onLinkIdentity, onLinkIdentityConflict, onLinkConnector, onCallbackError }: CallbackProps<UserType>) => Elysia<"", {
|
|
16
16
|
decorator: {};
|
|
17
17
|
store: {
|
|
18
|
-
session: import("
|
|
19
|
-
unregisteredSession: import("
|
|
18
|
+
session: import("..").SessionRecord<UserType>;
|
|
19
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
20
20
|
};
|
|
21
21
|
derive: {};
|
|
22
22
|
resolve: {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import { ClientProviders, OnProfileError, OnProfileSuccess, RouteString } from '
|
|
2
|
+
import { ClientProviders, OnProfileError, OnProfileSuccess, RouteString } from '../types';
|
|
3
3
|
type ProfileProps = {
|
|
4
4
|
clientProviders: ClientProviders;
|
|
5
5
|
profileRoute?: RouteString;
|
|
@@ -9,8 +9,8 @@ type ProfileProps = {
|
|
|
9
9
|
export declare const profile: <UserType>({ clientProviders, profileRoute, onProfileSuccess, onProfileError }: ProfileProps) => Elysia<"", {
|
|
10
10
|
decorator: {};
|
|
11
11
|
store: {
|
|
12
|
-
session: import("
|
|
13
|
-
unregisteredSession: import("
|
|
12
|
+
session: import("..").SessionRecord<UserType>;
|
|
13
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
14
14
|
};
|
|
15
15
|
derive: {};
|
|
16
16
|
resolve: {};
|
|
@@ -33,8 +33,8 @@ export declare const profile: <UserType>({ clientProviders, profileRoute, onProf
|
|
|
33
33
|
headers: unknown;
|
|
34
34
|
response: {
|
|
35
35
|
200: Response;
|
|
36
|
-
400: "Cookies are missing";
|
|
37
|
-
401: "Client provider not found" | "Client variant is required" | "Client variant not found" | "
|
|
36
|
+
400: "Cookies are missing" | "Session has no access token to fetch a profile";
|
|
37
|
+
401: "Provider is required" | "Client provider not found" | "Client variant is required" | "Client variant not found" | "No auth provider found" | "Invalid provider" | "No user session found";
|
|
38
38
|
422: {
|
|
39
39
|
type: "validation";
|
|
40
40
|
on: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type { AuthSessionStore } from '
|
|
2
|
+
import type { AuthSessionStore } from '../session/types';
|
|
3
3
|
type AuthFailError = {
|
|
4
4
|
readonly code: 'Bad Request';
|
|
5
5
|
readonly message: 'Cookies are missing';
|
|
@@ -12,11 +12,11 @@ export declare const protectRoutePlugin: <UserType>({ authSessionStore }?: {
|
|
|
12
12
|
}) => Elysia<"", {
|
|
13
13
|
decorator: {};
|
|
14
14
|
store: {
|
|
15
|
-
session: import("
|
|
16
|
-
unregisteredSession: import("
|
|
15
|
+
session: import("..").SessionRecord<UserType>;
|
|
16
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
17
17
|
};
|
|
18
18
|
derive: {
|
|
19
|
-
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> |
|
|
19
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<AuthReturn | import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | NonNullable<AuthFailReturn> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401>>;
|
|
20
20
|
};
|
|
21
21
|
resolve: {};
|
|
22
22
|
}, {
|
|
@@ -33,7 +33,7 @@ export declare const protectRoutePlugin: <UserType>({ authSessionStore }?: {
|
|
|
33
33
|
macroFn: {};
|
|
34
34
|
parser: {};
|
|
35
35
|
response: import("elysia").ExtractErrorFromHandle<{
|
|
36
|
-
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> |
|
|
36
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<AuthReturn | import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | NonNullable<AuthFailReturn> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401>>;
|
|
37
37
|
}>;
|
|
38
38
|
}, {}, {
|
|
39
39
|
derive: {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type { AuthSessionStore } from '
|
|
3
|
-
import { ClientProviders, OnRefreshError, OnRefreshSuccess, RouteString } from '
|
|
2
|
+
import type { AuthSessionStore } from '../session/types';
|
|
3
|
+
import { ClientProviders, OnRefreshError, OnRefreshSuccess, RouteString } from '../types';
|
|
4
4
|
type RefreshProps<UserType> = {
|
|
5
5
|
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
clientProviders: ClientProviders;
|
|
@@ -12,8 +12,8 @@ type RefreshProps<UserType> = {
|
|
|
12
12
|
export declare const refresh: <UserType>({ authSessionStore, clientProviders, refreshRoute, onRefreshSuccess, onRefreshError, sessionDurationMs }: RefreshProps<UserType>) => Elysia<"", {
|
|
13
13
|
decorator: {};
|
|
14
14
|
store: {
|
|
15
|
-
session: import("
|
|
16
|
-
unregisteredSession: import("
|
|
15
|
+
session: import("..").SessionRecord<UserType>;
|
|
16
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
17
17
|
};
|
|
18
18
|
derive: {};
|
|
19
19
|
resolve: {};
|
|
@@ -37,7 +37,7 @@ export declare const refresh: <UserType>({ authSessionStore, clientProviders, re
|
|
|
37
37
|
response: {
|
|
38
38
|
200: Response;
|
|
39
39
|
400: "Cookies are missing" | "Invalid provider" | "No refresh token found";
|
|
40
|
-
401: "Client provider not found" | "Client variant is required" | "Client variant not found" | "
|
|
40
|
+
401: "Provider is required" | "Client provider not found" | "Client variant is required" | "Client variant not found" | "No auth provider found" | "No user session found";
|
|
41
41
|
422: {
|
|
42
42
|
type: "validation";
|
|
43
43
|
on: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type { AuthSessionStore } from '
|
|
3
|
-
import { ClientProviders, OnRevocationError, OnRevocationSuccess, RouteString } from '
|
|
2
|
+
import type { AuthSessionStore } from '../session/types';
|
|
3
|
+
import { ClientProviders, OnRevocationError, OnRevocationSuccess, RouteString } from '../types';
|
|
4
4
|
type RevokeProps<UserType> = {
|
|
5
5
|
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
clientProviders: ClientProviders;
|
|
@@ -11,8 +11,8 @@ type RevokeProps<UserType> = {
|
|
|
11
11
|
export declare const revoke: <UserType>({ authSessionStore, clientProviders, revokeRoute, onRevocationSuccess, onRevocationError }: RevokeProps<UserType>) => Elysia<"", {
|
|
12
12
|
decorator: {};
|
|
13
13
|
store: {
|
|
14
|
-
session: import("
|
|
15
|
-
unregisteredSession: import("
|
|
14
|
+
session: import("..").SessionRecord<UserType>;
|
|
15
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
16
16
|
};
|
|
17
17
|
derive: {};
|
|
18
18
|
resolve: {};
|
|
@@ -35,8 +35,8 @@ export declare const revoke: <UserType>({ authSessionStore, clientProviders, rev
|
|
|
35
35
|
headers: unknown;
|
|
36
36
|
response: {
|
|
37
37
|
200: Response;
|
|
38
|
-
400: "Cookies are missing" | "Invalid provider";
|
|
39
|
-
401: "Client provider not found" | "Client variant is required" | "Client variant not found" | "
|
|
38
|
+
400: "Cookies are missing" | "Invalid provider" | "Session has no access token to revoke";
|
|
39
|
+
401: "Provider is required" | "Client provider not found" | "Client variant is required" | "Client variant not found" | "No auth provider found" | "No user session found";
|
|
40
40
|
422: {
|
|
41
41
|
type: "validation";
|
|
42
42
|
on: string;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { SessionsRouteProps } from '../session/sessionsConfig';
|
|
3
|
+
import type { UserSessionId } from '../types';
|
|
4
|
+
type SessionSummary = {
|
|
5
|
+
authenticatedAt?: number;
|
|
6
|
+
current: boolean;
|
|
7
|
+
expiresAt: number;
|
|
8
|
+
id: UserSessionId;
|
|
9
|
+
};
|
|
10
|
+
export declare const sessionRoutes: <UserType>({ authSessionStore, getUserId, sessionsRoute }: SessionsRouteProps<UserType>) => Elysia<"", {
|
|
11
|
+
decorator: {};
|
|
12
|
+
store: {
|
|
13
|
+
session: import("..").SessionRecord<UserType>;
|
|
14
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
15
|
+
};
|
|
16
|
+
derive: {};
|
|
17
|
+
resolve: {};
|
|
18
|
+
}, {
|
|
19
|
+
typebox: {};
|
|
20
|
+
error: {};
|
|
21
|
+
}, {
|
|
22
|
+
schema: {};
|
|
23
|
+
standaloneSchema: {};
|
|
24
|
+
macro: {};
|
|
25
|
+
macroFn: {};
|
|
26
|
+
parser: {};
|
|
27
|
+
response: {};
|
|
28
|
+
}, {
|
|
29
|
+
[x: string]: {
|
|
30
|
+
get: {
|
|
31
|
+
body: unknown;
|
|
32
|
+
params: {};
|
|
33
|
+
query: unknown;
|
|
34
|
+
headers: unknown;
|
|
35
|
+
response: {
|
|
36
|
+
200: {
|
|
37
|
+
readonly sessions: SessionSummary[];
|
|
38
|
+
};
|
|
39
|
+
401: "Authentication required";
|
|
40
|
+
422: {
|
|
41
|
+
type: "validation";
|
|
42
|
+
on: string;
|
|
43
|
+
summary?: string;
|
|
44
|
+
message?: string;
|
|
45
|
+
found?: unknown;
|
|
46
|
+
property?: string;
|
|
47
|
+
expected?: string;
|
|
48
|
+
};
|
|
49
|
+
501: "Session management requires an authSessionStore";
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
} & {
|
|
54
|
+
[x: string]: {
|
|
55
|
+
":id": {
|
|
56
|
+
delete: {
|
|
57
|
+
body: unknown;
|
|
58
|
+
params: {
|
|
59
|
+
id: string;
|
|
60
|
+
};
|
|
61
|
+
query: unknown;
|
|
62
|
+
headers: unknown;
|
|
63
|
+
response: {
|
|
64
|
+
200: {
|
|
65
|
+
readonly revoked: `${string}-${string}-${string}-${string}-${string}`;
|
|
66
|
+
};
|
|
67
|
+
400: "Invalid session id";
|
|
68
|
+
401: "Authentication required";
|
|
69
|
+
404: "Session not found";
|
|
70
|
+
422: {
|
|
71
|
+
type: "validation";
|
|
72
|
+
on: string;
|
|
73
|
+
summary?: string;
|
|
74
|
+
message?: string;
|
|
75
|
+
found?: unknown;
|
|
76
|
+
property?: string;
|
|
77
|
+
expected?: string;
|
|
78
|
+
};
|
|
79
|
+
501: "Session management requires an authSessionStore";
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}, {
|
|
85
|
+
derive: {};
|
|
86
|
+
resolve: {};
|
|
87
|
+
schema: {};
|
|
88
|
+
standaloneSchema: {};
|
|
89
|
+
response: {};
|
|
90
|
+
}, {
|
|
91
|
+
derive: {};
|
|
92
|
+
resolve: {};
|
|
93
|
+
schema: {};
|
|
94
|
+
standaloneSchema: {};
|
|
95
|
+
response: {};
|
|
96
|
+
} & {
|
|
97
|
+
derive: {};
|
|
98
|
+
resolve: {};
|
|
99
|
+
schema: {};
|
|
100
|
+
standaloneSchema: {};
|
|
101
|
+
response: {};
|
|
102
|
+
}>;
|
|
103
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type { AuthSessionStore } from '
|
|
3
|
-
import { OnSignOut, RouteString } from '
|
|
2
|
+
import type { AuthSessionStore } from '../session/types';
|
|
3
|
+
import { OnSignOut, RouteString } from '../types';
|
|
4
4
|
type SignOutProps<UserType> = {
|
|
5
5
|
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
signoutRoute?: RouteString;
|
|
@@ -9,8 +9,8 @@ type SignOutProps<UserType> = {
|
|
|
9
9
|
export declare const signout: <UserType>({ authSessionStore, signoutRoute, onSignOut }: SignOutProps<UserType>) => Elysia<"", {
|
|
10
10
|
decorator: {};
|
|
11
11
|
store: {
|
|
12
|
-
session: import("
|
|
13
|
-
unregisteredSession: import("
|
|
12
|
+
session: import("..").SessionRecord<UserType>;
|
|
13
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
14
14
|
};
|
|
15
15
|
derive: {};
|
|
16
16
|
resolve: {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { AuthSessionStore } from '../session/types';
|
|
3
|
+
type ReauthFailError = {
|
|
4
|
+
readonly code: 'Unauthorized';
|
|
5
|
+
readonly message: 'Recent authentication required';
|
|
6
|
+
};
|
|
7
|
+
export declare const stepUpPlugin: <UserType>({ authSessionStore }?: {
|
|
8
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
9
|
+
}) => Elysia<"", {
|
|
10
|
+
decorator: {};
|
|
11
|
+
store: {
|
|
12
|
+
session: import("..").SessionRecord<UserType>;
|
|
13
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
14
|
+
};
|
|
15
|
+
derive: {
|
|
16
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: ReauthFailError) => AuthFailReturn) => Promise<AuthReturn | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | NonNullable<AuthFailReturn>>;
|
|
17
|
+
};
|
|
18
|
+
resolve: {};
|
|
19
|
+
}, {
|
|
20
|
+
typebox: {};
|
|
21
|
+
error: {};
|
|
22
|
+
}, {
|
|
23
|
+
schema: import("elysia").UnwrapRoute<{
|
|
24
|
+
cookie: import("@sinclair/typebox").TObject<{
|
|
25
|
+
user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
|
|
26
|
+
}>;
|
|
27
|
+
}, {}, "">;
|
|
28
|
+
standaloneSchema: {};
|
|
29
|
+
macro: {};
|
|
30
|
+
macroFn: {};
|
|
31
|
+
parser: {};
|
|
32
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
33
|
+
readonly requireRecentAuth: <AuthReturn, AuthFailReturn>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: ReauthFailError) => AuthFailReturn) => Promise<AuthReturn | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | NonNullable<AuthFailReturn>>;
|
|
34
|
+
}>;
|
|
35
|
+
}, {}, {
|
|
36
|
+
derive: {};
|
|
37
|
+
resolve: {};
|
|
38
|
+
schema: {};
|
|
39
|
+
standaloneSchema: {};
|
|
40
|
+
response: {};
|
|
41
|
+
}, {
|
|
42
|
+
derive: {};
|
|
43
|
+
resolve: {};
|
|
44
|
+
schema: {};
|
|
45
|
+
standaloneSchema: {};
|
|
46
|
+
response: {};
|
|
47
|
+
}>;
|
|
48
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type { AuthSessionStore } from '
|
|
3
|
-
import { OnStatus, RouteString } from '
|
|
2
|
+
import type { AuthSessionStore } from '../session/types';
|
|
3
|
+
import { OnStatus, RouteString } from '../types';
|
|
4
4
|
type StatusProps<UserType> = {
|
|
5
5
|
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
statusRoute?: RouteString;
|
|
@@ -9,8 +9,8 @@ type StatusProps<UserType> = {
|
|
|
9
9
|
export declare const userStatus: <UserType>({ authSessionStore, statusRoute, onStatus }: StatusProps<UserType>) => Elysia<"", {
|
|
10
10
|
decorator: {};
|
|
11
11
|
store: {
|
|
12
|
-
session: import("
|
|
13
|
-
unregisteredSession: import("
|
|
12
|
+
session: import("..").SessionRecord<UserType>;
|
|
13
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
14
14
|
};
|
|
15
15
|
derive: {};
|
|
16
16
|
resolve: {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Cookie } from 'elysia';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
export declare const
|
|
2
|
+
import type { SessionData, SessionRecord, UnregisteredSessionRecord, UserSessionId } from '../types';
|
|
3
|
+
import type { AuthSessionStore } from './types';
|
|
4
|
+
export declare const createSessionCompatibilityLayer: <UserType>({ authSessionStore, userSessionId }: {
|
|
5
5
|
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
|
-
session?: SessionRecord<UserType>;
|
|
7
6
|
userSessionId?: UserSessionId;
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
session: SessionRecord<UserType>;
|
|
9
|
+
unregisteredSession: UnregisteredSessionRecord;
|
|
10
|
+
persist: () => Promise<void>;
|
|
11
|
+
}>;
|
|
10
12
|
export declare const getStatusFromSource: <UserType>({ authSessionStore, session, user_session_id }: {
|
|
11
13
|
authSessionStore?: AuthSessionStore<UserType>;
|
|
12
14
|
session?: SessionRecord<UserType>;
|
|
@@ -21,11 +23,9 @@ export declare const getStatusFromSource: <UserType>({ authSessionStore, session
|
|
|
21
23
|
error: null;
|
|
22
24
|
user: NonNullable<UserType> | null;
|
|
23
25
|
}>;
|
|
24
|
-
export declare const
|
|
26
|
+
export declare const loadSessionFromSource: <UserType>({ authSessionStore, session, userSessionId, removeExpired }: {
|
|
25
27
|
authSessionStore?: AuthSessionStore<UserType>;
|
|
28
|
+
session?: SessionRecord<UserType>;
|
|
26
29
|
userSessionId?: UserSessionId;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
unregisteredSession: UnregisteredSessionRecord;
|
|
30
|
-
persist: () => Promise<void>;
|
|
31
|
-
}>;
|
|
30
|
+
removeExpired?: boolean;
|
|
31
|
+
}) => Promise<SessionData<UserType> | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { OnSessionCleanup, SessionRecord, UnregisteredSessionRecord } from '../types';
|
|
3
|
+
import type { AuthSessionStore } from './types';
|
|
4
4
|
type SessionCleanupProps<UserType> = {
|
|
5
5
|
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
cleanupIntervalMs?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { SessionData, UnregisteredSessionData, UserSessionId } from '../types';
|
|
2
|
+
import type { AuthSessionStore } from './types';
|
|
3
3
|
export type CreateInMemoryAuthSessionStoreOptions<UserType> = {
|
|
4
4
|
sessions?: Record<UserSessionId, SessionData<UserType>>;
|
|
5
5
|
unregisteredSessions?: Record<UserSessionId, UnregisteredSessionData>;
|