@absolutejs/auth 0.57.9 → 0.59.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/README.md +38 -0
- package/dist/cli/migrate.js +31 -12
- package/dist/cli/migrate.js.map +4 -4
- package/dist/index.js +522 -95
- package/dist/index.js.map +17 -15
- package/dist/manifest.js +8 -1
- package/dist/manifest.js.map +3 -3
- package/dist/mfa/challenge.d.ts +5 -3
- package/dist/mfa/config.d.ts +9 -0
- package/dist/mfa/management.d.ts +3 -3
- package/dist/mfa/postgresMfaStore.d.ts +60 -0
- package/dist/mfa/recentAuth.d.ts +2 -0
- package/dist/mfa/routes.d.ts +15 -10
- package/dist/mfa/sms.d.ts +45 -7
- package/dist/mfa/totp.d.ts +3 -3
- package/dist/mfa/types.d.ts +35 -0
- package/dist/server.js +521 -96
- package/dist/server.js.map +18 -16
- package/dist/types.d.ts +5 -1
- package/dist/verification/types.d.ts +58 -0
- package/package.json +1 -1
- package/dist/agents/index.d.ts +0 -13
- package/dist/cli/import/auth0.d.ts +0 -2
- package/dist/cli/import/clerk.d.ts +0 -2
- package/dist/cli/import/index.d.ts +0 -10
- package/dist/cli/import/lucia.d.ts +0 -2
- package/dist/cli/import/nextauth.d.ts +0 -2
- package/dist/cli/import/supabase.d.ts +0 -2
- package/dist/cli/import/types.d.ts +0 -27
- package/dist/cli/migrate.d.ts +0 -2
- package/dist/client/components/react/SignIn.d.ts +0 -32
- package/dist/client/components/react/SignUp.d.ts +0 -29
- package/dist/client/components/react/UserButton.d.ts +0 -36
- package/dist/client/createAuthClient.d.ts +0 -285
- package/dist/client/index.d.ts +0 -3
- package/dist/client/passkeyHelpers.d.ts +0 -19
- package/dist/client/react.d.ts +0 -87
- package/dist/client/sessionExpiry.d.ts +0 -37
- package/dist/client/solid.d.ts +0 -86
- package/dist/client/svelte.d.ts +0 -86
- package/dist/client/vue.d.ts +0 -88
- package/dist/fingerprint-client/index.d.ts +0 -26
- package/dist/htmx/index.d.ts +0 -2
- package/dist/index.d.ts +0 -3637
- package/dist/linkedProviders/index.d.ts +0 -3
- package/dist/manifest.d.ts +0 -18
- package/dist/manifest.json +0 -364
- package/dist/oidc/index.d.ts +0 -12
- package/dist/oidc/operator.d.ts +0 -14
- package/dist/plugins/denyDisposableEmail.d.ts +0 -7
- package/dist/plugins/discordAlert.d.ts +0 -7
- package/dist/plugins/geoBlock.d.ts +0 -8
- package/dist/plugins/index.d.ts +0 -12
- package/dist/plugins/pagerdutyAlert.d.ts +0 -9
- package/dist/plugins/posthogIdentify.d.ts +0 -7
- package/dist/plugins/slackAlert.d.ts +0 -7
- package/dist/providers/index.d.ts +0 -2
- package/dist/saml.d.ts +0 -1
- package/dist/server.d.ts +0 -31
- package/dist/sso/nodeSamlAdapter.d.ts +0 -8
- package/dist/vault/index.d.ts +0 -5
- package/dist/webauthn/simpleWebAuthnAdapter.d.ts +0 -3
- package/dist/webauthn.d.ts +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { AuthIdentityConflict } from './errors';
|
|
|
12
12
|
import type { AuthHtmxConfig, AuthHtmxUser } from './htmx/types';
|
|
13
13
|
import type { LockoutConfig } from './lockout/config';
|
|
14
14
|
import type { MfaConfig } from './mfa/config';
|
|
15
|
+
import type { VerificationProvider } from './verification/types';
|
|
15
16
|
import type { OidcProviderConfig } from './oidc/config';
|
|
16
17
|
import type { OrganizationsConfig } from './organizations/config';
|
|
17
18
|
import type { PasswordlessConfig } from './passwordless/config';
|
|
@@ -286,7 +287,7 @@ export type AuthConfig<UserType> = {
|
|
|
286
287
|
* mounts register / verify-email / login / reset-password routes that produce the
|
|
287
288
|
* same `SessionData<UserType>` as OAuth, transparent to `protectRoute`. */
|
|
288
289
|
credentials?: CredentialsConfig<NoInfer<UserType>>;
|
|
289
|
-
/** Passwordless login: magic links + email
|
|
290
|
+
/** Passwordless login: magic links + email OTP. When present, mounts the magic-link flow
|
|
290
291
|
* (if `onSendMagicLink` is set) and/or the OTP flow (if `onSendOtp` is set) under
|
|
291
292
|
* `{passwordlessRoute}`; each verify route resolves the email to a user and mints the same
|
|
292
293
|
* `SessionData<UserType>` as every other flow. */
|
|
@@ -295,6 +296,9 @@ export type AuthConfig<UserType> = {
|
|
|
295
296
|
* `auth()` auto-wires the login MFA gate, mounts the enroll/challenge routes, and
|
|
296
297
|
* promotes the parked session once a factor is verified. */
|
|
297
298
|
mfa?: MfaConfig<NoInfer<UserType>>;
|
|
299
|
+
/** Provider-managed phone verification (Twilio Verify, etc.). When absent,
|
|
300
|
+
* MFA can use the built-in locally generated code flow through onSendSmsCode. */
|
|
301
|
+
verificationProvider?: VerificationProvider;
|
|
298
302
|
/** Per-identity attempt throttling + account lockout on the credential login route
|
|
299
303
|
* (progressive: locks after `maxAttempts` failures within `windowMs`). */
|
|
300
304
|
lockout?: LockoutConfig;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** Stable purposes let providers apply separate templates, limits, and audit policy. */
|
|
2
|
+
export type VerificationPurpose = 'account_recovery' | 'mfa_challenge' | 'mfa_enrollment' | 'phone_change' | 'phone_signup' | 'step_up';
|
|
3
|
+
export type VerificationChannel = 'call' | 'sms' | 'whatsapp';
|
|
4
|
+
export type VerificationStartInput = {
|
|
5
|
+
channel: VerificationChannel;
|
|
6
|
+
/** Optional BCP-47 locale used for provider-managed message copy. */
|
|
7
|
+
locale?: string;
|
|
8
|
+
purpose: VerificationPurpose;
|
|
9
|
+
/** Provider-specific, non-secret rate-limit buckets (for example an IP hash). */
|
|
10
|
+
rateLimits?: Readonly<Record<string, string>>;
|
|
11
|
+
/** Stable application subject. Providers must not include it in message text. */
|
|
12
|
+
subject: string;
|
|
13
|
+
/** E.164 destination. */
|
|
14
|
+
to: string;
|
|
15
|
+
/** Stable tenant key used only for provider/service routing. */
|
|
16
|
+
tenant?: string;
|
|
17
|
+
};
|
|
18
|
+
export type VerificationStartResult = {
|
|
19
|
+
/** Provider reference safe for audit correlation (for example, a Twilio VE SID). */
|
|
20
|
+
reference: string;
|
|
21
|
+
/** Provider-authoritative expiry. Auth rejects checks after this time. */
|
|
22
|
+
expiresAt: number;
|
|
23
|
+
};
|
|
24
|
+
export type VerificationCheckStatus = 'approved' | 'canceled' | 'expired' | 'failed' | 'max_attempts_reached' | 'pending';
|
|
25
|
+
export type VerificationCheckInput = VerificationStartInput & {
|
|
26
|
+
code: string;
|
|
27
|
+
/** Exact challenge reference returned by start(). */
|
|
28
|
+
reference: string;
|
|
29
|
+
};
|
|
30
|
+
export type VerificationCancelInput = VerificationStartInput & {
|
|
31
|
+
reference: string;
|
|
32
|
+
};
|
|
33
|
+
export type VerificationCheckResult = {
|
|
34
|
+
reference?: string;
|
|
35
|
+
status: VerificationCheckStatus;
|
|
36
|
+
};
|
|
37
|
+
export type VerificationProviderErrorKind = 'invalid_destination' | 'rate_limited' | 'unavailable';
|
|
38
|
+
/** Normalized operational failures that auth routes can map safely to HTTP. */
|
|
39
|
+
export declare class VerificationProviderError extends Error {
|
|
40
|
+
readonly kind: VerificationProviderErrorKind;
|
|
41
|
+
readonly provider: string;
|
|
42
|
+
constructor(input: {
|
|
43
|
+
cause?: unknown;
|
|
44
|
+
kind: VerificationProviderErrorKind;
|
|
45
|
+
message: string;
|
|
46
|
+
provider: string;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Provider-owned out-of-band challenge lifecycle. Implementations generate,
|
|
51
|
+
* deliver, rate-limit, and check codes; auth owns enrollment and session policy.
|
|
52
|
+
*/
|
|
53
|
+
export type VerificationProvider = {
|
|
54
|
+
readonly name: string;
|
|
55
|
+
cancel: (input: VerificationCancelInput) => Promise<void>;
|
|
56
|
+
check: (input: VerificationCheckInput) => Promise<VerificationCheckResult>;
|
|
57
|
+
start: (input: VerificationStartInput) => Promise<VerificationStartResult>;
|
|
58
|
+
};
|
package/package.json
CHANGED
package/dist/agents/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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';
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
}>;
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/cli/migrate.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,29 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,36 +0,0 @@
|
|
|
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>;
|
|
@@ -1,285 +0,0 @@
|
|
|
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>;
|
package/dist/client/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
}>;
|
package/dist/client/react.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
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';
|