@absolutejs/auth 0.69.4 → 0.69.5
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/abuse/captcha.d.ts +11 -0
- package/dist/abuse/config.d.ts +29 -0
- package/dist/adaptive/config.d.ts +34 -0
- package/dist/adaptive/fingerprint.d.ts +2 -0
- package/dist/adaptive/inMemoryStores.d.ts +3 -0
- package/dist/adaptive/postgresStores.d.ts +245 -0
- package/dist/adaptive/types.d.ts +62 -0
- package/dist/agents/idJag.d.ts +49 -0
- package/dist/agents/inMemoryStores.d.ts +4 -0
- package/dist/agents/index.d.ts +13 -0
- package/dist/agents/oidcAdapter.d.ts +20 -0
- package/dist/agents/postgresStores.d.ts +1176 -0
- package/dist/agents/registrationClient.d.ts +50 -0
- package/dist/apikeys/inMemoryStores.d.ts +4 -0
- package/dist/apikeys/postgresStores.d.ts +359 -0
- package/dist/audit/export.d.ts +2 -0
- package/dist/audit/inMemoryAuditStore.d.ts +2 -0
- package/dist/audit/integrity.d.ts +19 -0
- package/dist/audit/postgresAuditStore.d.ts +116 -0
- package/dist/audit/siem.d.ts +11 -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 +311 -0
- package/dist/client/index.d.ts +6 -0
- package/dist/client/mobile.d.ts +87 -0
- package/dist/client/passkeyHelpers.d.ts +19 -0
- package/dist/client/react.d.ts +87 -0
- package/dist/client/runtimeTransport.d.ts +3 -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/compliance/redaction.d.ts +8 -0
- package/dist/fga/config.d.ts +53 -0
- package/dist/fga/inMemoryStores.d.ts +3 -0
- package/dist/fga/postgresStores.d.ts +116 -0
- package/dist/fga/redisCheckCache.d.ts +11 -0
- package/dist/fga/schema.d.ts +2 -0
- package/dist/fga/types.d.ts +28 -0
- package/dist/fingerprint-client/index.d.ts +26 -0
- package/dist/htmx/index.d.ts +2 -0
- package/dist/index.d.ts +4042 -0
- package/dist/linkedProviders/index.d.ts +3 -0
- package/dist/lockout/inMemoryLockoutStore.d.ts +2 -0
- package/dist/lockout/postgresLockoutStore.d.ts +71 -0
- package/dist/lockout/redisLockoutStore.d.ts +3 -0
- package/dist/manifest.d.ts +19 -0
- package/dist/manifest.json +386 -0
- package/dist/mfa/postgresMfaStore.d.ts +266 -0
- package/dist/migrations/generate.d.ts +2 -0
- package/dist/migrations/index.d.ts +6 -0
- package/dist/migrations/runner.d.ts +22 -0
- package/dist/migrations/types.d.ts +14 -0
- package/dist/oidc/clientIdMetadata.d.ts +28 -0
- package/dist/oidc/inMemoryStores.d.ts +12 -0
- package/dist/oidc/inMemoryVciStores.d.ts +3 -0
- package/dist/oidc/index.d.ts +14 -0
- package/dist/oidc/operator.d.ts +14 -0
- package/dist/oidc/postgresStores.d.ts +1361 -0
- package/dist/oidc/vciRoutes.d.ts +56 -0
- package/dist/organizations/inMemoryOrganizationStore.d.ts +2 -0
- package/dist/organizations/postgresOrganizationStore.d.ts +340 -0
- package/dist/passwordless/inMemoryPasswordlessTokenStore.d.ts +2 -0
- package/dist/passwordless/postgresPasswordlessTokenStore.d.ts +56 -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/portal/inMemorySetupSessionStore.d.ts +2 -0
- package/dist/portal/postgresSetupSessionStore.d.ts +116 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/roles/inMemoryRoleStore.d.ts +2 -0
- package/dist/roles/postgresRoleStore.d.ts +86 -0
- package/dist/roles/resolver.d.ts +17 -0
- package/dist/saml.d.ts +1 -0
- package/dist/scim/inMemoryScimTokenStore.d.ts +2 -0
- package/dist/scim/postgresScimTokenStore.d.ts +86 -0
- package/dist/server.d.ts +34 -0
- package/dist/sso/inMemorySamlServiceProviderStore.d.ts +2 -0
- package/dist/sso/inMemorySsoConnectionStore.d.ts +2 -0
- package/dist/sso/nodeSamlAdapter.d.ts +8 -0
- package/dist/sso/postgresSamlServiceProviderStore.d.ts +101 -0
- package/dist/sso/postgresSsoConnectionStore.d.ts +117 -0
- package/dist/sso/samlIdpRoutes.d.ts +268 -0
- package/dist/vault/index.d.ts +5 -0
- package/dist/vc/inMemoryVpStores.d.ts +2 -0
- package/dist/vc/openid4vp.d.ts +82 -0
- package/dist/vc/postgresVcStores.d.ts +300 -0
- package/dist/vc/statusList.d.ts +29 -0
- package/dist/vc/statusListRoutes.d.ts +169 -0
- package/dist/vc/vpRoutes.d.ts +224 -0
- package/dist/webauthn/inMemoryWebAuthnCredentialStore.d.ts +2 -0
- package/dist/webauthn/postgresWebAuthnCredentialStore.d.ts +146 -0
- package/dist/webauthn/simpleWebAuthnAdapter.d.ts +3 -0
- package/dist/webauthn.d.ts +1 -0
- package/dist/webhooks/inMemoryStore.d.ts +2 -0
- package/dist/webhooks/postgresStore.d.ts +116 -0
- package/package.json +3 -3
|
@@ -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,311 @@
|
|
|
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?: AuthClientFetch;
|
|
41
|
+
routes?: AuthClientRoutes;
|
|
42
|
+
transport?: AuthClientTransport;
|
|
43
|
+
};
|
|
44
|
+
export type AuthClientFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
45
|
+
export type AuthClientTransport = {
|
|
46
|
+
fetch?: AuthClientFetch;
|
|
47
|
+
signInEmail?: (body: {
|
|
48
|
+
email: string;
|
|
49
|
+
password: string;
|
|
50
|
+
}) => Promise<{
|
|
51
|
+
passwordCompromised?: boolean;
|
|
52
|
+
status: 'authenticated' | 'mfa_required';
|
|
53
|
+
}>;
|
|
54
|
+
signOut?: () => Promise<null>;
|
|
55
|
+
signUpEmail?: (body: {
|
|
56
|
+
email: string;
|
|
57
|
+
password: string;
|
|
58
|
+
[extra: string]: unknown;
|
|
59
|
+
}) => Promise<{
|
|
60
|
+
status: 'authenticated';
|
|
61
|
+
} | {
|
|
62
|
+
status: 'verification_required';
|
|
63
|
+
}>;
|
|
64
|
+
status?: () => Promise<{
|
|
65
|
+
impersonator?: unknown;
|
|
66
|
+
user: unknown | null;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
export declare const createAuthClient: ({ baseUrl, credentials, fetch: fetchImpl, routes, transport: configuredTransport }?: AuthClientConfig) => {
|
|
70
|
+
emailVerification: {
|
|
71
|
+
request: (body: {
|
|
72
|
+
email: string;
|
|
73
|
+
}) => Promise<{
|
|
74
|
+
data: null;
|
|
75
|
+
error: AuthClientError;
|
|
76
|
+
} | {
|
|
77
|
+
data: {
|
|
78
|
+
ok: true;
|
|
79
|
+
};
|
|
80
|
+
error: null;
|
|
81
|
+
}>;
|
|
82
|
+
verify: (body: {
|
|
83
|
+
token: string;
|
|
84
|
+
}) => Promise<{
|
|
85
|
+
data: null;
|
|
86
|
+
error: AuthClientError;
|
|
87
|
+
} | {
|
|
88
|
+
data: {
|
|
89
|
+
ok: true;
|
|
90
|
+
};
|
|
91
|
+
error: null;
|
|
92
|
+
}>;
|
|
93
|
+
};
|
|
94
|
+
mfa: {
|
|
95
|
+
challenge: (body: {
|
|
96
|
+
code: string;
|
|
97
|
+
}) => Promise<{
|
|
98
|
+
data: null;
|
|
99
|
+
error: AuthClientError;
|
|
100
|
+
} | {
|
|
101
|
+
data: {
|
|
102
|
+
status: "authenticated";
|
|
103
|
+
};
|
|
104
|
+
error: null;
|
|
105
|
+
}>;
|
|
106
|
+
disable: () => Promise<{
|
|
107
|
+
data: null;
|
|
108
|
+
error: AuthClientError;
|
|
109
|
+
} | {
|
|
110
|
+
data: {
|
|
111
|
+
status: "disabled";
|
|
112
|
+
};
|
|
113
|
+
error: null;
|
|
114
|
+
}>;
|
|
115
|
+
setup: () => Promise<{
|
|
116
|
+
data: null;
|
|
117
|
+
error: AuthClientError;
|
|
118
|
+
} | {
|
|
119
|
+
data: {
|
|
120
|
+
secret: string;
|
|
121
|
+
uri: string;
|
|
122
|
+
};
|
|
123
|
+
error: null;
|
|
124
|
+
}>;
|
|
125
|
+
status: () => Promise<{
|
|
126
|
+
data: null;
|
|
127
|
+
error: AuthClientError;
|
|
128
|
+
} | {
|
|
129
|
+
data: import("..").MfaStatus;
|
|
130
|
+
error: null;
|
|
131
|
+
}>;
|
|
132
|
+
verifySetup: (body: {
|
|
133
|
+
code: string;
|
|
134
|
+
}) => Promise<{
|
|
135
|
+
data: null;
|
|
136
|
+
error: AuthClientError;
|
|
137
|
+
} | {
|
|
138
|
+
data: {
|
|
139
|
+
backupCodes: string[];
|
|
140
|
+
};
|
|
141
|
+
error: null;
|
|
142
|
+
}>;
|
|
143
|
+
};
|
|
144
|
+
passkeys: {
|
|
145
|
+
authenticateOptions: () => Promise<{
|
|
146
|
+
data: null;
|
|
147
|
+
error: AuthClientError;
|
|
148
|
+
} | {
|
|
149
|
+
data: PublicKeyCredentialRequestOptionsJSON;
|
|
150
|
+
error: null;
|
|
151
|
+
}>;
|
|
152
|
+
authenticateVerify: (response: unknown) => Promise<{
|
|
153
|
+
data: null;
|
|
154
|
+
error: AuthClientError;
|
|
155
|
+
} | {
|
|
156
|
+
data: {
|
|
157
|
+
status: "authenticated";
|
|
158
|
+
};
|
|
159
|
+
error: null;
|
|
160
|
+
}>;
|
|
161
|
+
list: () => Promise<{
|
|
162
|
+
data: null;
|
|
163
|
+
error: AuthClientError;
|
|
164
|
+
} | {
|
|
165
|
+
data: unknown[];
|
|
166
|
+
error: null;
|
|
167
|
+
}>;
|
|
168
|
+
registerOptions: () => Promise<{
|
|
169
|
+
data: null;
|
|
170
|
+
error: AuthClientError;
|
|
171
|
+
} | {
|
|
172
|
+
data: PublicKeyCredentialCreationOptionsJSON;
|
|
173
|
+
error: null;
|
|
174
|
+
}>;
|
|
175
|
+
registerVerify: (response: unknown) => Promise<{
|
|
176
|
+
data: null;
|
|
177
|
+
error: AuthClientError;
|
|
178
|
+
} | {
|
|
179
|
+
data: {
|
|
180
|
+
ok: true;
|
|
181
|
+
};
|
|
182
|
+
error: null;
|
|
183
|
+
}>;
|
|
184
|
+
remove: (credentialId: string) => Promise<{
|
|
185
|
+
data: null;
|
|
186
|
+
error: AuthClientError;
|
|
187
|
+
} | {
|
|
188
|
+
data: {
|
|
189
|
+
ok: true;
|
|
190
|
+
};
|
|
191
|
+
error: null;
|
|
192
|
+
}>;
|
|
193
|
+
};
|
|
194
|
+
passwordless: {
|
|
195
|
+
requestMagicLink: (body: {
|
|
196
|
+
email: string;
|
|
197
|
+
}) => Promise<{
|
|
198
|
+
data: null;
|
|
199
|
+
error: AuthClientError;
|
|
200
|
+
} | {
|
|
201
|
+
data: {
|
|
202
|
+
ok: true;
|
|
203
|
+
};
|
|
204
|
+
error: null;
|
|
205
|
+
}>;
|
|
206
|
+
verifyMagicLink: (body: {
|
|
207
|
+
token: string;
|
|
208
|
+
}) => Promise<{
|
|
209
|
+
data: null;
|
|
210
|
+
error: AuthClientError;
|
|
211
|
+
} | {
|
|
212
|
+
data: {
|
|
213
|
+
status: "authenticated";
|
|
214
|
+
};
|
|
215
|
+
error: null;
|
|
216
|
+
}>;
|
|
217
|
+
};
|
|
218
|
+
passwordReset: {
|
|
219
|
+
confirm: (body: {
|
|
220
|
+
password: string;
|
|
221
|
+
token: string;
|
|
222
|
+
}) => Promise<{
|
|
223
|
+
data: null;
|
|
224
|
+
error: AuthClientError;
|
|
225
|
+
} | {
|
|
226
|
+
data: {
|
|
227
|
+
ok: true;
|
|
228
|
+
};
|
|
229
|
+
error: null;
|
|
230
|
+
}>;
|
|
231
|
+
request: (body: {
|
|
232
|
+
email: string;
|
|
233
|
+
}) => Promise<{
|
|
234
|
+
data: null;
|
|
235
|
+
error: AuthClientError;
|
|
236
|
+
} | {
|
|
237
|
+
data: {
|
|
238
|
+
ok: true;
|
|
239
|
+
};
|
|
240
|
+
error: null;
|
|
241
|
+
}>;
|
|
242
|
+
};
|
|
243
|
+
sessions: {
|
|
244
|
+
list: () => Promise<{
|
|
245
|
+
data: null;
|
|
246
|
+
error: AuthClientError;
|
|
247
|
+
} | {
|
|
248
|
+
data: unknown[];
|
|
249
|
+
error: null;
|
|
250
|
+
}>;
|
|
251
|
+
revoke: (sessionId: string) => Promise<{
|
|
252
|
+
data: null;
|
|
253
|
+
error: AuthClientError;
|
|
254
|
+
} | {
|
|
255
|
+
data: {
|
|
256
|
+
ok: true;
|
|
257
|
+
};
|
|
258
|
+
error: null;
|
|
259
|
+
}>;
|
|
260
|
+
};
|
|
261
|
+
signIn: {
|
|
262
|
+
email: (body: {
|
|
263
|
+
email: string;
|
|
264
|
+
password: string;
|
|
265
|
+
}) => Promise<{
|
|
266
|
+
data: null;
|
|
267
|
+
error: AuthClientError;
|
|
268
|
+
} | {
|
|
269
|
+
data: {
|
|
270
|
+
passwordCompromised?: boolean;
|
|
271
|
+
status: "authenticated" | "mfa_required";
|
|
272
|
+
};
|
|
273
|
+
error: null;
|
|
274
|
+
}>;
|
|
275
|
+
};
|
|
276
|
+
signUp: {
|
|
277
|
+
email: (body: {
|
|
278
|
+
email: string;
|
|
279
|
+
password: string;
|
|
280
|
+
[extra: string]: unknown;
|
|
281
|
+
}) => Promise<{
|
|
282
|
+
data: null;
|
|
283
|
+
error: AuthClientError;
|
|
284
|
+
} | {
|
|
285
|
+
data: {
|
|
286
|
+
status: "authenticated";
|
|
287
|
+
} | {
|
|
288
|
+
status: "verification_required";
|
|
289
|
+
};
|
|
290
|
+
error: null;
|
|
291
|
+
}>;
|
|
292
|
+
};
|
|
293
|
+
signOut: () => Promise<{
|
|
294
|
+
data: null;
|
|
295
|
+
error: AuthClientError;
|
|
296
|
+
} | {
|
|
297
|
+
data: null;
|
|
298
|
+
error: null;
|
|
299
|
+
}>;
|
|
300
|
+
status: () => Promise<{
|
|
301
|
+
data: null;
|
|
302
|
+
error: AuthClientError;
|
|
303
|
+
} | {
|
|
304
|
+
data: {
|
|
305
|
+
impersonator?: unknown;
|
|
306
|
+
user: unknown | null;
|
|
307
|
+
};
|
|
308
|
+
error: null;
|
|
309
|
+
}>;
|
|
310
|
+
};
|
|
311
|
+
export type AuthClient = ReturnType<typeof createAuthClient>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export type MobileAuthSecureStorage = {
|
|
2
|
+
capability?: () => Promise<{
|
|
3
|
+
available: boolean;
|
|
4
|
+
message?: string;
|
|
5
|
+
}>;
|
|
6
|
+
get(key: string): Promise<string | null>;
|
|
7
|
+
remove(key: string): Promise<void>;
|
|
8
|
+
set(key: string, value: string): Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export type MobileAuthLinks = {
|
|
11
|
+
getLaunchUrl(): Promise<string | null>;
|
|
12
|
+
onOpen(listener: (url: string) => void): Promise<() => Promise<void> | void>;
|
|
13
|
+
openExternal(url: string): Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export type MobileAuthLifecycle = {
|
|
16
|
+
onResume?(listener: () => void): Promise<() => Promise<void> | void>;
|
|
17
|
+
};
|
|
18
|
+
export type MobileAuthDiscovery = {
|
|
19
|
+
authorization_endpoint: string;
|
|
20
|
+
code_challenge_methods_supported?: string[];
|
|
21
|
+
issuer: string;
|
|
22
|
+
jwks_uri: string;
|
|
23
|
+
revocation_endpoint?: string;
|
|
24
|
+
socket_ticket_endpoint?: string;
|
|
25
|
+
token_endpoint: string;
|
|
26
|
+
token_endpoint_auth_methods_supported?: string[];
|
|
27
|
+
userinfo_endpoint: string;
|
|
28
|
+
};
|
|
29
|
+
export type MobileAuthClientConfig = {
|
|
30
|
+
allowedOrigins?: readonly string[];
|
|
31
|
+
clientId: string;
|
|
32
|
+
clockSkewMs?: number;
|
|
33
|
+
fetch?: typeof globalThis.fetch;
|
|
34
|
+
issuer: string;
|
|
35
|
+
lifecycle?: MobileAuthLifecycle;
|
|
36
|
+
links: MobileAuthLinks;
|
|
37
|
+
now?: () => number;
|
|
38
|
+
redirectUri: string;
|
|
39
|
+
resource?: string;
|
|
40
|
+
scopes?: readonly string[];
|
|
41
|
+
storage: MobileAuthSecureStorage;
|
|
42
|
+
};
|
|
43
|
+
export type MobileAuthSignInOptions = {
|
|
44
|
+
authorizationParameters?: Readonly<Record<string, string>>;
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
};
|
|
47
|
+
export type MobileAuthTokens = {
|
|
48
|
+
accessToken: string;
|
|
49
|
+
expiresAt: number;
|
|
50
|
+
idToken: string;
|
|
51
|
+
refreshToken: string;
|
|
52
|
+
scope: string[];
|
|
53
|
+
tokenType: 'Bearer';
|
|
54
|
+
};
|
|
55
|
+
export type MobileAuthUser = Record<string, unknown> & {
|
|
56
|
+
sub: string;
|
|
57
|
+
};
|
|
58
|
+
export type MobileAuthErrorCode = 'aborted' | 'callback' | 'discovery' | 'id-token' | 'network' | 'oauth' | 'origin' | 'secure-storage' | 'token';
|
|
59
|
+
export declare class MobileAuthError extends Error {
|
|
60
|
+
readonly code: MobileAuthErrorCode;
|
|
61
|
+
readonly cause?: unknown;
|
|
62
|
+
constructor(code: MobileAuthErrorCode, message: string, options?: {
|
|
63
|
+
cause?: unknown;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export declare const createMobileAuthClient: (config: MobileAuthClientConfig) => {
|
|
67
|
+
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
68
|
+
fetchOptional: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
69
|
+
handleCallback: (value: string) => Promise<MobileAuthTokens>;
|
|
70
|
+
refresh: () => Promise<string>;
|
|
71
|
+
signIn: (options?: MobileAuthSignInOptions) => Promise<MobileAuthTokens>;
|
|
72
|
+
signOut: () => Promise<void>;
|
|
73
|
+
socketTicket: (audience?: string) => Promise<string>;
|
|
74
|
+
start: () => Promise<void>;
|
|
75
|
+
status: () => Promise<{
|
|
76
|
+
sub: string;
|
|
77
|
+
} | null>;
|
|
78
|
+
stop: () => Promise<void>;
|
|
79
|
+
};
|
|
80
|
+
export type MobileAuthClient = ReturnType<typeof createMobileAuthClient>;
|
|
81
|
+
/** Adapts the native OAuth lifecycle behind the same createAuthClient API used
|
|
82
|
+
* by web applications. Passwords stay out of the WebView request path; the
|
|
83
|
+
* external authorization UI owns credential entry and MFA. */
|
|
84
|
+
export declare const createMobileAuthTransport: (client: MobileAuthClient, options?: {
|
|
85
|
+
baseUrl?: string;
|
|
86
|
+
}) => import("./createAuthClient").AuthClientTransport;
|
|
87
|
+
export { installAuthClientRuntimeTransport } from './runtimeTransport';
|
|
@@ -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;
|