@absolutejs/auth 0.21.1 → 0.22.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/.claude/settings.local.json +5 -0
- package/CLAUDE.md +91 -0
- package/dist/index.js +215 -47
- package/dist/index.js.map +15 -14
- package/dist/src/authorize.d.ts +2 -2
- package/dist/src/callback.d.ts +1 -1
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/index.d.ts +16 -23
- package/dist/src/protectRoute.d.ts +1 -1
- package/dist/src/refresh.d.ts +3 -2
- package/dist/src/revoke.d.ts +1 -1
- package/dist/src/sessionCleanup.d.ts +38 -0
- package/dist/src/signout.d.ts +1 -1
- package/dist/src/typeGuards.d.ts +2 -1
- package/dist/src/types.d.ts +17 -4
- package/dist/src/userStatus.d.ts +5 -14
- package/dist/src/utils.d.ts +8 -3
- package/package.json +1 -1
package/dist/src/authorize.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare const authorize: ({ clientProviders, authorizeRoute, onAuthorizeS
|
|
|
34
34
|
200: Response;
|
|
35
35
|
400: "Cookies are missing" | "Provider is required";
|
|
36
36
|
401: "Client provider not found";
|
|
37
|
-
500:
|
|
37
|
+
500: "Failed to create authorization URL";
|
|
38
38
|
422: {
|
|
39
39
|
type: "validation";
|
|
40
40
|
on: string;
|
|
@@ -63,7 +63,7 @@ export declare const authorize: ({ clientProviders, authorizeRoute, onAuthorizeS
|
|
|
63
63
|
200: Response;
|
|
64
64
|
400: "Cookies are missing" | "Provider is required";
|
|
65
65
|
401: "Client provider not found";
|
|
66
|
-
500:
|
|
66
|
+
500: "Failed to create authorization URL";
|
|
67
67
|
422: {
|
|
68
68
|
type: "validation";
|
|
69
69
|
on: string;
|
package/dist/src/callback.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare const callback: <UserType>({ clientProviders, callbackRoute, onCa
|
|
|
35
35
|
200: any;
|
|
36
36
|
400: "Cookies are missing" | "Invalid callback request" | "Invalid state mismatch" | "Code verifier not found and is required";
|
|
37
37
|
401: "Client provider not found";
|
|
38
|
-
500:
|
|
38
|
+
500: "Failed to validate authorization code";
|
|
39
39
|
422: {
|
|
40
40
|
type: "validation";
|
|
41
41
|
on: string;
|
package/dist/src/constants.d.ts
CHANGED
package/dist/src/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
2
|
import { AbsoluteAuthProps } from './types';
|
|
3
|
-
export declare const absoluteAuth: <UserType>({ providersConfiguration, authorizeRoute, callbackRoute, profileRoute, signoutRoute, statusRoute, refreshRoute, revokeRoute, onAuthorizeSuccess, onAuthorizeError, onProfileSuccess, onProfileError, onCallbackSuccess, onCallbackError, onStatus, onRefreshSuccess, onRefreshError, onSignOut, onRevocationSuccess, onRevocationError }: AbsoluteAuthProps<UserType>) => Promise<Elysia<"", {
|
|
3
|
+
export declare const absoluteAuth: <UserType>({ providersConfiguration, authorizeRoute, callbackRoute, profileRoute, signoutRoute, statusRoute, refreshRoute, revokeRoute, cleanupIntervalMs, maxSessions, sessionDurationMs, onAuthorizeSuccess, onAuthorizeError, onProfileSuccess, onProfileError, onCallbackSuccess, onCallbackError, onStatus, onRefreshSuccess, onRefreshError, onSignOut, onRevocationSuccess, onRevocationError, onSessionCleanup }: AbsoluteAuthProps<UserType>) => Promise<Elysia<"", {
|
|
4
4
|
decorator: {};
|
|
5
5
|
store: {
|
|
6
6
|
session: import("./types").SessionRecord<UserType> & import("./types").SessionRecord<unknown>;
|
|
7
7
|
unregisteredSession: import("./types").UnregisteredSessionRecord;
|
|
8
8
|
};
|
|
9
9
|
derive: {
|
|
10
|
+
readonly cleanupSessions: () => Promise<void>;
|
|
10
11
|
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn, handleAuthFail?: ((error: {
|
|
11
12
|
readonly code: "Bad Request";
|
|
12
13
|
readonly message: "Cookies are missing";
|
|
@@ -45,7 +46,7 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
45
46
|
200: Response;
|
|
46
47
|
400: "Cookies are missing";
|
|
47
48
|
401: "No auth provider found" | "No user session id found";
|
|
48
|
-
500:
|
|
49
|
+
500: "Sign out operation failed";
|
|
49
50
|
422: {
|
|
50
51
|
type: "validation";
|
|
51
52
|
on: string;
|
|
@@ -70,7 +71,7 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
70
71
|
400: "Cookies are missing" | "Invalid provider";
|
|
71
72
|
401: "Client provider not found" | "No auth provider found" | "No user session found";
|
|
72
73
|
501: "Provider does not support revocation";
|
|
73
|
-
500:
|
|
74
|
+
500: "Failed to revoke token";
|
|
74
75
|
422: {
|
|
75
76
|
type: "validation";
|
|
76
77
|
on: string;
|
|
@@ -91,20 +92,11 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
91
92
|
query: unknown;
|
|
92
93
|
headers: unknown;
|
|
93
94
|
response: {
|
|
94
|
-
200:
|
|
95
|
-
|
|
96
|
-
422: {
|
|
97
|
-
type: "validation";
|
|
98
|
-
on: string;
|
|
99
|
-
summary?: string;
|
|
100
|
-
message?: string;
|
|
101
|
-
found?: unknown;
|
|
102
|
-
property?: string;
|
|
103
|
-
expected?: string;
|
|
95
|
+
200: {
|
|
96
|
+
user: NonNullable<UserType> | null extends import("elysia").ElysiaFile ? File : NonNullable<UserType> | null;
|
|
104
97
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
} & { [ErrorResponse in import("elysia/error").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia/error").ElysiaCustomStatusResponse<"Internal Server Error", `Error: ${string} - ${string}`, 500> | import("elysia/error").ElysiaCustomStatusResponse<"Internal Server Error", `Unknown Error: ${string}`, 500> | Extract<Awaited<NonNullable<UserType>>, import("elysia/error").ElysiaCustomStatusResponse<any, any, any>> as ErrorResponse extends import("elysia/error").ElysiaCustomStatusResponse<any, any, any> ? ErrorResponse["code"] : never]: ErrorResponse["response"]; } & {
|
|
98
|
+
400: "Cookies are missing";
|
|
99
|
+
500: `Error: ${string} - ${string}` | `Unknown Error: ${string}`;
|
|
108
100
|
422: {
|
|
109
101
|
type: "validation";
|
|
110
102
|
on: string;
|
|
@@ -114,7 +106,7 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
114
106
|
property?: string;
|
|
115
107
|
expected?: string;
|
|
116
108
|
};
|
|
117
|
-
}
|
|
109
|
+
};
|
|
118
110
|
};
|
|
119
111
|
};
|
|
120
112
|
} & ({
|
|
@@ -129,7 +121,7 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
129
121
|
400: "Cookies are missing" | "Invalid provider" | "No refresh token found";
|
|
130
122
|
401: "Client provider not found" | "No auth provider found" | "No user session found";
|
|
131
123
|
501: "Provider is not refreshable";
|
|
132
|
-
500:
|
|
124
|
+
500: "Failed to refresh token";
|
|
133
125
|
422: {
|
|
134
126
|
type: "validation";
|
|
135
127
|
on: string;
|
|
@@ -156,7 +148,7 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
156
148
|
200: Response;
|
|
157
149
|
400: "Cookies are missing" | "Provider is required";
|
|
158
150
|
401: "Client provider not found";
|
|
159
|
-
500:
|
|
151
|
+
500: "Failed to create authorization URL";
|
|
160
152
|
422: {
|
|
161
153
|
type: "validation";
|
|
162
154
|
on: string;
|
|
@@ -185,7 +177,7 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
185
177
|
200: Response;
|
|
186
178
|
400: "Cookies are missing" | "Provider is required";
|
|
187
179
|
401: "Client provider not found";
|
|
188
|
-
500:
|
|
180
|
+
500: "Failed to create authorization URL";
|
|
189
181
|
422: {
|
|
190
182
|
type: "validation";
|
|
191
183
|
on: string;
|
|
@@ -212,7 +204,7 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
212
204
|
200: any;
|
|
213
205
|
400: "Cookies are missing" | "Invalid callback request" | "Invalid state mismatch" | "Code verifier not found and is required";
|
|
214
206
|
401: "Client provider not found";
|
|
215
|
-
500:
|
|
207
|
+
500: "Failed to validate authorization code";
|
|
216
208
|
422: {
|
|
217
209
|
type: "validation";
|
|
218
210
|
on: string;
|
|
@@ -262,9 +254,10 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
262
254
|
}>>;
|
|
263
255
|
export * from './types';
|
|
264
256
|
export * from './typebox';
|
|
265
|
-
export { isValidUser } from './typeGuards';
|
|
257
|
+
export { isUserSessionId, isValidUser } from './typeGuards';
|
|
266
258
|
export { sessionStore } from './sessionStore';
|
|
267
|
-
export {
|
|
259
|
+
export { protectRoutePlugin } from './protectRoute';
|
|
260
|
+
export { sessionCleanup } from './sessionCleanup';
|
|
268
261
|
export * from './utils';
|
|
269
262
|
export type { OAuth2TokenResponse, OAuth2Client, ProviderOption, PKCEProvider, OIDCProvider, RefreshableProvider, RevocableProvider, ScopeRequiredProvider, ProvidersMap, ProviderConfiguration, CredentialsFor } from 'citra';
|
|
270
263
|
export { providers, providerOptions, refreshableProviderOptions, revocableProviderOptions, oidcProviderOptions, pkceProviderOptions, scopeRequiredProviderOptions, decodeJWT, extractPropFromIdentity, isValidProviderOption, isRefreshableOAuth2Client, isRefreshableProviderOption, isOIDCProviderOption, isPKCEProviderOption, isRevocableProviderOption, isRevocableOAuth2Client } from 'citra';
|
|
@@ -4,7 +4,7 @@ type AuthFailError = Exclude<Awaited<ReturnType<typeof getStatus>>['error'], nul
|
|
|
4
4
|
readonly code: 'Unauthorized';
|
|
5
5
|
readonly message: 'User is not authenticated';
|
|
6
6
|
};
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const protectRoutePlugin: <UserType>() => Elysia<"", {
|
|
8
8
|
decorator: {};
|
|
9
9
|
store: {
|
|
10
10
|
session: import("./types").SessionRecord<UserType>;
|
package/dist/src/refresh.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ type RefreshProps = {
|
|
|
5
5
|
refreshRoute?: RouteString;
|
|
6
6
|
onRefreshSuccess: OnRefreshSuccess;
|
|
7
7
|
onRefreshError: OnRefreshError;
|
|
8
|
+
sessionDurationMs?: number;
|
|
8
9
|
};
|
|
9
|
-
export declare const refresh: <UserType>({ clientProviders, refreshRoute, onRefreshSuccess, onRefreshError }: RefreshProps) => Elysia<"", {
|
|
10
|
+
export declare const refresh: <UserType>({ clientProviders, refreshRoute, onRefreshSuccess, onRefreshError, sessionDurationMs }: RefreshProps) => Elysia<"", {
|
|
10
11
|
decorator: {};
|
|
11
12
|
store: {
|
|
12
13
|
session: import("./types").SessionRecord<UserType>;
|
|
@@ -35,7 +36,7 @@ export declare const refresh: <UserType>({ clientProviders, refreshRoute, onRefr
|
|
|
35
36
|
400: "Cookies are missing" | "Invalid provider" | "No refresh token found";
|
|
36
37
|
401: "Client provider not found" | "No auth provider found" | "No user session found";
|
|
37
38
|
501: "Provider is not refreshable";
|
|
38
|
-
500:
|
|
39
|
+
500: "Failed to refresh token";
|
|
39
40
|
422: {
|
|
40
41
|
type: "validation";
|
|
41
42
|
on: string;
|
package/dist/src/revoke.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare const revoke: <UserType>({ clientProviders, revokeRoute, onRevoca
|
|
|
35
35
|
400: "Cookies are missing" | "Invalid provider";
|
|
36
36
|
401: "Client provider not found" | "No auth provider found" | "No user session found";
|
|
37
37
|
501: "Provider does not support revocation";
|
|
38
|
-
500:
|
|
38
|
+
500: "Failed to revoke token";
|
|
39
39
|
422: {
|
|
40
40
|
type: "validation";
|
|
41
41
|
on: string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import { OnSessionCleanup, SessionRecord, UnregisteredSessionRecord } from './types';
|
|
3
|
+
type SessionCleanupProps<UserType> = {
|
|
4
|
+
cleanupIntervalMs?: number;
|
|
5
|
+
maxSessions?: number;
|
|
6
|
+
onSessionCleanup?: OnSessionCleanup<UserType>;
|
|
7
|
+
};
|
|
8
|
+
export declare const sessionCleanup: <UserType>({ cleanupIntervalMs, maxSessions, onSessionCleanup }: SessionCleanupProps<UserType>) => Elysia<"", {
|
|
9
|
+
decorator: {};
|
|
10
|
+
store: {
|
|
11
|
+
session: SessionRecord<UserType>;
|
|
12
|
+
unregisteredSession: UnregisteredSessionRecord;
|
|
13
|
+
};
|
|
14
|
+
derive: {
|
|
15
|
+
readonly cleanupSessions: () => Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
resolve: {};
|
|
18
|
+
}, {
|
|
19
|
+
typebox: {};
|
|
20
|
+
error: {};
|
|
21
|
+
}, {
|
|
22
|
+
schema: import("elysia").MergeSchema<import("elysia").MergeSchema<{}, {}, "">, {}, "">;
|
|
23
|
+
standaloneSchema: {};
|
|
24
|
+
macro: {};
|
|
25
|
+
macroFn: {};
|
|
26
|
+
parser: {};
|
|
27
|
+
}, {}, {
|
|
28
|
+
derive: {};
|
|
29
|
+
resolve: {};
|
|
30
|
+
schema: {};
|
|
31
|
+
standaloneSchema: {};
|
|
32
|
+
}, {
|
|
33
|
+
derive: {};
|
|
34
|
+
resolve: {};
|
|
35
|
+
schema: {};
|
|
36
|
+
standaloneSchema: {};
|
|
37
|
+
}>;
|
|
38
|
+
export {};
|
package/dist/src/signout.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare const signout: <UserType>({ signoutRoute, onSignOut }: SignOutPro
|
|
|
32
32
|
200: Response;
|
|
33
33
|
400: "Cookies are missing";
|
|
34
34
|
401: "No auth provider found" | "No user session id found";
|
|
35
|
-
500:
|
|
35
|
+
500: "Sign out operation failed";
|
|
36
36
|
422: {
|
|
37
37
|
type: "validation";
|
|
38
38
|
on: string;
|
package/dist/src/typeGuards.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { StatusReturn } from './types';
|
|
1
|
+
import { StatusReturn, UserSessionId } from './types';
|
|
2
2
|
export declare const isValidUser: <UserType>(user: unknown) => user is UserType;
|
|
3
|
+
export declare const isUserSessionId: (key: string) => key is UserSessionId;
|
|
3
4
|
export declare const isNonEmptyString: (str: string | null | undefined) => str is string;
|
|
4
5
|
export declare const isStatusResponse: (value: unknown) => value is StatusReturn;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -12,19 +12,21 @@ export type OAuth2ConfigurationOptions = {
|
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
14
|
export type UserSessionId = `${string}-${string}-${string}-${string}-${string}`;
|
|
15
|
-
export type
|
|
15
|
+
export type SessionData<UserType> = {
|
|
16
16
|
user: UserType;
|
|
17
17
|
accessToken: string;
|
|
18
18
|
refreshToken?: string;
|
|
19
19
|
expiresAt: number;
|
|
20
|
-
}
|
|
21
|
-
export type
|
|
20
|
+
};
|
|
21
|
+
export type SessionRecord<UserType> = Record<UserSessionId, SessionData<UserType>>;
|
|
22
|
+
export type UnregisteredSessionData = {
|
|
22
23
|
userIdentity?: Record<string, unknown>;
|
|
23
24
|
sessionInformation?: Record<string, unknown>;
|
|
24
25
|
expiresAt: number;
|
|
25
26
|
accessToken?: string;
|
|
26
27
|
refreshToken?: string;
|
|
27
|
-
}
|
|
28
|
+
};
|
|
29
|
+
export type UnregisteredSessionRecord = Record<UserSessionId, UnregisteredSessionData>;
|
|
28
30
|
export type StatusReturn = ElysiaCustomStatusResponse<any, any, any>;
|
|
29
31
|
export type OnNewUser<UserType> = (userIdentity: Record<string, unknown>) => UserType | StatusReturn | Response | Promise<UserType | StatusReturn | Response>;
|
|
30
32
|
export type GetUser<UserType> = (userIdentity: Record<string, unknown>) => UserType | null | undefined | Promise<UserType | null | undefined>;
|
|
@@ -88,6 +90,10 @@ export type OnSignOut<UserType> = (({ authProvider, userSessionId, session }: {
|
|
|
88
90
|
userSessionId: UserSessionId;
|
|
89
91
|
session: SessionRecord<UserType>;
|
|
90
92
|
}) => void | Promise<void>) | undefined;
|
|
93
|
+
export type OnSessionCleanup<UserType> = (({ removedSessions, removedUnregisteredSessions }: {
|
|
94
|
+
removedSessions: Map<UserSessionId, SessionData<UserType>>;
|
|
95
|
+
removedUnregisteredSessions: Map<UserSessionId, UnregisteredSessionData>;
|
|
96
|
+
}) => void | Promise<void>) | undefined;
|
|
91
97
|
export type RouteString = `/${string}`;
|
|
92
98
|
export type AuthorizeRoute = `${string}/:provider${'' | `/${string}`}`;
|
|
93
99
|
export type AbsoluteAuthProps<UserType> = {
|
|
@@ -99,6 +105,10 @@ export type AbsoluteAuthProps<UserType> = {
|
|
|
99
105
|
revokeRoute?: RouteString;
|
|
100
106
|
signoutRoute?: RouteString;
|
|
101
107
|
statusRoute?: RouteString;
|
|
108
|
+
cleanupIntervalMs?: number;
|
|
109
|
+
maxSessions?: number;
|
|
110
|
+
sessionDurationMs?: number;
|
|
111
|
+
unregisteredSessionDurationMs?: number;
|
|
102
112
|
onAuthorizeSuccess?: OnAuthorizeSuccess;
|
|
103
113
|
onAuthorizeError?: OnAuthorizeError;
|
|
104
114
|
onCallbackSuccess?: OnCallbackSuccess<UserType>;
|
|
@@ -111,6 +121,7 @@ export type AbsoluteAuthProps<UserType> = {
|
|
|
111
121
|
onRevocationError?: OnRevocationError;
|
|
112
122
|
onProfileSuccess?: OnProfileSuccess;
|
|
113
123
|
onProfileError?: OnProfileError;
|
|
124
|
+
onSessionCleanup?: OnSessionCleanup<UserType>;
|
|
114
125
|
};
|
|
115
126
|
export type ClientProviders = Record<string, {
|
|
116
127
|
providerInstance: OAuth2Client<ProviderOption>;
|
|
@@ -126,4 +137,6 @@ export type InsantiateUserSessionProps<UserType> = {
|
|
|
126
137
|
user_session_id: Cookie<UserSessionId | undefined>;
|
|
127
138
|
onNewUser: OnNewUser<UserType>;
|
|
128
139
|
getUser: GetUser<UserType>;
|
|
140
|
+
sessionDurationMs?: number;
|
|
141
|
+
unregisteredSessionDurationMs?: number;
|
|
129
142
|
};
|
package/dist/src/userStatus.d.ts
CHANGED
|
@@ -29,20 +29,11 @@ export declare const userStatus: <UserType>({ statusRoute, onStatus }: StatusPro
|
|
|
29
29
|
query: unknown;
|
|
30
30
|
headers: unknown;
|
|
31
31
|
response: {
|
|
32
|
-
200:
|
|
33
|
-
|
|
34
|
-
422: {
|
|
35
|
-
type: "validation";
|
|
36
|
-
on: string;
|
|
37
|
-
summary?: string;
|
|
38
|
-
message?: string;
|
|
39
|
-
found?: unknown;
|
|
40
|
-
property?: string;
|
|
41
|
-
expected?: string;
|
|
32
|
+
200: {
|
|
33
|
+
user: NonNullable<UserType> | null extends import("elysia").ElysiaFile ? File : NonNullable<UserType> | null;
|
|
42
34
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} & { [ErrorResponse in import("elysia/error").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia/error").ElysiaCustomStatusResponse<"Internal Server Error", `Error: ${string} - ${string}`, 500> | import("elysia/error").ElysiaCustomStatusResponse<"Internal Server Error", `Unknown Error: ${string}`, 500> | Extract<Awaited<NonNullable<UserType>>, import("elysia/error").ElysiaCustomStatusResponse<any, any, any>> as ErrorResponse extends import("elysia/error").ElysiaCustomStatusResponse<any, any, any> ? ErrorResponse["code"] : never]: ErrorResponse["response"]; } & {
|
|
35
|
+
400: "Cookies are missing";
|
|
36
|
+
500: `Error: ${string} - ${string}` | `Unknown Error: ${string}`;
|
|
46
37
|
422: {
|
|
47
38
|
type: "validation";
|
|
48
39
|
on: string;
|
|
@@ -52,7 +43,7 @@ export declare const userStatus: <UserType>({ statusRoute, onStatus }: StatusPro
|
|
|
52
43
|
property?: string;
|
|
53
44
|
expected?: string;
|
|
54
45
|
};
|
|
55
|
-
}
|
|
46
|
+
};
|
|
56
47
|
};
|
|
57
48
|
};
|
|
58
49
|
}, {
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cookie } from 'elysia';
|
|
2
|
-
import { AbsoluteAuthProps, InsantiateUserSessionProps, OAuth2ConfigurationOptions, SessionRecord, UserSessionId } from './types';
|
|
3
|
-
export declare const instantiateUserSession: <UserType>({ authProvider, session, user_session_id, unregisteredSession, tokenResponse, providerInstance, getUser, onNewUser }: InsantiateUserSessionProps<UserType>) => Promise<import("./types").StatusReturn | Response | undefined>;
|
|
2
|
+
import { AbsoluteAuthProps, InsantiateUserSessionProps, OAuth2ConfigurationOptions, SessionRecord, UnregisteredSessionRecord, UserSessionId } from './types';
|
|
3
|
+
export declare const instantiateUserSession: <UserType>({ authProvider, session, user_session_id, unregisteredSession, tokenResponse, providerInstance, getUser, onNewUser, sessionDurationMs, unregisteredSessionDurationMs }: InsantiateUserSessionProps<UserType>) => Promise<import("./types").StatusReturn | Response | undefined>;
|
|
4
4
|
export declare const createAuthConfiguration: <UserType>(configuration: AbsoluteAuthProps<UserType>) => AbsoluteAuthProps<UserType>;
|
|
5
5
|
export declare const createProvidersConfiguration: (providersConfiguration: OAuth2ConfigurationOptions) => OAuth2ConfigurationOptions;
|
|
6
6
|
export declare const getStatus: <UserType>(session: SessionRecord<UserType>, user_session_id: Cookie<UserSessionId | undefined>) => Promise<{
|
|
@@ -22,5 +22,10 @@ type ValidateSessionProps<SessionType extends Record<string, unknown> & {
|
|
|
22
22
|
export declare const validateSession: <SessionType extends Record<string, unknown> & {
|
|
23
23
|
expiresAt: number;
|
|
24
24
|
}>({ user_session_id, session }: ValidateSessionProps<SessionType>) => SessionType | undefined;
|
|
25
|
-
|
|
25
|
+
type GetUserSessionIdProps<UserType> = {
|
|
26
|
+
user_session_id: Cookie<UserSessionId | undefined>;
|
|
27
|
+
session?: SessionRecord<UserType>;
|
|
28
|
+
unregisteredSession?: UnregisteredSessionRecord;
|
|
29
|
+
};
|
|
30
|
+
export declare const getUserSessionId: <UserType>({ user_session_id, session, unregisteredSession }: GetUserSessionIdProps<UserType>) => `${string}-${string}-${string}-${string}-${string}`;
|
|
26
31
|
export {};
|
package/package.json
CHANGED