@supabase/auth-js 2.73.0-rc.3 → 2.79.1-canary.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 +96 -4
- package/dist/main/GoTrueAdminApi.js.map +1 -1
- package/dist/main/GoTrueClient.d.ts +21 -2
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +61 -37
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/base64url.d.ts +3 -2
- package/dist/main/lib/base64url.d.ts.map +1 -1
- package/dist/main/lib/base64url.js +10 -11
- package/dist/main/lib/base64url.js.map +1 -1
- package/dist/main/lib/error-codes.d.ts +1 -1
- package/dist/main/lib/error-codes.d.ts.map +1 -1
- package/dist/main/lib/errors.d.ts.map +1 -1
- package/dist/main/lib/errors.js +7 -7
- package/dist/main/lib/errors.js.map +1 -1
- package/dist/main/lib/fetch.d.ts +2 -2
- package/dist/main/lib/fetch.d.ts.map +1 -1
- package/dist/main/lib/fetch.js +8 -9
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +3 -2
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +34 -24
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/local-storage.js +1 -2
- package/dist/main/lib/local-storage.js.map +1 -1
- package/dist/main/lib/locks.js +3 -3
- package/dist/main/lib/locks.js.map +1 -1
- package/dist/main/lib/polyfills.js +1 -2
- package/dist/main/lib/polyfills.js.map +1 -1
- package/dist/main/lib/types.d.ts +233 -112
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/types.js +3 -2
- package/dist/main/lib/types.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.d.ts.map +1 -1
- package/dist/main/lib/version.js +7 -1
- package/dist/main/lib/version.js.map +1 -1
- package/dist/main/lib/web3/ethereum.d.ts +9 -9
- package/dist/main/lib/web3/ethereum.d.ts.map +1 -1
- package/dist/main/lib/web3/ethereum.js +4 -5
- package/dist/main/lib/web3/ethereum.js.map +1 -1
- package/dist/main/lib/web3/solana.d.ts +4 -4
- package/dist/main/lib/web3/solana.d.ts.map +1 -1
- package/dist/main/lib/webauthn.d.ts +274 -0
- package/dist/main/lib/webauthn.d.ts.map +1 -0
- package/dist/main/lib/webauthn.dom.d.ts +583 -0
- package/dist/main/lib/webauthn.dom.d.ts.map +1 -0
- package/dist/main/lib/webauthn.dom.js +4 -0
- package/dist/main/lib/webauthn.dom.js.map +1 -0
- package/dist/main/lib/webauthn.errors.d.ts +80 -0
- package/dist/main/lib/webauthn.errors.d.ts.map +1 -0
- package/dist/main/lib/webauthn.errors.js +265 -0
- package/dist/main/lib/webauthn.errors.js.map +1 -0
- package/dist/main/lib/webauthn.js +702 -0
- package/dist/main/lib/webauthn.js.map +1 -0
- package/dist/module/GoTrueAdminApi.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts +21 -2
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +68 -43
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/base64url.d.ts +3 -2
- package/dist/module/lib/base64url.d.ts.map +1 -1
- package/dist/module/lib/base64url.js.map +1 -1
- package/dist/module/lib/error-codes.d.ts +1 -1
- package/dist/module/lib/error-codes.d.ts.map +1 -1
- package/dist/module/lib/errors.d.ts.map +1 -1
- package/dist/module/lib/fetch.d.ts +2 -2
- package/dist/module/lib/fetch.d.ts.map +1 -1
- package/dist/module/lib/fetch.js.map +1 -1
- package/dist/module/lib/helpers.d.ts +3 -2
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/locks.js.map +1 -1
- package/dist/module/lib/polyfills.js.map +1 -1
- package/dist/module/lib/types.d.ts +233 -112
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/types.js +2 -1
- package/dist/module/lib/types.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.d.ts.map +1 -1
- package/dist/module/lib/version.js +7 -1
- package/dist/module/lib/version.js.map +1 -1
- package/dist/module/lib/web3/ethereum.d.ts +9 -9
- package/dist/module/lib/web3/ethereum.d.ts.map +1 -1
- package/dist/module/lib/web3/ethereum.js.map +1 -1
- package/dist/module/lib/web3/solana.d.ts +4 -4
- package/dist/module/lib/web3/solana.d.ts.map +1 -1
- package/dist/module/lib/webauthn.d.ts +274 -0
- package/dist/module/lib/webauthn.d.ts.map +1 -0
- package/dist/module/lib/webauthn.dom.d.ts +583 -0
- package/dist/module/lib/webauthn.dom.d.ts.map +1 -0
- package/dist/module/lib/webauthn.dom.js +3 -0
- package/dist/module/lib/webauthn.dom.js.map +1 -0
- package/dist/module/lib/webauthn.errors.d.ts +80 -0
- package/dist/module/lib/webauthn.errors.d.ts.map +1 -0
- package/dist/module/lib/webauthn.errors.js +257 -0
- package/dist/module/lib/webauthn.errors.js.map +1 -0
- package/dist/module/lib/webauthn.js +685 -0
- package/dist/module/lib/webauthn.js.map +1 -0
- package/package.json +13 -34
- package/src/GoTrueClient.ts +218 -69
- package/src/lib/base64url.ts +4 -2
- package/src/lib/helpers.ts +2 -1
- package/src/lib/types.ts +212 -33
- package/src/lib/version.ts +7 -1
- package/src/lib/webauthn.dom.ts +636 -0
- package/src/lib/webauthn.errors.ts +317 -0
- package/src/lib/webauthn.ts +929 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { EIP1193Provider } from './web3/ethereum';
|
|
2
1
|
import { AuthError } from './errors';
|
|
3
2
|
import { Fetch } from './fetch';
|
|
3
|
+
import { EIP1193Provider, EthereumSignInInput, Hex } from './web3/ethereum';
|
|
4
4
|
import type { SolanaSignInInput, SolanaSignInOutput } from './web3/solana';
|
|
5
|
-
import {
|
|
5
|
+
import { ServerCredentialCreationOptions, ServerCredentialRequestOptions, WebAuthnApi } from './webauthn';
|
|
6
|
+
import { AuthenticationCredential, PublicKeyCredentialCreationOptionsFuture, PublicKeyCredentialRequestOptionsFuture, RegistrationCredential } from './webauthn.dom';
|
|
6
7
|
/** One of the providers supported by GoTrue. */
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type Provider = 'apple' | 'azure' | 'bitbucket' | 'discord' | 'facebook' | 'figma' | 'github' | 'gitlab' | 'google' | 'kakao' | 'keycloak' | 'linkedin' | 'linkedin_oidc' | 'notion' | 'slack' | 'slack_oidc' | 'spotify' | 'twitch' | 'twitter' | 'workos' | 'zoom' | 'fly';
|
|
9
|
+
export type AuthChangeEventMFA = 'MFA_CHALLENGE_VERIFIED';
|
|
10
|
+
export type AuthChangeEvent = 'INITIAL_SESSION' | 'PASSWORD_RECOVERY' | 'SIGNED_IN' | 'SIGNED_OUT' | 'TOKEN_REFRESHED' | 'USER_UPDATED' | AuthChangeEventMFA;
|
|
10
11
|
/**
|
|
11
12
|
* Provide your own global lock implementation instead of the default
|
|
12
13
|
* implementation. The function should acquire a lock for the duration of the
|
|
@@ -22,8 +23,8 @@ export declare type AuthChangeEvent = 'INITIAL_SESSION' | 'PASSWORD_RECOVERY' |
|
|
|
22
23
|
* acquired after this much time (ms).
|
|
23
24
|
* @param fn The operation to execute when the lock is acquired.
|
|
24
25
|
*/
|
|
25
|
-
export
|
|
26
|
-
export
|
|
26
|
+
export type LockFunc = <R>(name: string, acquireTimeout: number, fn: () => Promise<R>) => Promise<R>;
|
|
27
|
+
export type GoTrueClientOptions = {
|
|
27
28
|
url?: string;
|
|
28
29
|
headers?: {
|
|
29
30
|
[key: string]: string;
|
|
@@ -57,8 +58,8 @@ export declare type GoTrueClientOptions = {
|
|
|
57
58
|
hasCustomAuthorizationHeader?: boolean;
|
|
58
59
|
};
|
|
59
60
|
declare const WeakPasswordReasons: readonly ["length", "characters", "pwned"];
|
|
60
|
-
export
|
|
61
|
-
export
|
|
61
|
+
export type WeakPasswordReasons = (typeof WeakPasswordReasons)[number];
|
|
62
|
+
export type WeakPassword = {
|
|
62
63
|
reasons: WeakPasswordReasons[];
|
|
63
64
|
message: string;
|
|
64
65
|
};
|
|
@@ -66,13 +67,19 @@ export declare type WeakPassword = {
|
|
|
66
67
|
* Resolve mapped types and show the derived keys and their types when hovering in
|
|
67
68
|
* VS Code, instead of just showing the names those mapped types are defined with.
|
|
68
69
|
*/
|
|
69
|
-
export
|
|
70
|
+
export type Prettify<T> = T extends Function ? T : {
|
|
70
71
|
[K in keyof T]: T[K];
|
|
71
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* A stricter version of TypeScript's Omit that only allows omitting keys that actually exist.
|
|
75
|
+
* This prevents typos and ensures type safety at compile time.
|
|
76
|
+
* Unlike regular Omit, this will error if you try to omit a non-existent key.
|
|
77
|
+
*/
|
|
78
|
+
export type StrictOmit<T, K extends keyof T> = Omit<T, K>;
|
|
72
79
|
/**
|
|
73
80
|
* a shared result type that encapsulates errors instead of throwing them, allows you to optionally specify the ErrorType
|
|
74
81
|
*/
|
|
75
|
-
export
|
|
82
|
+
export type RequestResult<T, ErrorType extends Error = AuthError> = {
|
|
76
83
|
data: T;
|
|
77
84
|
error: null;
|
|
78
85
|
} | {
|
|
@@ -83,7 +90,7 @@ export declare type RequestResult<T, ErrorType extends Error = AuthError> = {
|
|
|
83
90
|
* similar to RequestResult except it allows you to destructure the possible shape of the success response
|
|
84
91
|
* {@see RequestResult}
|
|
85
92
|
*/
|
|
86
|
-
export
|
|
93
|
+
export type RequestResultSafeDestructure<T> = {
|
|
87
94
|
data: T;
|
|
88
95
|
error: null;
|
|
89
96
|
} | {
|
|
@@ -92,11 +99,11 @@ export declare type RequestResultSafeDestructure<T> = {
|
|
|
92
99
|
} : null;
|
|
93
100
|
error: AuthError;
|
|
94
101
|
};
|
|
95
|
-
export
|
|
102
|
+
export type AuthResponse = RequestResultSafeDestructure<{
|
|
96
103
|
user: User | null;
|
|
97
104
|
session: Session | null;
|
|
98
105
|
}>;
|
|
99
|
-
export
|
|
106
|
+
export type AuthResponsePassword = RequestResultSafeDestructure<{
|
|
100
107
|
user: User | null;
|
|
101
108
|
session: Session | null;
|
|
102
109
|
weak_password?: WeakPassword | null;
|
|
@@ -106,21 +113,21 @@ export declare type AuthResponsePassword = RequestResultSafeDestructure<{
|
|
|
106
113
|
*
|
|
107
114
|
* {@see AuthResponse}
|
|
108
115
|
*/
|
|
109
|
-
export
|
|
116
|
+
export type AuthOtpResponse = RequestResultSafeDestructure<{
|
|
110
117
|
user: null;
|
|
111
118
|
session: null;
|
|
112
119
|
messageId?: string | null;
|
|
113
120
|
}>;
|
|
114
|
-
export
|
|
121
|
+
export type AuthTokenResponse = RequestResultSafeDestructure<{
|
|
115
122
|
user: User;
|
|
116
123
|
session: Session;
|
|
117
124
|
}>;
|
|
118
|
-
export
|
|
125
|
+
export type AuthTokenResponsePassword = RequestResultSafeDestructure<{
|
|
119
126
|
user: User;
|
|
120
127
|
session: Session;
|
|
121
128
|
weakPassword?: WeakPassword;
|
|
122
129
|
}>;
|
|
123
|
-
export
|
|
130
|
+
export type OAuthResponse = {
|
|
124
131
|
data: {
|
|
125
132
|
provider: Provider;
|
|
126
133
|
url: string;
|
|
@@ -133,7 +140,7 @@ export declare type OAuthResponse = {
|
|
|
133
140
|
};
|
|
134
141
|
error: AuthError;
|
|
135
142
|
};
|
|
136
|
-
export
|
|
143
|
+
export type SSOResponse = RequestResult<{
|
|
137
144
|
/**
|
|
138
145
|
* URL to open in a browser which will complete the sign-in flow by
|
|
139
146
|
* taking the user to the identity provider's authentication flow.
|
|
@@ -143,7 +150,7 @@ export declare type SSOResponse = RequestResult<{
|
|
|
143
150
|
*/
|
|
144
151
|
url: string;
|
|
145
152
|
}>;
|
|
146
|
-
export
|
|
153
|
+
export type UserResponse = RequestResultSafeDestructure<{
|
|
147
154
|
user: User;
|
|
148
155
|
}>;
|
|
149
156
|
export interface Session {
|
|
@@ -178,8 +185,8 @@ export interface Session {
|
|
|
178
185
|
*/
|
|
179
186
|
user: User;
|
|
180
187
|
}
|
|
181
|
-
declare const AMRMethods: readonly ["password", "otp", "oauth", "totp", "mfa/totp", "mfa/phone", "anonymous", "sso/saml", "magiclink", "web3"];
|
|
182
|
-
export
|
|
188
|
+
declare const AMRMethods: readonly ["password", "otp", "oauth", "totp", "mfa/totp", "mfa/phone", "mfa/webauthn", "anonymous", "sso/saml", "magiclink", "web3"];
|
|
189
|
+
export type AMRMethod = (typeof AMRMethods)[number] | (string & {});
|
|
183
190
|
/**
|
|
184
191
|
* An authentication methord reference (AMR) entry.
|
|
185
192
|
*
|
|
@@ -209,16 +216,16 @@ export interface UserIdentity {
|
|
|
209
216
|
last_sign_in_at?: string;
|
|
210
217
|
updated_at?: string;
|
|
211
218
|
}
|
|
212
|
-
|
|
219
|
+
declare const FactorTypes: readonly ["totp", "phone", "webauthn"];
|
|
213
220
|
/**
|
|
214
221
|
* Type of factor. `totp` and `phone` supported with this version
|
|
215
222
|
*/
|
|
216
|
-
export
|
|
223
|
+
export type FactorType = (typeof FactorTypes)[number];
|
|
217
224
|
declare const FactorVerificationStatuses: readonly ["verified", "unverified"];
|
|
218
225
|
/**
|
|
219
226
|
* The verification status of the factor, default is `unverified` after `.enroll()`, then `verified` after the user verifies it with `.verify()`
|
|
220
227
|
*/
|
|
221
|
-
|
|
228
|
+
type FactorVerificationStatus = (typeof FactorVerificationStatuses)[number];
|
|
222
229
|
/**
|
|
223
230
|
* A MFA factor.
|
|
224
231
|
*
|
|
@@ -226,7 +233,7 @@ declare type FactorVerificationStatus = typeof FactorVerificationStatuses[number
|
|
|
226
233
|
* @see {@link GoTrueMFAApi#listFactors}
|
|
227
234
|
* @see {@link GoTrueMFAAdminApi#listFactors}
|
|
228
235
|
*/
|
|
229
|
-
export
|
|
236
|
+
export type Factor<Type extends FactorType = FactorType, Status extends FactorVerificationStatus = (typeof FactorVerificationStatuses)[number]> = {
|
|
230
237
|
/** ID of the factor. */
|
|
231
238
|
id: string;
|
|
232
239
|
/** Friendly name of the factor, useful to disambiguate between multiple factors. */
|
|
@@ -273,7 +280,7 @@ export interface User {
|
|
|
273
280
|
identities?: UserIdentity[];
|
|
274
281
|
is_anonymous?: boolean;
|
|
275
282
|
is_sso_user?: boolean;
|
|
276
|
-
factors?: Factor<FactorType>[];
|
|
283
|
+
factors?: (Factor<FactorType, 'verified'> | Factor<FactorType, 'unverified'>)[];
|
|
277
284
|
deleted_at?: string;
|
|
278
285
|
}
|
|
279
286
|
export interface UserAttributes {
|
|
@@ -384,7 +391,7 @@ export interface Subscription {
|
|
|
384
391
|
*/
|
|
385
392
|
unsubscribe: () => void;
|
|
386
393
|
}
|
|
387
|
-
export
|
|
394
|
+
export type SignInAnonymouslyCredentials = {
|
|
388
395
|
options?: {
|
|
389
396
|
/**
|
|
390
397
|
* A custom data object to store the user's metadata. This maps to the `auth.users.raw_user_meta_data` column.
|
|
@@ -396,7 +403,7 @@ export declare type SignInAnonymouslyCredentials = {
|
|
|
396
403
|
captchaToken?: string;
|
|
397
404
|
};
|
|
398
405
|
};
|
|
399
|
-
export
|
|
406
|
+
export type SignUpWithPasswordCredentials = Prettify<PasswordCredentialsBase & {
|
|
400
407
|
options?: {
|
|
401
408
|
emailRedirectTo?: string;
|
|
402
409
|
data?: object;
|
|
@@ -404,19 +411,19 @@ export declare type SignUpWithPasswordCredentials = Prettify<PasswordCredentials
|
|
|
404
411
|
channel?: 'sms' | 'whatsapp';
|
|
405
412
|
};
|
|
406
413
|
}>;
|
|
407
|
-
|
|
414
|
+
type PasswordCredentialsBase = {
|
|
408
415
|
email: string;
|
|
409
416
|
password: string;
|
|
410
417
|
} | {
|
|
411
418
|
phone: string;
|
|
412
419
|
password: string;
|
|
413
420
|
};
|
|
414
|
-
export
|
|
421
|
+
export type SignInWithPasswordCredentials = PasswordCredentialsBase & {
|
|
415
422
|
options?: {
|
|
416
423
|
captchaToken?: string;
|
|
417
424
|
};
|
|
418
425
|
};
|
|
419
|
-
export
|
|
426
|
+
export type SignInWithPasswordlessCredentials = {
|
|
420
427
|
/** The user's email address. */
|
|
421
428
|
email: string;
|
|
422
429
|
options?: {
|
|
@@ -451,8 +458,8 @@ export declare type SignInWithPasswordlessCredentials = {
|
|
|
451
458
|
channel?: 'sms' | 'whatsapp';
|
|
452
459
|
};
|
|
453
460
|
};
|
|
454
|
-
export
|
|
455
|
-
export
|
|
461
|
+
export type AuthFlowType = 'implicit' | 'pkce';
|
|
462
|
+
export type SignInWithOAuthCredentials = {
|
|
456
463
|
/** One of the providers supported by GoTrue. */
|
|
457
464
|
provider: Provider;
|
|
458
465
|
options?: {
|
|
@@ -468,7 +475,7 @@ export declare type SignInWithOAuthCredentials = {
|
|
|
468
475
|
skipBrowserRedirect?: boolean;
|
|
469
476
|
};
|
|
470
477
|
};
|
|
471
|
-
export
|
|
478
|
+
export type SignInWithIdTokenCredentials = {
|
|
472
479
|
/** Provider name or OIDC `iss` value identifying which provider should be used to verify the provided token. Supported names: `google`, `apple`, `azure`, `facebook`, `kakao`, `keycloak` (deprecated). */
|
|
473
480
|
provider: 'google' | 'apple' | 'azure' | 'facebook' | 'kakao' | (string & {});
|
|
474
481
|
/** OIDC ID token issued by the specified provider. The `iss` claim in the ID token must match the supplied provider. Some ID tokens contain an `at_hash` which require that you provide an `access_token` value to be accepted properly. If the token contains a `nonce` claim you must supply the nonce used to obtain the ID token. */
|
|
@@ -482,14 +489,14 @@ export declare type SignInWithIdTokenCredentials = {
|
|
|
482
489
|
captchaToken?: string;
|
|
483
490
|
};
|
|
484
491
|
};
|
|
485
|
-
export
|
|
492
|
+
export type SolanaWallet = {
|
|
486
493
|
signIn?: (...inputs: SolanaSignInInput[]) => Promise<SolanaSignInOutput | SolanaSignInOutput[]>;
|
|
487
494
|
publicKey?: {
|
|
488
495
|
toBase58: () => string;
|
|
489
496
|
} | null;
|
|
490
497
|
signMessage?: (message: Uint8Array, encoding?: 'utf8' | string) => Promise<Uint8Array> | undefined;
|
|
491
498
|
};
|
|
492
|
-
export
|
|
499
|
+
export type SolanaWeb3Credentials = {
|
|
493
500
|
chain: 'solana';
|
|
494
501
|
/** Wallet interface to use. If not specified will default to `window.solana`. */
|
|
495
502
|
wallet?: SolanaWallet;
|
|
@@ -513,8 +520,8 @@ export declare type SolanaWeb3Credentials = {
|
|
|
513
520
|
captchaToken?: string;
|
|
514
521
|
};
|
|
515
522
|
};
|
|
516
|
-
export
|
|
517
|
-
export
|
|
523
|
+
export type EthereumWallet = EIP1193Provider;
|
|
524
|
+
export type EthereumWeb3Credentials = {
|
|
518
525
|
chain: 'ethereum';
|
|
519
526
|
/** Wallet interface to use. If not specified will default to `window.ethereum`. */
|
|
520
527
|
wallet?: EthereumWallet;
|
|
@@ -538,8 +545,8 @@ export declare type EthereumWeb3Credentials = {
|
|
|
538
545
|
captchaToken?: string;
|
|
539
546
|
};
|
|
540
547
|
};
|
|
541
|
-
export
|
|
542
|
-
export
|
|
548
|
+
export type Web3Credentials = SolanaWeb3Credentials | EthereumWeb3Credentials;
|
|
549
|
+
export type VerifyOtpParams = VerifyMobileOtpParams | VerifyEmailOtpParams | VerifyTokenHashParams;
|
|
543
550
|
export interface VerifyMobileOtpParams {
|
|
544
551
|
/** The user's phone number. */
|
|
545
552
|
phone: string;
|
|
@@ -581,9 +588,9 @@ export interface VerifyTokenHashParams {
|
|
|
581
588
|
/** The user's verification type. */
|
|
582
589
|
type: EmailOtpType;
|
|
583
590
|
}
|
|
584
|
-
export
|
|
585
|
-
export
|
|
586
|
-
export
|
|
591
|
+
export type MobileOtpType = 'sms' | 'phone_change';
|
|
592
|
+
export type EmailOtpType = 'signup' | 'invite' | 'magiclink' | 'recovery' | 'email_change' | 'email';
|
|
593
|
+
export type ResendParams = {
|
|
587
594
|
type: Extract<EmailOtpType, 'signup' | 'email_change'>;
|
|
588
595
|
email: string;
|
|
589
596
|
options?: {
|
|
@@ -600,7 +607,7 @@ export declare type ResendParams = {
|
|
|
600
607
|
captchaToken?: string;
|
|
601
608
|
};
|
|
602
609
|
};
|
|
603
|
-
export
|
|
610
|
+
export type SignInWithSSO = {
|
|
604
611
|
/** UUID of the SSO provider to invoke single-sign on to. */
|
|
605
612
|
providerId: string;
|
|
606
613
|
options?: {
|
|
@@ -619,25 +626,25 @@ export declare type SignInWithSSO = {
|
|
|
619
626
|
captchaToken?: string;
|
|
620
627
|
};
|
|
621
628
|
};
|
|
622
|
-
export
|
|
629
|
+
export type GenerateSignupLinkParams = {
|
|
623
630
|
type: 'signup';
|
|
624
631
|
email: string;
|
|
625
632
|
password: string;
|
|
626
633
|
options?: Pick<GenerateLinkOptions, 'data' | 'redirectTo'>;
|
|
627
634
|
};
|
|
628
|
-
export
|
|
635
|
+
export type GenerateInviteOrMagiclinkParams = {
|
|
629
636
|
type: 'invite' | 'magiclink';
|
|
630
637
|
/** The user's email */
|
|
631
638
|
email: string;
|
|
632
639
|
options?: Pick<GenerateLinkOptions, 'data' | 'redirectTo'>;
|
|
633
640
|
};
|
|
634
|
-
export
|
|
641
|
+
export type GenerateRecoveryLinkParams = {
|
|
635
642
|
type: 'recovery';
|
|
636
643
|
/** The user's email */
|
|
637
644
|
email: string;
|
|
638
645
|
options?: Pick<GenerateLinkOptions, 'redirectTo'>;
|
|
639
646
|
};
|
|
640
|
-
export
|
|
647
|
+
export type GenerateEmailChangeLinkParams = {
|
|
641
648
|
type: 'email_change_current' | 'email_change_new';
|
|
642
649
|
/** The user's email */
|
|
643
650
|
email: string;
|
|
@@ -657,13 +664,13 @@ export interface GenerateLinkOptions {
|
|
|
657
664
|
/** The URL which will be appended to the email link generated. */
|
|
658
665
|
redirectTo?: string;
|
|
659
666
|
}
|
|
660
|
-
export
|
|
661
|
-
export
|
|
667
|
+
export type GenerateLinkParams = GenerateSignupLinkParams | GenerateInviteOrMagiclinkParams | GenerateRecoveryLinkParams | GenerateEmailChangeLinkParams;
|
|
668
|
+
export type GenerateLinkResponse = RequestResultSafeDestructure<{
|
|
662
669
|
properties: GenerateLinkProperties;
|
|
663
670
|
user: User;
|
|
664
671
|
}>;
|
|
665
672
|
/** The properties related to the email link generated */
|
|
666
|
-
export
|
|
673
|
+
export type GenerateLinkProperties = {
|
|
667
674
|
/**
|
|
668
675
|
* The email link to send to the user.
|
|
669
676
|
* The action_link follows the following format: auth/v1/verify?type={verification_type}&token={hashed_token}&redirect_to={redirect_to}
|
|
@@ -683,46 +690,90 @@ export declare type GenerateLinkProperties = {
|
|
|
683
690
|
/** The verification type that the email link is associated to. */
|
|
684
691
|
verification_type: GenerateLinkType;
|
|
685
692
|
};
|
|
686
|
-
export
|
|
687
|
-
export
|
|
688
|
-
export
|
|
693
|
+
export type GenerateLinkType = 'signup' | 'invite' | 'magiclink' | 'recovery' | 'email_change_current' | 'email_change_new';
|
|
694
|
+
export type MFAEnrollParams = MFAEnrollTOTPParams | MFAEnrollPhoneParams | MFAEnrollWebauthnParams;
|
|
695
|
+
export type MFAUnenrollParams = {
|
|
689
696
|
/** ID of the factor being unenrolled. */
|
|
690
697
|
factorId: string;
|
|
691
698
|
};
|
|
692
|
-
|
|
699
|
+
type MFAVerifyParamsBase = {
|
|
693
700
|
/** ID of the factor being verified. Returned in enroll(). */
|
|
694
701
|
factorId: string;
|
|
695
702
|
/** ID of the challenge being verified. Returned in challenge(). */
|
|
696
703
|
challengeId: string;
|
|
697
704
|
};
|
|
698
|
-
|
|
705
|
+
type MFAVerifyTOTPParamFields = {
|
|
699
706
|
/** Verification code provided by the user. */
|
|
700
707
|
code: string;
|
|
701
708
|
};
|
|
702
|
-
export
|
|
703
|
-
|
|
704
|
-
export
|
|
705
|
-
|
|
706
|
-
|
|
709
|
+
export type MFAVerifyTOTPParams = Prettify<MFAVerifyParamsBase & MFAVerifyTOTPParamFields>;
|
|
710
|
+
type MFAVerifyPhoneParamFields = MFAVerifyTOTPParamFields;
|
|
711
|
+
export type MFAVerifyPhoneParams = Prettify<MFAVerifyParamsBase & MFAVerifyPhoneParamFields>;
|
|
712
|
+
type MFAVerifyWebauthnParamFieldsBase = {
|
|
713
|
+
/** Relying party ID */
|
|
714
|
+
rpId: string;
|
|
715
|
+
/** Relying party origins */
|
|
716
|
+
rpOrigins?: string[];
|
|
717
|
+
};
|
|
718
|
+
type MFAVerifyWebauthnCredentialParamFields<T extends 'create' | 'request' = 'create' | 'request'> = {
|
|
719
|
+
/** Operation type */
|
|
720
|
+
type: T;
|
|
721
|
+
/** Creation response from the authenticator (for enrollment/unverified factors) */
|
|
722
|
+
credential_response: T extends 'create' ? RegistrationCredential : AuthenticationCredential;
|
|
723
|
+
};
|
|
724
|
+
/**
|
|
725
|
+
* WebAuthn-specific fields for MFA verification.
|
|
726
|
+
* Supports both credential creation (registration) and request (authentication) flows.
|
|
727
|
+
* @template T - Type of WebAuthn operation: 'create' for registration, 'request' for authentication
|
|
728
|
+
*/
|
|
729
|
+
export type MFAVerifyWebauthnParamFields<T extends 'create' | 'request' = 'create' | 'request'> = {
|
|
730
|
+
webauthn: MFAVerifyWebauthnParamFieldsBase & MFAVerifyWebauthnCredentialParamFields<T>;
|
|
731
|
+
};
|
|
732
|
+
/**
|
|
733
|
+
* Parameters for WebAuthn MFA verification.
|
|
734
|
+
* Used to verify WebAuthn credentials after challenge.
|
|
735
|
+
* @template T - Type of WebAuthn operation: 'create' for registration, 'request' for authentication
|
|
736
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying an Authentication Assertion}
|
|
737
|
+
*/
|
|
738
|
+
export type MFAVerifyWebauthnParams<T extends 'create' | 'request' = 'create' | 'request'> = Prettify<MFAVerifyParamsBase & MFAVerifyWebauthnParamFields<T>>;
|
|
739
|
+
export type MFAVerifyParams = MFAVerifyTOTPParams | MFAVerifyPhoneParams | MFAVerifyWebauthnParams;
|
|
740
|
+
type MFAChallengeParamsBase = {
|
|
707
741
|
/** ID of the factor to be challenged. Returned in enroll(). */
|
|
708
742
|
factorId: string;
|
|
709
743
|
};
|
|
710
744
|
declare const MFATOTPChannels: readonly ["sms", "whatsapp"];
|
|
711
|
-
export
|
|
712
|
-
export
|
|
713
|
-
|
|
745
|
+
export type MFATOTPChannel = (typeof MFATOTPChannels)[number];
|
|
746
|
+
export type MFAChallengeTOTPParams = Prettify<MFAChallengeParamsBase>;
|
|
747
|
+
type MFAChallengePhoneParamFields<Channel extends MFATOTPChannel = MFATOTPChannel> = {
|
|
714
748
|
/** Messaging channel to use (e.g. whatsapp or sms). Only relevant for phone factors */
|
|
715
749
|
channel: Channel;
|
|
716
750
|
};
|
|
717
|
-
export
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
751
|
+
export type MFAChallengePhoneParams = Prettify<MFAChallengeParamsBase & MFAChallengePhoneParamFields>;
|
|
752
|
+
/** WebAuthn parameters for WebAuthn factor challenge */
|
|
753
|
+
type MFAChallengeWebauthnParamFields = {
|
|
754
|
+
webauthn: {
|
|
755
|
+
/** Relying party ID */
|
|
756
|
+
rpId: string;
|
|
757
|
+
/** Relying party origins*/
|
|
758
|
+
rpOrigins?: string[];
|
|
759
|
+
};
|
|
760
|
+
};
|
|
761
|
+
/**
|
|
762
|
+
* Parameters for initiating a WebAuthn MFA challenge.
|
|
763
|
+
* Includes Relying Party information needed for WebAuthn ceremonies.
|
|
764
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-rp-operations W3C WebAuthn Spec - Relying Party Operations}
|
|
765
|
+
*/
|
|
766
|
+
export type MFAChallengeWebauthnParams = Prettify<MFAChallengeParamsBase & MFAChallengeWebauthnParamFields>;
|
|
767
|
+
export type MFAChallengeParams = MFAChallengeTOTPParams | MFAChallengePhoneParams | MFAChallengeWebauthnParams;
|
|
768
|
+
type MFAChallengeAndVerifyParamsBase = Omit<MFAVerifyParamsBase, 'challengeId'>;
|
|
769
|
+
type MFAChallengeAndVerifyTOTPParamFields = MFAVerifyTOTPParamFields;
|
|
770
|
+
type MFAChallengeAndVerifyTOTPParams = Prettify<MFAChallengeAndVerifyParamsBase & MFAChallengeAndVerifyTOTPParamFields>;
|
|
771
|
+
export type MFAChallengeAndVerifyParams = MFAChallengeAndVerifyTOTPParams;
|
|
772
|
+
/**
|
|
773
|
+
* Data returned after successful MFA verification.
|
|
774
|
+
* Contains new session tokens and updated user information.
|
|
775
|
+
*/
|
|
776
|
+
export type AuthMFAVerifyResponseData = {
|
|
726
777
|
/** New access token (JWT) after successful verification. */
|
|
727
778
|
access_token: string;
|
|
728
779
|
/** Type of token, always `bearer`. */
|
|
@@ -733,29 +784,81 @@ export declare type AuthMFAVerifyResponse = RequestResult<{
|
|
|
733
784
|
refresh_token: string;
|
|
734
785
|
/** Updated user profile. */
|
|
735
786
|
user: User;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
|
|
787
|
+
};
|
|
788
|
+
/**
|
|
789
|
+
* Response type for MFA verification operations.
|
|
790
|
+
* Returns session tokens on successful verification.
|
|
791
|
+
*/
|
|
792
|
+
export type AuthMFAVerifyResponse = RequestResult<AuthMFAVerifyResponseData>;
|
|
793
|
+
export type AuthMFAEnrollResponse = AuthMFAEnrollTOTPResponse | AuthMFAEnrollPhoneResponse | AuthMFAEnrollWebauthnResponse;
|
|
794
|
+
export type AuthMFAUnenrollResponse = RequestResult<{
|
|
739
795
|
/** ID of the factor that was successfully unenrolled. */
|
|
740
796
|
id: string;
|
|
741
797
|
}>;
|
|
742
|
-
|
|
798
|
+
type AuthMFAChallengeResponseBase<T extends FactorType> = {
|
|
743
799
|
/** ID of the newly created challenge. */
|
|
744
800
|
id: string;
|
|
745
801
|
/** Factor Type which generated the challenge */
|
|
746
802
|
type: T;
|
|
747
803
|
/** Timestamp in UNIX seconds when this challenge will no longer be usable. */
|
|
748
804
|
expires_at: number;
|
|
749
|
-
}
|
|
805
|
+
};
|
|
806
|
+
type AuthMFAChallengeTOTPResponseFields = {};
|
|
807
|
+
export type AuthMFAChallengeTOTPResponse = RequestResult<Prettify<AuthMFAChallengeResponseBase<'totp'> & AuthMFAChallengeTOTPResponseFields>>;
|
|
808
|
+
type AuthMFAChallengePhoneResponseFields = {};
|
|
809
|
+
export type AuthMFAChallengePhoneResponse = RequestResult<Prettify<AuthMFAChallengeResponseBase<'phone'> & AuthMFAChallengePhoneResponseFields>>;
|
|
810
|
+
type AuthMFAChallengeWebauthnResponseFields = {
|
|
811
|
+
webauthn: {
|
|
812
|
+
type: 'create';
|
|
813
|
+
credential_options: {
|
|
814
|
+
publicKey: PublicKeyCredentialCreationOptionsFuture;
|
|
815
|
+
};
|
|
816
|
+
} | {
|
|
817
|
+
type: 'request';
|
|
818
|
+
credential_options: {
|
|
819
|
+
publicKey: PublicKeyCredentialRequestOptionsFuture;
|
|
820
|
+
};
|
|
821
|
+
};
|
|
822
|
+
};
|
|
823
|
+
/**
|
|
824
|
+
* Response type for WebAuthn MFA challenge.
|
|
825
|
+
* Contains credential creation or request options from the server.
|
|
826
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-credential-creation W3C WebAuthn Spec - Credential Creation}
|
|
827
|
+
*/
|
|
828
|
+
export type AuthMFAChallengeWebauthnResponse = RequestResult<Prettify<AuthMFAChallengeResponseBase<'webauthn'> & AuthMFAChallengeWebauthnResponseFields>>;
|
|
829
|
+
type AuthMFAChallengeWebauthnResponseFieldsJSON = {
|
|
830
|
+
webauthn: {
|
|
831
|
+
type: 'create';
|
|
832
|
+
credential_options: {
|
|
833
|
+
publicKey: ServerCredentialCreationOptions;
|
|
834
|
+
};
|
|
835
|
+
} | {
|
|
836
|
+
type: 'request';
|
|
837
|
+
credential_options: {
|
|
838
|
+
publicKey: ServerCredentialRequestOptions;
|
|
839
|
+
};
|
|
840
|
+
};
|
|
841
|
+
};
|
|
842
|
+
/**
|
|
843
|
+
* JSON-serializable version of WebAuthn challenge response.
|
|
844
|
+
* Used for server communication with base64url-encoded binary fields.
|
|
845
|
+
*/
|
|
846
|
+
export type AuthMFAChallengeWebauthnResponseDataJSON = Prettify<AuthMFAChallengeResponseBase<'webauthn'> & AuthMFAChallengeWebauthnResponseFieldsJSON>;
|
|
847
|
+
/**
|
|
848
|
+
* Server response type for WebAuthn MFA challenge.
|
|
849
|
+
* Contains JSON-formatted WebAuthn options ready for browser API.
|
|
850
|
+
*/
|
|
851
|
+
export type AuthMFAChallengeWebauthnServerResponse = RequestResult<AuthMFAChallengeWebauthnResponseDataJSON>;
|
|
852
|
+
export type AuthMFAChallengeResponse = AuthMFAChallengeTOTPResponse | AuthMFAChallengePhoneResponse | AuthMFAChallengeWebauthnResponse;
|
|
750
853
|
/** response of ListFactors, which should contain all the types of factors that are available, this ensures we always include all */
|
|
751
|
-
export
|
|
854
|
+
export type AuthMFAListFactorsResponse<T extends typeof FactorTypes = typeof FactorTypes> = RequestResult<{
|
|
752
855
|
/** All available factors (verified and unverified). */
|
|
753
856
|
all: Prettify<Factor>[];
|
|
754
857
|
} & {
|
|
755
858
|
[K in T[number]]: Prettify<Factor<K, 'verified'>>[];
|
|
756
859
|
}>;
|
|
757
|
-
export
|
|
758
|
-
export
|
|
860
|
+
export type AuthenticatorAssuranceLevels = 'aal1' | 'aal2';
|
|
861
|
+
export type AuthMFAGetAuthenticatorAssuranceLevelResponse = RequestResult<{
|
|
759
862
|
/** Current AAL level of the session. */
|
|
760
863
|
currentLevel: AuthenticatorAssuranceLevels | null;
|
|
761
864
|
/**
|
|
@@ -788,20 +891,23 @@ export interface GoTrueMFAApi {
|
|
|
788
891
|
*/
|
|
789
892
|
enroll(params: MFAEnrollTOTPParams): Promise<AuthMFAEnrollTOTPResponse>;
|
|
790
893
|
enroll(params: MFAEnrollPhoneParams): Promise<AuthMFAEnrollPhoneResponse>;
|
|
894
|
+
enroll(params: MFAEnrollWebauthnParams): Promise<AuthMFAEnrollWebauthnResponse>;
|
|
791
895
|
enroll(params: MFAEnrollParams): Promise<AuthMFAEnrollResponse>;
|
|
792
896
|
/**
|
|
793
897
|
* Prepares a challenge used to verify that a user has access to a MFA
|
|
794
898
|
* factor.
|
|
795
899
|
*/
|
|
796
|
-
challenge(params: MFAChallengeTOTPParams): Promise<Prettify<
|
|
797
|
-
challenge(params: MFAChallengePhoneParams): Promise<Prettify<
|
|
798
|
-
challenge(params:
|
|
900
|
+
challenge(params: MFAChallengeTOTPParams): Promise<Prettify<AuthMFAChallengeTOTPResponse>>;
|
|
901
|
+
challenge(params: MFAChallengePhoneParams): Promise<Prettify<AuthMFAChallengePhoneResponse>>;
|
|
902
|
+
challenge(params: MFAChallengeWebauthnParams): Promise<Prettify<AuthMFAChallengeWebauthnResponse>>;
|
|
903
|
+
challenge(params: MFAChallengeParams): Promise<AuthMFAChallengeResponse>;
|
|
799
904
|
/**
|
|
800
905
|
* Verifies a code against a challenge. The verification code is
|
|
801
906
|
* provided by the user by entering a code seen in their authenticator app.
|
|
802
907
|
*/
|
|
803
908
|
verify(params: MFAVerifyTOTPParams): Promise<AuthMFAVerifyResponse>;
|
|
804
909
|
verify(params: MFAVerifyPhoneParams): Promise<AuthMFAVerifyResponse>;
|
|
910
|
+
verify(params: MFAVerifyWebauthnParams): Promise<AuthMFAVerifyResponse>;
|
|
805
911
|
verify(params: MFAVerifyParams): Promise<AuthMFAVerifyResponse>;
|
|
806
912
|
/**
|
|
807
913
|
* Unenroll removes a MFA factor.
|
|
@@ -836,18 +942,19 @@ export interface GoTrueMFAApi {
|
|
|
836
942
|
*
|
|
837
943
|
*/
|
|
838
944
|
getAuthenticatorAssuranceLevel(): Promise<AuthMFAGetAuthenticatorAssuranceLevelResponse>;
|
|
945
|
+
webauthn: WebAuthnApi;
|
|
839
946
|
}
|
|
840
947
|
/**
|
|
841
948
|
* @expermental
|
|
842
949
|
*/
|
|
843
|
-
export
|
|
950
|
+
export type AuthMFAAdminDeleteFactorResponse = RequestResult<{
|
|
844
951
|
/** ID of the factor that was successfully deleted. */
|
|
845
952
|
id: string;
|
|
846
953
|
}>;
|
|
847
954
|
/**
|
|
848
955
|
* @expermental
|
|
849
956
|
*/
|
|
850
|
-
export
|
|
957
|
+
export type AuthMFAAdminDeleteFactorParams = {
|
|
851
958
|
/** ID of the MFA factor to delete. */
|
|
852
959
|
id: string;
|
|
853
960
|
/** ID of the user whose factor is being deleted. */
|
|
@@ -856,14 +963,14 @@ export declare type AuthMFAAdminDeleteFactorParams = {
|
|
|
856
963
|
/**
|
|
857
964
|
* @expermental
|
|
858
965
|
*/
|
|
859
|
-
export
|
|
966
|
+
export type AuthMFAAdminListFactorsResponse = RequestResult<{
|
|
860
967
|
/** All factors attached to the user. */
|
|
861
968
|
factors: Factor[];
|
|
862
969
|
}>;
|
|
863
970
|
/**
|
|
864
971
|
* @expermental
|
|
865
972
|
*/
|
|
866
|
-
export
|
|
973
|
+
export type AuthMFAAdminListFactorsParams = {
|
|
867
974
|
/** ID of the user. */
|
|
868
975
|
userId: string;
|
|
869
976
|
};
|
|
@@ -888,12 +995,12 @@ export interface GoTrueAdminMFAApi {
|
|
|
888
995
|
*/
|
|
889
996
|
deleteFactor(params: AuthMFAAdminDeleteFactorParams): Promise<AuthMFAAdminDeleteFactorResponse>;
|
|
890
997
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
998
|
+
type AnyFunction = (...args: any[]) => any;
|
|
999
|
+
type MaybePromisify<T> = T | Promise<T>;
|
|
1000
|
+
type PromisifyMethods<T> = {
|
|
894
1001
|
[K in keyof T]: T[K] extends AnyFunction ? (...args: Parameters<T[K]>) => MaybePromisify<ReturnType<T[K]>> : T[K];
|
|
895
1002
|
};
|
|
896
|
-
export
|
|
1003
|
+
export type SupportedStorage = PromisifyMethods<Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>> & {
|
|
897
1004
|
/**
|
|
898
1005
|
* If set to `true` signals to the library that the storage medium is used
|
|
899
1006
|
* on a server and the values may not be authentic, such as reading from
|
|
@@ -903,23 +1010,23 @@ export declare type SupportedStorage = PromisifyMethods<Pick<Storage, 'getItem'
|
|
|
903
1010
|
*/
|
|
904
1011
|
isServer?: boolean;
|
|
905
1012
|
};
|
|
906
|
-
export
|
|
1013
|
+
export type InitializeResult = {
|
|
907
1014
|
error: AuthError | null;
|
|
908
1015
|
};
|
|
909
|
-
export
|
|
910
|
-
export
|
|
1016
|
+
export type CallRefreshTokenResult = RequestResult<Session>;
|
|
1017
|
+
export type Pagination = {
|
|
911
1018
|
[key: string]: any;
|
|
912
1019
|
nextPage: number | null;
|
|
913
1020
|
lastPage: number;
|
|
914
1021
|
total: number;
|
|
915
1022
|
};
|
|
916
|
-
export
|
|
1023
|
+
export type PageParams = {
|
|
917
1024
|
/** The page number */
|
|
918
1025
|
page?: number;
|
|
919
1026
|
/** Number of items returned per page */
|
|
920
1027
|
perPage?: number;
|
|
921
1028
|
};
|
|
922
|
-
export
|
|
1029
|
+
export type SignOut = {
|
|
923
1030
|
/**
|
|
924
1031
|
* Determines which sessions should be
|
|
925
1032
|
* logged out. Global means all
|
|
@@ -932,23 +1039,30 @@ export declare type SignOut = {
|
|
|
932
1039
|
*/
|
|
933
1040
|
scope?: 'global' | 'local' | 'others';
|
|
934
1041
|
};
|
|
935
|
-
|
|
1042
|
+
type MFAEnrollParamsBase<T extends FactorType> = {
|
|
936
1043
|
/** The type of factor being enrolled. */
|
|
937
1044
|
factorType: T;
|
|
938
1045
|
/** Human readable name assigned to the factor. */
|
|
939
1046
|
friendlyName?: string;
|
|
940
1047
|
};
|
|
941
|
-
|
|
1048
|
+
type MFAEnrollTOTPParamFields = {
|
|
942
1049
|
/** Domain which the user is enrolled with. */
|
|
943
1050
|
issuer?: string;
|
|
944
1051
|
};
|
|
945
|
-
export
|
|
946
|
-
|
|
1052
|
+
export type MFAEnrollTOTPParams = Prettify<MFAEnrollParamsBase<'totp'> & MFAEnrollTOTPParamFields>;
|
|
1053
|
+
type MFAEnrollPhoneParamFields = {
|
|
947
1054
|
/** Phone number associated with a factor. Number should conform to E.164 format */
|
|
948
1055
|
phone: string;
|
|
949
1056
|
};
|
|
950
|
-
export
|
|
951
|
-
|
|
1057
|
+
export type MFAEnrollPhoneParams = Prettify<MFAEnrollParamsBase<'phone'> & MFAEnrollPhoneParamFields>;
|
|
1058
|
+
type MFAEnrollWebauthnFields = {};
|
|
1059
|
+
/**
|
|
1060
|
+
* Parameters for enrolling a WebAuthn factor.
|
|
1061
|
+
* Creates an unverified WebAuthn factor that must be verified with a credential.
|
|
1062
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
1063
|
+
*/
|
|
1064
|
+
export type MFAEnrollWebauthnParams = Prettify<MFAEnrollParamsBase<'webauthn'> & MFAEnrollWebauthnFields>;
|
|
1065
|
+
type AuthMFAEnrollResponseBase<T extends FactorType> = {
|
|
952
1066
|
/** ID of the factor that was just enrolled (in an unverified state). */
|
|
953
1067
|
id: string;
|
|
954
1068
|
/** Type of MFA factor.*/
|
|
@@ -956,7 +1070,7 @@ declare type AuthMFAEnrollResponseBase<T extends FactorType> = {
|
|
|
956
1070
|
/** Friendly name of the factor, useful for distinguishing between factors **/
|
|
957
1071
|
friendly_name?: string;
|
|
958
1072
|
};
|
|
959
|
-
|
|
1073
|
+
type AuthMFAEnrollTOTPResponseFields = {
|
|
960
1074
|
/** TOTP enrollment information. */
|
|
961
1075
|
totp: {
|
|
962
1076
|
/** Contains a QR code encoding the authenticator URI. You can
|
|
@@ -972,18 +1086,25 @@ declare type AuthMFAEnrollTOTPResponseFields = {
|
|
|
972
1086
|
uri: string;
|
|
973
1087
|
};
|
|
974
1088
|
};
|
|
975
|
-
export
|
|
976
|
-
|
|
1089
|
+
export type AuthMFAEnrollTOTPResponse = RequestResult<Prettify<AuthMFAEnrollResponseBase<'totp'> & AuthMFAEnrollTOTPResponseFields>>;
|
|
1090
|
+
type AuthMFAEnrollPhoneResponseFields = {
|
|
977
1091
|
/** Phone number of the MFA factor in E.164 format. Used to send messages */
|
|
978
1092
|
phone: string;
|
|
979
1093
|
};
|
|
980
|
-
export
|
|
981
|
-
|
|
1094
|
+
export type AuthMFAEnrollPhoneResponse = RequestResult<Prettify<AuthMFAEnrollResponseBase<'phone'> & AuthMFAEnrollPhoneResponseFields>>;
|
|
1095
|
+
type AuthMFAEnrollWebauthnFields = {};
|
|
1096
|
+
/**
|
|
1097
|
+
* Response type for WebAuthn factor enrollment.
|
|
1098
|
+
* Returns the enrolled factor ID and metadata.
|
|
1099
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
1100
|
+
*/
|
|
1101
|
+
export type AuthMFAEnrollWebauthnResponse = RequestResult<Prettify<AuthMFAEnrollResponseBase<'webauthn'> & AuthMFAEnrollWebauthnFields>>;
|
|
1102
|
+
export type JwtHeader = {
|
|
982
1103
|
alg: 'RS256' | 'ES256' | 'HS256';
|
|
983
1104
|
kid: string;
|
|
984
1105
|
typ: string;
|
|
985
1106
|
};
|
|
986
|
-
export
|
|
1107
|
+
export type RequiredClaims = {
|
|
987
1108
|
iss: string;
|
|
988
1109
|
sub: string;
|
|
989
1110
|
aud: string | string[];
|
|
@@ -993,7 +1114,7 @@ export declare type RequiredClaims = {
|
|
|
993
1114
|
aal: AuthenticatorAssuranceLevels;
|
|
994
1115
|
session_id: string;
|
|
995
1116
|
};
|
|
996
|
-
export
|
|
1117
|
+
export type JwtPayload = RequiredClaims & {
|
|
997
1118
|
[key: string]: any;
|
|
998
1119
|
};
|
|
999
1120
|
export interface JWK {
|
|
@@ -1004,6 +1125,6 @@ export interface JWK {
|
|
|
1004
1125
|
[key: string]: any;
|
|
1005
1126
|
}
|
|
1006
1127
|
export declare const SIGN_OUT_SCOPES: readonly ["global", "local", "others"];
|
|
1007
|
-
export
|
|
1128
|
+
export type SignOutScope = (typeof SIGN_OUT_SCOPES)[number];
|
|
1008
1129
|
export {};
|
|
1009
1130
|
//# sourceMappingURL=types.d.ts.map
|