@absolutejs/auth 0.59.0 → 0.59.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/index.d.ts +13 -0
- package/dist/cli/import/auth0.d.ts +2 -0
- package/dist/cli/import/clerk.d.ts +2 -0
- package/dist/cli/import/index.d.ts +10 -0
- package/dist/cli/import/lucia.d.ts +2 -0
- package/dist/cli/import/nextauth.d.ts +2 -0
- package/dist/cli/import/supabase.d.ts +2 -0
- package/dist/cli/import/types.d.ts +27 -0
- package/dist/cli/migrate.d.ts +2 -0
- package/dist/client/components/react/SignIn.d.ts +32 -0
- package/dist/client/components/react/SignUp.d.ts +29 -0
- package/dist/client/components/react/UserButton.d.ts +36 -0
- package/dist/client/createAuthClient.d.ts +285 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/passkeyHelpers.d.ts +19 -0
- package/dist/client/react.d.ts +87 -0
- package/dist/client/sessionExpiry.d.ts +37 -0
- package/dist/client/solid.d.ts +86 -0
- package/dist/client/svelte.d.ts +86 -0
- package/dist/client/vue.d.ts +88 -0
- package/dist/fingerprint-client/index.d.ts +26 -0
- package/dist/htmx/index.d.ts +2 -0
- package/dist/index.d.ts +3643 -0
- package/dist/linkedProviders/index.d.ts +3 -0
- package/dist/manifest.d.ts +18 -0
- package/dist/manifest.json +373 -0
- package/dist/oidc/index.d.ts +12 -0
- package/dist/oidc/operator.d.ts +14 -0
- package/dist/plugins/denyDisposableEmail.d.ts +7 -0
- package/dist/plugins/discordAlert.d.ts +7 -0
- package/dist/plugins/geoBlock.d.ts +8 -0
- package/dist/plugins/index.d.ts +12 -0
- package/dist/plugins/pagerdutyAlert.d.ts +9 -0
- package/dist/plugins/posthogIdentify.d.ts +7 -0
- package/dist/plugins/slackAlert.d.ts +7 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/saml.d.ts +1 -0
- package/dist/server.d.ts +32 -0
- package/dist/sso/nodeSamlAdapter.d.ts +8 -0
- package/dist/vault/index.d.ts +5 -0
- package/dist/webauthn/simpleWebAuthnAdapter.d.ts +3 -0
- package/dist/webauthn.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './config';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './registration';
|
|
4
|
+
export * from './registrationClient';
|
|
5
|
+
export * from './idJag';
|
|
6
|
+
export * from './oauthGuide';
|
|
7
|
+
export * from '../oidc/clientIdMetadata';
|
|
8
|
+
export { createOidcAgentCredentialVerifier } from './oidcAdapter';
|
|
9
|
+
export { agentHasScopes, resolveAgentPrincipal } from './principal';
|
|
10
|
+
export { agentAuthChallenge, agentAuthContextPlugin } from './context';
|
|
11
|
+
export { agentAuthPlugin } from './routes';
|
|
12
|
+
export { createInMemoryAgentDelegationStore, createInMemoryAgentIdentityRegistrationStore, createInMemoryAgentRegistrationStore } from './inMemoryStores';
|
|
13
|
+
export { agentDelegationsTable, agentDelegationsBunSqlTable, agentIdentityRegistrationsTable, agentIdentityRegistrationsBunSqlTable, agentRegistrationsTable, agentRegistrationsBunSqlTable, createBunSqlDrizzleAgentDelegationStore, createBunSqlDrizzleAgentIdentityRegistrationStore, createBunSqlDrizzleAgentRegistrationStore, createNeonAgentDelegationStore, createNeonAgentIdentityRegistrationStore, createNeonAgentRegistrationStore, createDrizzleAgentDelegationStore, createPostgresAgentDelegationStore, createPostgresAgentIdentityRegistrationStore, createPostgresAgentRegistrationStore } from './postgresStores';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ImportResult, Importer } from './types';
|
|
2
|
+
export declare const importers: Record<string, Importer>;
|
|
3
|
+
export type ImportOptions = {
|
|
4
|
+
commit: boolean;
|
|
5
|
+
databaseUrl: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const runImport: (result: ImportResult, options: ImportOptions) => Promise<{
|
|
8
|
+
identityCount: number;
|
|
9
|
+
userCount: number;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const detectPasswordHashAlgorithm: (hash?: string) => ImportedUser['passwordHashAlgo'];
|
|
2
|
+
export type ImportedUser = {
|
|
3
|
+
createdAtMs: number;
|
|
4
|
+
email: string;
|
|
5
|
+
emailVerified: boolean;
|
|
6
|
+
externalId: string;
|
|
7
|
+
familyName?: string;
|
|
8
|
+
givenName?: string;
|
|
9
|
+
passwordHash?: string;
|
|
10
|
+
passwordHashAlgo?: 'argon2id' | 'bcrypt' | 'scrypt' | 'pbkdf2';
|
|
11
|
+
};
|
|
12
|
+
export type ImportedIdentity = {
|
|
13
|
+
authProvider: string;
|
|
14
|
+
createdAtMs: number;
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
providerSubject: string;
|
|
17
|
+
userExternalId: string;
|
|
18
|
+
};
|
|
19
|
+
export type ImportResult = {
|
|
20
|
+
identities: ImportedIdentity[];
|
|
21
|
+
source: string;
|
|
22
|
+
users: ImportedUser[];
|
|
23
|
+
};
|
|
24
|
+
export type Importer = {
|
|
25
|
+
parse: (path: string) => Promise<ImportResult>;
|
|
26
|
+
source: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type FormEvent } from 'react';
|
|
2
|
+
import type { AuthClient, AuthClientError } from '../../createAuthClient';
|
|
3
|
+
type AuthnSuccess = {
|
|
4
|
+
passwordCompromised?: boolean;
|
|
5
|
+
status: 'authenticated' | 'mfa_required';
|
|
6
|
+
};
|
|
7
|
+
export type SignInProps = {
|
|
8
|
+
client: AuthClient;
|
|
9
|
+
classNames?: {
|
|
10
|
+
button?: string;
|
|
11
|
+
container?: string;
|
|
12
|
+
divider?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
field?: string;
|
|
15
|
+
input?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
oauthButton?: string;
|
|
18
|
+
oauthGrid?: string;
|
|
19
|
+
};
|
|
20
|
+
emailLabel?: string;
|
|
21
|
+
onError?: (error: AuthClientError) => void;
|
|
22
|
+
onSuccess?: (result: AuthnSuccess) => void;
|
|
23
|
+
passwordLabel?: string;
|
|
24
|
+
providers?: string[];
|
|
25
|
+
submitLabel?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const SignIn: ({ client, classNames, emailLabel, onError, onSuccess, passwordLabel, providers, submitLabel }: SignInProps) => import("react").ReactElement<{
|
|
28
|
+
className: string | undefined;
|
|
29
|
+
'data-abs-auth': string;
|
|
30
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => Promise<void>;
|
|
31
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type FormEvent } from 'react';
|
|
2
|
+
import type { AuthClient, AuthClientError } from '../../createAuthClient';
|
|
3
|
+
type SignUpSuccess = {
|
|
4
|
+
status: 'authenticated';
|
|
5
|
+
} | {
|
|
6
|
+
status: 'verification_required';
|
|
7
|
+
};
|
|
8
|
+
export type SignUpProps = {
|
|
9
|
+
client: AuthClient;
|
|
10
|
+
classNames?: {
|
|
11
|
+
button?: string;
|
|
12
|
+
container?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
field?: string;
|
|
15
|
+
input?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
emailLabel?: string;
|
|
19
|
+
onError?: (error: AuthClientError) => void;
|
|
20
|
+
onSuccess?: (result: SignUpSuccess) => void;
|
|
21
|
+
passwordLabel?: string;
|
|
22
|
+
submitLabel?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const SignUp: ({ client, classNames, emailLabel, onError, onSuccess, passwordLabel, submitLabel }: SignUpProps) => import("react").ReactElement<{
|
|
25
|
+
className: string | undefined;
|
|
26
|
+
'data-abs-auth': string;
|
|
27
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => Promise<void>;
|
|
28
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AuthClient } from '../../createAuthClient';
|
|
2
|
+
export type UserButtonUser = {
|
|
3
|
+
avatarUrl?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
givenName?: string;
|
|
6
|
+
};
|
|
7
|
+
export type UserButtonItem = {
|
|
8
|
+
href: string;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
export type UserButtonProps = {
|
|
12
|
+
client: AuthClient;
|
|
13
|
+
classNames?: {
|
|
14
|
+
avatar?: string;
|
|
15
|
+
container?: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
menu?: string;
|
|
18
|
+
menuItem?: string;
|
|
19
|
+
signOut?: string;
|
|
20
|
+
toggle?: string;
|
|
21
|
+
};
|
|
22
|
+
items?: UserButtonItem[];
|
|
23
|
+
onSignOut?: () => void;
|
|
24
|
+
signedOutHref?: string;
|
|
25
|
+
signOutLabel?: string;
|
|
26
|
+
user: UserButtonUser | null;
|
|
27
|
+
};
|
|
28
|
+
export declare const UserButton: ({ client, classNames, items, onSignOut, signedOutHref, signOutLabel, user }: UserButtonProps) => import("react").DetailedReactHTMLElement<{
|
|
29
|
+
className: string | undefined;
|
|
30
|
+
'data-abs-auth': string;
|
|
31
|
+
href: string;
|
|
32
|
+
}, HTMLElement> | import("react").DetailedReactHTMLElement<{
|
|
33
|
+
className: string | undefined;
|
|
34
|
+
'data-abs-auth': string;
|
|
35
|
+
'data-abs-auth-open': string;
|
|
36
|
+
}, HTMLElement>;
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import type { PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/browser';
|
|
2
|
+
export type AuthClientError = {
|
|
3
|
+
body: unknown;
|
|
4
|
+
message: string;
|
|
5
|
+
status: number;
|
|
6
|
+
};
|
|
7
|
+
export type AuthClientResult<T> = {
|
|
8
|
+
data: null;
|
|
9
|
+
error: AuthClientError;
|
|
10
|
+
} | {
|
|
11
|
+
data: T;
|
|
12
|
+
error: null;
|
|
13
|
+
};
|
|
14
|
+
export type AuthClientRoutes = {
|
|
15
|
+
emailVerify?: string;
|
|
16
|
+
emailVerifyRequest?: string;
|
|
17
|
+
login?: string;
|
|
18
|
+
magicLinkRequest?: string;
|
|
19
|
+
magicLinkVerify?: string;
|
|
20
|
+
mfaChallenge?: string;
|
|
21
|
+
mfaManagement?: string;
|
|
22
|
+
mfaSetup?: string;
|
|
23
|
+
mfaVerifySetup?: string;
|
|
24
|
+
passkeyAuthenticateOptions?: string;
|
|
25
|
+
passkeyAuthenticateVerify?: string;
|
|
26
|
+
passkeyList?: string;
|
|
27
|
+
passkeyRegisterOptions?: string;
|
|
28
|
+
passkeyRegisterVerify?: string;
|
|
29
|
+
passkeyRemove?: string;
|
|
30
|
+
passwordReset?: string;
|
|
31
|
+
passwordResetRequest?: string;
|
|
32
|
+
register?: string;
|
|
33
|
+
sessions?: string;
|
|
34
|
+
signout?: string;
|
|
35
|
+
status?: string;
|
|
36
|
+
};
|
|
37
|
+
export type AuthClientConfig = {
|
|
38
|
+
baseUrl?: string;
|
|
39
|
+
credentials?: RequestCredentials;
|
|
40
|
+
fetch?: typeof fetch;
|
|
41
|
+
routes?: AuthClientRoutes;
|
|
42
|
+
};
|
|
43
|
+
export declare const createAuthClient: ({ baseUrl, credentials, fetch: fetchImpl, routes }?: AuthClientConfig) => {
|
|
44
|
+
emailVerification: {
|
|
45
|
+
request: (body: {
|
|
46
|
+
email: string;
|
|
47
|
+
}) => Promise<{
|
|
48
|
+
data: null;
|
|
49
|
+
error: AuthClientError;
|
|
50
|
+
} | {
|
|
51
|
+
data: {
|
|
52
|
+
ok: true;
|
|
53
|
+
};
|
|
54
|
+
error: null;
|
|
55
|
+
}>;
|
|
56
|
+
verify: (body: {
|
|
57
|
+
token: string;
|
|
58
|
+
}) => Promise<{
|
|
59
|
+
data: null;
|
|
60
|
+
error: AuthClientError;
|
|
61
|
+
} | {
|
|
62
|
+
data: {
|
|
63
|
+
ok: true;
|
|
64
|
+
};
|
|
65
|
+
error: null;
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
68
|
+
mfa: {
|
|
69
|
+
challenge: (body: {
|
|
70
|
+
code: string;
|
|
71
|
+
}) => Promise<{
|
|
72
|
+
data: null;
|
|
73
|
+
error: AuthClientError;
|
|
74
|
+
} | {
|
|
75
|
+
data: {
|
|
76
|
+
status: "authenticated";
|
|
77
|
+
};
|
|
78
|
+
error: null;
|
|
79
|
+
}>;
|
|
80
|
+
disable: () => Promise<{
|
|
81
|
+
data: null;
|
|
82
|
+
error: AuthClientError;
|
|
83
|
+
} | {
|
|
84
|
+
data: {
|
|
85
|
+
status: "disabled";
|
|
86
|
+
};
|
|
87
|
+
error: null;
|
|
88
|
+
}>;
|
|
89
|
+
setup: () => Promise<{
|
|
90
|
+
data: null;
|
|
91
|
+
error: AuthClientError;
|
|
92
|
+
} | {
|
|
93
|
+
data: {
|
|
94
|
+
secret: string;
|
|
95
|
+
uri: string;
|
|
96
|
+
};
|
|
97
|
+
error: null;
|
|
98
|
+
}>;
|
|
99
|
+
status: () => Promise<{
|
|
100
|
+
data: null;
|
|
101
|
+
error: AuthClientError;
|
|
102
|
+
} | {
|
|
103
|
+
data: import("..").MfaStatus;
|
|
104
|
+
error: null;
|
|
105
|
+
}>;
|
|
106
|
+
verifySetup: (body: {
|
|
107
|
+
code: string;
|
|
108
|
+
}) => Promise<{
|
|
109
|
+
data: null;
|
|
110
|
+
error: AuthClientError;
|
|
111
|
+
} | {
|
|
112
|
+
data: {
|
|
113
|
+
backupCodes: string[];
|
|
114
|
+
};
|
|
115
|
+
error: null;
|
|
116
|
+
}>;
|
|
117
|
+
};
|
|
118
|
+
passkeys: {
|
|
119
|
+
authenticateOptions: () => Promise<{
|
|
120
|
+
data: null;
|
|
121
|
+
error: AuthClientError;
|
|
122
|
+
} | {
|
|
123
|
+
data: PublicKeyCredentialRequestOptionsJSON;
|
|
124
|
+
error: null;
|
|
125
|
+
}>;
|
|
126
|
+
authenticateVerify: (response: unknown) => Promise<{
|
|
127
|
+
data: null;
|
|
128
|
+
error: AuthClientError;
|
|
129
|
+
} | {
|
|
130
|
+
data: {
|
|
131
|
+
status: "authenticated";
|
|
132
|
+
};
|
|
133
|
+
error: null;
|
|
134
|
+
}>;
|
|
135
|
+
list: () => Promise<{
|
|
136
|
+
data: null;
|
|
137
|
+
error: AuthClientError;
|
|
138
|
+
} | {
|
|
139
|
+
data: unknown[];
|
|
140
|
+
error: null;
|
|
141
|
+
}>;
|
|
142
|
+
registerOptions: () => Promise<{
|
|
143
|
+
data: null;
|
|
144
|
+
error: AuthClientError;
|
|
145
|
+
} | {
|
|
146
|
+
data: PublicKeyCredentialCreationOptionsJSON;
|
|
147
|
+
error: null;
|
|
148
|
+
}>;
|
|
149
|
+
registerVerify: (response: unknown) => Promise<{
|
|
150
|
+
data: null;
|
|
151
|
+
error: AuthClientError;
|
|
152
|
+
} | {
|
|
153
|
+
data: {
|
|
154
|
+
ok: true;
|
|
155
|
+
};
|
|
156
|
+
error: null;
|
|
157
|
+
}>;
|
|
158
|
+
remove: (credentialId: string) => Promise<{
|
|
159
|
+
data: null;
|
|
160
|
+
error: AuthClientError;
|
|
161
|
+
} | {
|
|
162
|
+
data: {
|
|
163
|
+
ok: true;
|
|
164
|
+
};
|
|
165
|
+
error: null;
|
|
166
|
+
}>;
|
|
167
|
+
};
|
|
168
|
+
passwordless: {
|
|
169
|
+
requestMagicLink: (body: {
|
|
170
|
+
email: string;
|
|
171
|
+
}) => Promise<{
|
|
172
|
+
data: null;
|
|
173
|
+
error: AuthClientError;
|
|
174
|
+
} | {
|
|
175
|
+
data: {
|
|
176
|
+
ok: true;
|
|
177
|
+
};
|
|
178
|
+
error: null;
|
|
179
|
+
}>;
|
|
180
|
+
verifyMagicLink: (body: {
|
|
181
|
+
token: string;
|
|
182
|
+
}) => Promise<{
|
|
183
|
+
data: null;
|
|
184
|
+
error: AuthClientError;
|
|
185
|
+
} | {
|
|
186
|
+
data: {
|
|
187
|
+
status: "authenticated";
|
|
188
|
+
};
|
|
189
|
+
error: null;
|
|
190
|
+
}>;
|
|
191
|
+
};
|
|
192
|
+
passwordReset: {
|
|
193
|
+
confirm: (body: {
|
|
194
|
+
password: string;
|
|
195
|
+
token: string;
|
|
196
|
+
}) => Promise<{
|
|
197
|
+
data: null;
|
|
198
|
+
error: AuthClientError;
|
|
199
|
+
} | {
|
|
200
|
+
data: {
|
|
201
|
+
ok: true;
|
|
202
|
+
};
|
|
203
|
+
error: null;
|
|
204
|
+
}>;
|
|
205
|
+
request: (body: {
|
|
206
|
+
email: string;
|
|
207
|
+
}) => Promise<{
|
|
208
|
+
data: null;
|
|
209
|
+
error: AuthClientError;
|
|
210
|
+
} | {
|
|
211
|
+
data: {
|
|
212
|
+
ok: true;
|
|
213
|
+
};
|
|
214
|
+
error: null;
|
|
215
|
+
}>;
|
|
216
|
+
};
|
|
217
|
+
sessions: {
|
|
218
|
+
list: () => Promise<{
|
|
219
|
+
data: null;
|
|
220
|
+
error: AuthClientError;
|
|
221
|
+
} | {
|
|
222
|
+
data: unknown[];
|
|
223
|
+
error: null;
|
|
224
|
+
}>;
|
|
225
|
+
revoke: (sessionId: string) => Promise<{
|
|
226
|
+
data: null;
|
|
227
|
+
error: AuthClientError;
|
|
228
|
+
} | {
|
|
229
|
+
data: {
|
|
230
|
+
ok: true;
|
|
231
|
+
};
|
|
232
|
+
error: null;
|
|
233
|
+
}>;
|
|
234
|
+
};
|
|
235
|
+
signIn: {
|
|
236
|
+
email: (body: {
|
|
237
|
+
email: string;
|
|
238
|
+
password: string;
|
|
239
|
+
}) => Promise<{
|
|
240
|
+
data: null;
|
|
241
|
+
error: AuthClientError;
|
|
242
|
+
} | {
|
|
243
|
+
data: {
|
|
244
|
+
passwordCompromised?: boolean;
|
|
245
|
+
status: "authenticated" | "mfa_required";
|
|
246
|
+
};
|
|
247
|
+
error: null;
|
|
248
|
+
}>;
|
|
249
|
+
};
|
|
250
|
+
signUp: {
|
|
251
|
+
email: (body: {
|
|
252
|
+
email: string;
|
|
253
|
+
password: string;
|
|
254
|
+
[extra: string]: unknown;
|
|
255
|
+
}) => Promise<{
|
|
256
|
+
data: null;
|
|
257
|
+
error: AuthClientError;
|
|
258
|
+
} | {
|
|
259
|
+
data: {
|
|
260
|
+
status: "authenticated";
|
|
261
|
+
} | {
|
|
262
|
+
status: "verification_required";
|
|
263
|
+
};
|
|
264
|
+
error: null;
|
|
265
|
+
}>;
|
|
266
|
+
};
|
|
267
|
+
signOut: () => Promise<{
|
|
268
|
+
data: null;
|
|
269
|
+
error: AuthClientError;
|
|
270
|
+
} | {
|
|
271
|
+
data: null;
|
|
272
|
+
error: null;
|
|
273
|
+
}>;
|
|
274
|
+
status: () => Promise<{
|
|
275
|
+
data: null;
|
|
276
|
+
error: AuthClientError;
|
|
277
|
+
} | {
|
|
278
|
+
data: {
|
|
279
|
+
impersonator?: unknown;
|
|
280
|
+
user: unknown | null;
|
|
281
|
+
};
|
|
282
|
+
error: null;
|
|
283
|
+
}>;
|
|
284
|
+
};
|
|
285
|
+
export type AuthClient = ReturnType<typeof createAuthClient>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AuthClient, AuthClientError } from './createAuthClient';
|
|
2
|
+
export declare const runConditionalAuthentication: (client: AuthClient) => Promise<{
|
|
3
|
+
data: null;
|
|
4
|
+
error: AuthClientError;
|
|
5
|
+
} | {
|
|
6
|
+
data: {
|
|
7
|
+
status: "authenticated";
|
|
8
|
+
};
|
|
9
|
+
error: null;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const runPasskeyRegistration: (client: AuthClient) => Promise<{
|
|
12
|
+
data: null;
|
|
13
|
+
error: AuthClientError;
|
|
14
|
+
} | {
|
|
15
|
+
data: {
|
|
16
|
+
ok: true;
|
|
17
|
+
};
|
|
18
|
+
error: null;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { AuthClient, AuthClientError } from './createAuthClient';
|
|
2
|
+
type Mutator<Args, Data> = (args: Args) => Promise<{
|
|
3
|
+
data: Data | null;
|
|
4
|
+
error: AuthClientError | null;
|
|
5
|
+
}>;
|
|
6
|
+
type MutationState<Args, Data> = {
|
|
7
|
+
data: Data | null;
|
|
8
|
+
error: AuthClientError | null;
|
|
9
|
+
isPending: boolean;
|
|
10
|
+
mutate: Mutator<Args, Data>;
|
|
11
|
+
reset: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const useMagicLink: (client: AuthClient) => MutationState<{
|
|
14
|
+
email: string;
|
|
15
|
+
}, {
|
|
16
|
+
ok: true;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const useMfaChallenge: (client: AuthClient) => MutationState<{
|
|
19
|
+
code: string;
|
|
20
|
+
}, {
|
|
21
|
+
status: "authenticated";
|
|
22
|
+
}>;
|
|
23
|
+
export declare const usePasskeyAutofill: (client: AuthClient) => {
|
|
24
|
+
cancel: () => void;
|
|
25
|
+
data: {
|
|
26
|
+
status: "authenticated";
|
|
27
|
+
} | null;
|
|
28
|
+
error: AuthClientError | null;
|
|
29
|
+
isPending: boolean;
|
|
30
|
+
start: () => Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
export declare const usePasswordReset: (client: AuthClient) => MutationState<{
|
|
33
|
+
email: string;
|
|
34
|
+
}, {
|
|
35
|
+
ok: true;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const useSessions: (client: AuthClient) => {
|
|
38
|
+
data: unknown[] | null;
|
|
39
|
+
error: AuthClientError | null;
|
|
40
|
+
isPending: boolean;
|
|
41
|
+
refetch: () => Promise<void>;
|
|
42
|
+
revoke: (sessionId: string) => Promise<{
|
|
43
|
+
data: null;
|
|
44
|
+
error: AuthClientError;
|
|
45
|
+
} | {
|
|
46
|
+
data: {
|
|
47
|
+
ok: true;
|
|
48
|
+
};
|
|
49
|
+
error: null;
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
export declare const useSignIn: (client: AuthClient) => MutationState<{
|
|
53
|
+
email: string;
|
|
54
|
+
password: string;
|
|
55
|
+
}, {
|
|
56
|
+
passwordCompromised?: boolean;
|
|
57
|
+
status: "authenticated" | "mfa_required";
|
|
58
|
+
}>;
|
|
59
|
+
export declare const useSignOut: (client: AuthClient) => MutationState<unknown, null>;
|
|
60
|
+
export declare const useSignUp: (client: AuthClient) => MutationState<{
|
|
61
|
+
[extra: string]: unknown;
|
|
62
|
+
email: string;
|
|
63
|
+
password: string;
|
|
64
|
+
}, {
|
|
65
|
+
status: "authenticated";
|
|
66
|
+
} | {
|
|
67
|
+
status: "verification_required";
|
|
68
|
+
}>;
|
|
69
|
+
export declare const useUpgradeToPasskey: (client: AuthClient) => {
|
|
70
|
+
error: AuthClientError | null;
|
|
71
|
+
isPending: boolean;
|
|
72
|
+
passkeys: unknown[] | null;
|
|
73
|
+
refetch: () => Promise<void>;
|
|
74
|
+
register: () => Promise<{
|
|
75
|
+
data: null;
|
|
76
|
+
error: AuthClientError;
|
|
77
|
+
} | {
|
|
78
|
+
data: {
|
|
79
|
+
ok: true;
|
|
80
|
+
};
|
|
81
|
+
error: null;
|
|
82
|
+
}>;
|
|
83
|
+
shouldPrompt: boolean;
|
|
84
|
+
};
|
|
85
|
+
export { SignIn, type SignInProps } from './components/react/SignIn';
|
|
86
|
+
export { SignUp, type SignUpProps } from './components/react/SignUp';
|
|
87
|
+
export { UserButton, type UserButtonItem, type UserButtonProps, type UserButtonUser } from './components/react/UserButton';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type SessionExpiredContext = {
|
|
2
|
+
returnTo: string;
|
|
3
|
+
signInUrl: string;
|
|
4
|
+
};
|
|
5
|
+
export type SessionExpiryGuard = {
|
|
6
|
+
check: () => Promise<boolean>;
|
|
7
|
+
dispose: () => void;
|
|
8
|
+
};
|
|
9
|
+
export type SessionExpiryGuardConfig = {
|
|
10
|
+
checkIntervalMs?: number;
|
|
11
|
+
isProtectedRequest?: (url: URL) => boolean;
|
|
12
|
+
onExpired?: (context: SessionExpiredContext) => void;
|
|
13
|
+
protectedPaths?: readonly string[];
|
|
14
|
+
reason?: string;
|
|
15
|
+
reasonParam?: string;
|
|
16
|
+
returnUrlParam?: string;
|
|
17
|
+
signInPath?: string;
|
|
18
|
+
statusPath?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const buildSessionExpiredSignInUrl: ({ currentHref, reason, reasonParam, returnUrlParam, signInPath }: {
|
|
21
|
+
currentHref: string;
|
|
22
|
+
reason?: string;
|
|
23
|
+
reasonParam?: string;
|
|
24
|
+
returnUrlParam?: string;
|
|
25
|
+
signInPath?: string;
|
|
26
|
+
}) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Installs one browser-wide session-expiry guard. It intercepts 401 responses
|
|
29
|
+
* only for explicitly protected same-origin requests and rechecks the auth
|
|
30
|
+
* status route when a backgrounded or bfcached page becomes active again.
|
|
31
|
+
*/
|
|
32
|
+
export declare const installSessionExpiryGuard: (config?: SessionExpiryGuardConfig) => SessionExpiryGuard;
|
|
33
|
+
export declare const isProtectedSessionRequest: ({ input, origin, protectedPaths }: {
|
|
34
|
+
input: RequestInfo | URL;
|
|
35
|
+
origin: string;
|
|
36
|
+
protectedPaths: readonly string[];
|
|
37
|
+
}) => boolean;
|