@supabase/auth-js 2.72.1-canary.2 → 2.73.0-rc.3
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 +3 -95
- package/dist/main/GoTrueAdminApi.js.map +1 -1
- package/dist/main/GoTrueClient.d.ts +7 -1
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +90 -37
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/base64url.js +11 -10
- 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 +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 +9 -8
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +1 -1
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +24 -34
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/local-storage.js +2 -1
- 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 +2 -1
- package/dist/main/lib/polyfills.js.map +1 -1
- package/dist/main/lib/types.d.ts +264 -370
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/types.js +17 -1
- 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 +1 -7
- 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 +5 -4
- 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/module/GoTrueAdminApi.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts +7 -1
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +90 -38
- package/dist/module/GoTrueClient.js.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 +1 -1
- package/dist/module/lib/errors.d.ts.map +1 -1
- package/dist/module/lib/errors.js.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 +1 -1
- 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 +264 -370
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/types.js +16 -0
- 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 +1 -7
- 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/package.json +32 -12
- package/src/GoTrueClient.ts +93 -22
- package/src/lib/errors.ts +1 -1
- package/src/lib/types.ts +289 -356
- package/src/lib/version.ts +1 -7
|
@@ -4,9 +4,9 @@ import { Fetch } from './fetch';
|
|
|
4
4
|
import type { SolanaSignInInput, SolanaSignInOutput } from './web3/solana';
|
|
5
5
|
import { EthereumSignInInput, Hex } from './web3/ethereum';
|
|
6
6
|
/** One of the providers supported by GoTrue. */
|
|
7
|
-
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';
|
|
8
|
-
export type AuthChangeEventMFA = 'MFA_CHALLENGE_VERIFIED';
|
|
9
|
-
export type AuthChangeEvent = 'INITIAL_SESSION' | 'PASSWORD_RECOVERY' | 'SIGNED_IN' | 'SIGNED_OUT' | 'TOKEN_REFRESHED' | 'USER_UPDATED' | AuthChangeEventMFA;
|
|
7
|
+
export declare 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';
|
|
8
|
+
export declare type AuthChangeEventMFA = 'MFA_CHALLENGE_VERIFIED';
|
|
9
|
+
export declare type AuthChangeEvent = 'INITIAL_SESSION' | 'PASSWORD_RECOVERY' | 'SIGNED_IN' | 'SIGNED_OUT' | 'TOKEN_REFRESHED' | 'USER_UPDATED' | AuthChangeEventMFA;
|
|
10
10
|
/**
|
|
11
11
|
* Provide your own global lock implementation instead of the default
|
|
12
12
|
* implementation. The function should acquire a lock for the duration of the
|
|
@@ -22,8 +22,8 @@ export type AuthChangeEvent = 'INITIAL_SESSION' | 'PASSWORD_RECOVERY' | 'SIGNED_
|
|
|
22
22
|
* acquired after this much time (ms).
|
|
23
23
|
* @param fn The operation to execute when the lock is acquired.
|
|
24
24
|
*/
|
|
25
|
-
export type LockFunc = <R>(name: string, acquireTimeout: number, fn: () => Promise<R>) => Promise<R>;
|
|
26
|
-
export type GoTrueClientOptions = {
|
|
25
|
+
export declare type LockFunc = <R>(name: string, acquireTimeout: number, fn: () => Promise<R>) => Promise<R>;
|
|
26
|
+
export declare type GoTrueClientOptions = {
|
|
27
27
|
url?: string;
|
|
28
28
|
headers?: {
|
|
29
29
|
[key: string]: string;
|
|
@@ -56,87 +56,71 @@ export type GoTrueClientOptions = {
|
|
|
56
56
|
*/
|
|
57
57
|
hasCustomAuthorizationHeader?: boolean;
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
export type
|
|
59
|
+
declare const WeakPasswordReasons: readonly ["length", "characters", "pwned"];
|
|
60
|
+
export declare type WeakPasswordReasons = typeof WeakPasswordReasons[number];
|
|
61
|
+
export declare type WeakPassword = {
|
|
61
62
|
reasons: WeakPasswordReasons[];
|
|
62
63
|
message: string;
|
|
63
64
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Resolve mapped types and show the derived keys and their types when hovering in
|
|
67
|
+
* VS Code, instead of just showing the names those mapped types are defined with.
|
|
68
|
+
*/
|
|
69
|
+
export declare type Prettify<T> = T extends Function ? T : {
|
|
70
|
+
[K in keyof T]: T[K];
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* a shared result type that encapsulates errors instead of throwing them, allows you to optionally specify the ErrorType
|
|
74
|
+
*/
|
|
75
|
+
export declare type RequestResult<T, ErrorType extends Error = AuthError> = {
|
|
76
|
+
data: T;
|
|
69
77
|
error: null;
|
|
70
78
|
} | {
|
|
71
|
-
data:
|
|
72
|
-
|
|
73
|
-
session: null;
|
|
74
|
-
};
|
|
75
|
-
error: AuthError;
|
|
79
|
+
data: null;
|
|
80
|
+
error: Error extends AuthError ? AuthError : ErrorType;
|
|
76
81
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
/**
|
|
83
|
+
* similar to RequestResult except it allows you to destructure the possible shape of the success response
|
|
84
|
+
* {@see RequestResult}
|
|
85
|
+
*/
|
|
86
|
+
export declare type RequestResultSafeDestructure<T> = {
|
|
87
|
+
data: T;
|
|
83
88
|
error: null;
|
|
84
89
|
} | {
|
|
85
|
-
data: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
90
|
+
data: T extends object ? {
|
|
91
|
+
[K in keyof T]: null;
|
|
92
|
+
} : null;
|
|
89
93
|
error: AuthError;
|
|
90
94
|
};
|
|
95
|
+
export declare type AuthResponse = RequestResultSafeDestructure<{
|
|
96
|
+
user: User | null;
|
|
97
|
+
session: Session | null;
|
|
98
|
+
}>;
|
|
99
|
+
export declare type AuthResponsePassword = RequestResultSafeDestructure<{
|
|
100
|
+
user: User | null;
|
|
101
|
+
session: Session | null;
|
|
102
|
+
weak_password?: WeakPassword | null;
|
|
103
|
+
}>;
|
|
91
104
|
/**
|
|
92
105
|
* AuthOtpResponse is returned when OTP is used.
|
|
93
106
|
*
|
|
94
107
|
* {@see AuthResponse}
|
|
95
108
|
*/
|
|
96
|
-
export type AuthOtpResponse = {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
export type AuthTokenResponse = {
|
|
112
|
-
data: {
|
|
113
|
-
user: User;
|
|
114
|
-
session: Session;
|
|
115
|
-
};
|
|
116
|
-
error: null;
|
|
117
|
-
} | {
|
|
118
|
-
data: {
|
|
119
|
-
user: null;
|
|
120
|
-
session: null;
|
|
121
|
-
};
|
|
122
|
-
error: AuthError;
|
|
123
|
-
};
|
|
124
|
-
export type AuthTokenResponsePassword = {
|
|
125
|
-
data: {
|
|
126
|
-
user: User;
|
|
127
|
-
session: Session;
|
|
128
|
-
weakPassword?: WeakPassword;
|
|
129
|
-
};
|
|
130
|
-
error: null;
|
|
131
|
-
} | {
|
|
132
|
-
data: {
|
|
133
|
-
user: null;
|
|
134
|
-
session: null;
|
|
135
|
-
weakPassword?: null;
|
|
136
|
-
};
|
|
137
|
-
error: AuthError;
|
|
138
|
-
};
|
|
139
|
-
export type OAuthResponse = {
|
|
109
|
+
export declare type AuthOtpResponse = RequestResultSafeDestructure<{
|
|
110
|
+
user: null;
|
|
111
|
+
session: null;
|
|
112
|
+
messageId?: string | null;
|
|
113
|
+
}>;
|
|
114
|
+
export declare type AuthTokenResponse = RequestResultSafeDestructure<{
|
|
115
|
+
user: User;
|
|
116
|
+
session: Session;
|
|
117
|
+
}>;
|
|
118
|
+
export declare type AuthTokenResponsePassword = RequestResultSafeDestructure<{
|
|
119
|
+
user: User;
|
|
120
|
+
session: Session;
|
|
121
|
+
weakPassword?: WeakPassword;
|
|
122
|
+
}>;
|
|
123
|
+
export declare type OAuthResponse = {
|
|
140
124
|
data: {
|
|
141
125
|
provider: Provider;
|
|
142
126
|
url: string;
|
|
@@ -149,33 +133,19 @@ export type OAuthResponse = {
|
|
|
149
133
|
};
|
|
150
134
|
error: AuthError;
|
|
151
135
|
};
|
|
152
|
-
export type SSOResponse = {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
data: null;
|
|
166
|
-
error: AuthError;
|
|
167
|
-
};
|
|
168
|
-
export type UserResponse = {
|
|
169
|
-
data: {
|
|
170
|
-
user: User;
|
|
171
|
-
};
|
|
172
|
-
error: null;
|
|
173
|
-
} | {
|
|
174
|
-
data: {
|
|
175
|
-
user: null;
|
|
176
|
-
};
|
|
177
|
-
error: AuthError;
|
|
178
|
-
};
|
|
136
|
+
export declare type SSOResponse = RequestResult<{
|
|
137
|
+
/**
|
|
138
|
+
* URL to open in a browser which will complete the sign-in flow by
|
|
139
|
+
* taking the user to the identity provider's authentication flow.
|
|
140
|
+
*
|
|
141
|
+
* On browsers you can set the URL to `window.location.href` to take
|
|
142
|
+
* the user to the authentication flow.
|
|
143
|
+
*/
|
|
144
|
+
url: string;
|
|
145
|
+
}>;
|
|
146
|
+
export declare type UserResponse = RequestResultSafeDestructure<{
|
|
147
|
+
user: User;
|
|
148
|
+
}>;
|
|
179
149
|
export interface Session {
|
|
180
150
|
/**
|
|
181
151
|
* The oauth provider token. If present, this can be used to make external API requests to the oauth provider used.
|
|
@@ -202,12 +172,14 @@ export interface Session {
|
|
|
202
172
|
* A timestamp of when the token will expire. Returned when a login is confirmed.
|
|
203
173
|
*/
|
|
204
174
|
expires_at?: number;
|
|
205
|
-
token_type:
|
|
175
|
+
token_type: 'bearer';
|
|
206
176
|
/**
|
|
207
177
|
* When using a separate user storage, accessing properties of this object will throw an error.
|
|
208
178
|
*/
|
|
209
179
|
user: User;
|
|
210
180
|
}
|
|
181
|
+
declare const AMRMethods: readonly ["password", "otp", "oauth", "totp", "mfa/totp", "mfa/phone", "anonymous", "sso/saml", "magiclink", "web3"];
|
|
182
|
+
export declare type AMRMethod = typeof AMRMethods[number] | (string & {});
|
|
211
183
|
/**
|
|
212
184
|
* An authentication methord reference (AMR) entry.
|
|
213
185
|
*
|
|
@@ -218,7 +190,7 @@ export interface Session {
|
|
|
218
190
|
*/
|
|
219
191
|
export interface AMREntry {
|
|
220
192
|
/** Authentication method name. */
|
|
221
|
-
method:
|
|
193
|
+
method: AMRMethod;
|
|
222
194
|
/**
|
|
223
195
|
* Timestamp when the method was successfully used. Represents number of
|
|
224
196
|
* seconds since 1st January 1970 (UNIX epoch) in UTC.
|
|
@@ -237,6 +209,16 @@ export interface UserIdentity {
|
|
|
237
209
|
last_sign_in_at?: string;
|
|
238
210
|
updated_at?: string;
|
|
239
211
|
}
|
|
212
|
+
export declare const FactorTypes: readonly ["totp", "phone"];
|
|
213
|
+
/**
|
|
214
|
+
* Type of factor. `totp` and `phone` supported with this version
|
|
215
|
+
*/
|
|
216
|
+
export declare type FactorType = typeof FactorTypes[number];
|
|
217
|
+
declare const FactorVerificationStatuses: readonly ["verified", "unverified"];
|
|
218
|
+
/**
|
|
219
|
+
* The verification status of the factor, default is `unverified` after `.enroll()`, then `verified` after the user verifies it with `.verify()`
|
|
220
|
+
*/
|
|
221
|
+
declare type FactorVerificationStatus = typeof FactorVerificationStatuses[number];
|
|
240
222
|
/**
|
|
241
223
|
* A MFA factor.
|
|
242
224
|
*
|
|
@@ -244,7 +226,7 @@ export interface UserIdentity {
|
|
|
244
226
|
* @see {@link GoTrueMFAApi#listFactors}
|
|
245
227
|
* @see {@link GoTrueMFAAdminApi#listFactors}
|
|
246
228
|
*/
|
|
247
|
-
export
|
|
229
|
+
export declare type Factor<Type extends FactorType = FactorType, Status extends FactorVerificationStatus = typeof FactorVerificationStatuses[number]> = {
|
|
248
230
|
/** ID of the factor. */
|
|
249
231
|
id: string;
|
|
250
232
|
/** Friendly name of the factor, useful to disambiguate between multiple factors. */
|
|
@@ -252,12 +234,14 @@ export interface Factor {
|
|
|
252
234
|
/**
|
|
253
235
|
* Type of factor. `totp` and `phone` supported with this version
|
|
254
236
|
*/
|
|
255
|
-
factor_type:
|
|
256
|
-
/**
|
|
257
|
-
|
|
237
|
+
factor_type: Type;
|
|
238
|
+
/**
|
|
239
|
+
* The verification status of the factor, default is `unverified` after `.enroll()`, then `verified` after the user verifies it with `.verify()`
|
|
240
|
+
*/
|
|
241
|
+
status: Status;
|
|
258
242
|
created_at: string;
|
|
259
243
|
updated_at: string;
|
|
260
|
-
}
|
|
244
|
+
};
|
|
261
245
|
export interface UserAppMetadata {
|
|
262
246
|
provider?: string;
|
|
263
247
|
[key: string]: any;
|
|
@@ -289,7 +273,7 @@ export interface User {
|
|
|
289
273
|
identities?: UserIdentity[];
|
|
290
274
|
is_anonymous?: boolean;
|
|
291
275
|
is_sso_user?: boolean;
|
|
292
|
-
factors?: Factor[];
|
|
276
|
+
factors?: Factor<FactorType>[];
|
|
293
277
|
deleted_at?: string;
|
|
294
278
|
}
|
|
295
279
|
export interface UserAttributes {
|
|
@@ -400,7 +384,7 @@ export interface Subscription {
|
|
|
400
384
|
*/
|
|
401
385
|
unsubscribe: () => void;
|
|
402
386
|
}
|
|
403
|
-
export type SignInAnonymouslyCredentials = {
|
|
387
|
+
export declare type SignInAnonymouslyCredentials = {
|
|
404
388
|
options?: {
|
|
405
389
|
/**
|
|
406
390
|
* A custom data object to store the user's metadata. This maps to the `auth.users.raw_user_meta_data` column.
|
|
@@ -412,61 +396,27 @@ export type SignInAnonymouslyCredentials = {
|
|
|
412
396
|
captchaToken?: string;
|
|
413
397
|
};
|
|
414
398
|
};
|
|
415
|
-
export type SignUpWithPasswordCredentials = {
|
|
416
|
-
/** The user's email address. */
|
|
417
|
-
email: string;
|
|
418
|
-
/** The user's password. */
|
|
419
|
-
password: string;
|
|
399
|
+
export declare type SignUpWithPasswordCredentials = Prettify<PasswordCredentialsBase & {
|
|
420
400
|
options?: {
|
|
421
|
-
/** The redirect url embedded in the email link */
|
|
422
401
|
emailRedirectTo?: string;
|
|
423
|
-
/**
|
|
424
|
-
* A custom data object to store the user's metadata. This maps to the `auth.users.raw_user_meta_data` column.
|
|
425
|
-
*
|
|
426
|
-
* The `data` should be a JSON object that includes user-specific info, such as their first and last name.
|
|
427
|
-
*/
|
|
428
402
|
data?: object;
|
|
429
|
-
/** Verification token received when the user completes the captcha on the site. */
|
|
430
403
|
captchaToken?: string;
|
|
431
|
-
};
|
|
432
|
-
} | {
|
|
433
|
-
/** The user's phone number. */
|
|
434
|
-
phone: string;
|
|
435
|
-
/** The user's password. */
|
|
436
|
-
password: string;
|
|
437
|
-
options?: {
|
|
438
|
-
/**
|
|
439
|
-
* A custom data object to store the user's metadata. This maps to the `auth.users.raw_user_meta_data` column.
|
|
440
|
-
*
|
|
441
|
-
* The `data` should be a JSON object that includes user-specific info, such as their first and last name.
|
|
442
|
-
*/
|
|
443
|
-
data?: object;
|
|
444
|
-
/** Verification token received when the user completes the captcha on the site. Requires a configured WhatsApp sender on Twilio */
|
|
445
|
-
captchaToken?: string;
|
|
446
|
-
/** Messaging channel to use (e.g. whatsapp or sms) */
|
|
447
404
|
channel?: 'sms' | 'whatsapp';
|
|
448
405
|
};
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/** The user's email address. */
|
|
406
|
+
}>;
|
|
407
|
+
declare type PasswordCredentialsBase = {
|
|
452
408
|
email: string;
|
|
453
|
-
/** The user's password. */
|
|
454
409
|
password: string;
|
|
455
|
-
options?: {
|
|
456
|
-
/** Verification token received when the user completes the captcha on the site. */
|
|
457
|
-
captchaToken?: string;
|
|
458
|
-
};
|
|
459
410
|
} | {
|
|
460
|
-
/** The user's phone number. */
|
|
461
411
|
phone: string;
|
|
462
|
-
/** The user's password. */
|
|
463
412
|
password: string;
|
|
413
|
+
};
|
|
414
|
+
export declare type SignInWithPasswordCredentials = PasswordCredentialsBase & {
|
|
464
415
|
options?: {
|
|
465
|
-
/** Verification token received when the user completes the captcha on the site. */
|
|
466
416
|
captchaToken?: string;
|
|
467
417
|
};
|
|
468
418
|
};
|
|
469
|
-
export type SignInWithPasswordlessCredentials = {
|
|
419
|
+
export declare type SignInWithPasswordlessCredentials = {
|
|
470
420
|
/** The user's email address. */
|
|
471
421
|
email: string;
|
|
472
422
|
options?: {
|
|
@@ -501,8 +451,8 @@ export type SignInWithPasswordlessCredentials = {
|
|
|
501
451
|
channel?: 'sms' | 'whatsapp';
|
|
502
452
|
};
|
|
503
453
|
};
|
|
504
|
-
export type AuthFlowType = 'implicit' | 'pkce';
|
|
505
|
-
export type SignInWithOAuthCredentials = {
|
|
454
|
+
export declare type AuthFlowType = 'implicit' | 'pkce';
|
|
455
|
+
export declare type SignInWithOAuthCredentials = {
|
|
506
456
|
/** One of the providers supported by GoTrue. */
|
|
507
457
|
provider: Provider;
|
|
508
458
|
options?: {
|
|
@@ -518,7 +468,7 @@ export type SignInWithOAuthCredentials = {
|
|
|
518
468
|
skipBrowserRedirect?: boolean;
|
|
519
469
|
};
|
|
520
470
|
};
|
|
521
|
-
export type SignInWithIdTokenCredentials = {
|
|
471
|
+
export declare type SignInWithIdTokenCredentials = {
|
|
522
472
|
/** 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). */
|
|
523
473
|
provider: 'google' | 'apple' | 'azure' | 'facebook' | 'kakao' | (string & {});
|
|
524
474
|
/** 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. */
|
|
@@ -532,14 +482,14 @@ export type SignInWithIdTokenCredentials = {
|
|
|
532
482
|
captchaToken?: string;
|
|
533
483
|
};
|
|
534
484
|
};
|
|
535
|
-
export type SolanaWallet = {
|
|
485
|
+
export declare type SolanaWallet = {
|
|
536
486
|
signIn?: (...inputs: SolanaSignInInput[]) => Promise<SolanaSignInOutput | SolanaSignInOutput[]>;
|
|
537
487
|
publicKey?: {
|
|
538
488
|
toBase58: () => string;
|
|
539
489
|
} | null;
|
|
540
490
|
signMessage?: (message: Uint8Array, encoding?: 'utf8' | string) => Promise<Uint8Array> | undefined;
|
|
541
491
|
};
|
|
542
|
-
export type SolanaWeb3Credentials = {
|
|
492
|
+
export declare type SolanaWeb3Credentials = {
|
|
543
493
|
chain: 'solana';
|
|
544
494
|
/** Wallet interface to use. If not specified will default to `window.solana`. */
|
|
545
495
|
wallet?: SolanaWallet;
|
|
@@ -563,12 +513,12 @@ export type SolanaWeb3Credentials = {
|
|
|
563
513
|
captchaToken?: string;
|
|
564
514
|
};
|
|
565
515
|
};
|
|
566
|
-
export type EthereumWallet = EIP1193Provider;
|
|
567
|
-
export type EthereumWeb3Credentials = {
|
|
516
|
+
export declare type EthereumWallet = EIP1193Provider;
|
|
517
|
+
export declare type EthereumWeb3Credentials = {
|
|
568
518
|
chain: 'ethereum';
|
|
569
|
-
/** Wallet interface to use. If not specified will default to `window.
|
|
519
|
+
/** Wallet interface to use. If not specified will default to `window.ethereum`. */
|
|
570
520
|
wallet?: EthereumWallet;
|
|
571
|
-
/** Optional statement to include in the Sign in with
|
|
521
|
+
/** Optional statement to include in the Sign in with Ethereum message. Must not include new line characters. Most wallets like Phantom **require specifying a statement!** */
|
|
572
522
|
statement?: string;
|
|
573
523
|
options?: {
|
|
574
524
|
/** URL to use with the wallet interface. Some wallets do not allow signing a message for URLs different from the current page. */
|
|
@@ -581,15 +531,15 @@ export type EthereumWeb3Credentials = {
|
|
|
581
531
|
chain: 'ethereum';
|
|
582
532
|
/** Sign in with Ethereum compatible message. Must include `Issued At`, `URI` and `Version`. */
|
|
583
533
|
message: string;
|
|
584
|
-
/**
|
|
534
|
+
/** Ethereum curve (secp256k1) signature of the message. */
|
|
585
535
|
signature: Hex;
|
|
586
536
|
options?: {
|
|
587
537
|
/** Verification token received when the user completes the captcha on the site. */
|
|
588
538
|
captchaToken?: string;
|
|
589
539
|
};
|
|
590
540
|
};
|
|
591
|
-
export type Web3Credentials = SolanaWeb3Credentials | EthereumWeb3Credentials;
|
|
592
|
-
export type VerifyOtpParams = VerifyMobileOtpParams | VerifyEmailOtpParams | VerifyTokenHashParams;
|
|
541
|
+
export declare type Web3Credentials = SolanaWeb3Credentials | EthereumWeb3Credentials;
|
|
542
|
+
export declare type VerifyOtpParams = VerifyMobileOtpParams | VerifyEmailOtpParams | VerifyTokenHashParams;
|
|
593
543
|
export interface VerifyMobileOtpParams {
|
|
594
544
|
/** The user's phone number. */
|
|
595
545
|
phone: string;
|
|
@@ -631,9 +581,9 @@ export interface VerifyTokenHashParams {
|
|
|
631
581
|
/** The user's verification type. */
|
|
632
582
|
type: EmailOtpType;
|
|
633
583
|
}
|
|
634
|
-
export type MobileOtpType = 'sms' | 'phone_change';
|
|
635
|
-
export type EmailOtpType = 'signup' | 'invite' | 'magiclink' | 'recovery' | 'email_change' | 'email';
|
|
636
|
-
export type ResendParams = {
|
|
584
|
+
export declare type MobileOtpType = 'sms' | 'phone_change';
|
|
585
|
+
export declare type EmailOtpType = 'signup' | 'invite' | 'magiclink' | 'recovery' | 'email_change' | 'email';
|
|
586
|
+
export declare type ResendParams = {
|
|
637
587
|
type: Extract<EmailOtpType, 'signup' | 'email_change'>;
|
|
638
588
|
email: string;
|
|
639
589
|
options?: {
|
|
@@ -650,7 +600,7 @@ export type ResendParams = {
|
|
|
650
600
|
captchaToken?: string;
|
|
651
601
|
};
|
|
652
602
|
};
|
|
653
|
-
export type SignInWithSSO = {
|
|
603
|
+
export declare type SignInWithSSO = {
|
|
654
604
|
/** UUID of the SSO provider to invoke single-sign on to. */
|
|
655
605
|
providerId: string;
|
|
656
606
|
options?: {
|
|
@@ -669,25 +619,25 @@ export type SignInWithSSO = {
|
|
|
669
619
|
captchaToken?: string;
|
|
670
620
|
};
|
|
671
621
|
};
|
|
672
|
-
export type GenerateSignupLinkParams = {
|
|
622
|
+
export declare type GenerateSignupLinkParams = {
|
|
673
623
|
type: 'signup';
|
|
674
624
|
email: string;
|
|
675
625
|
password: string;
|
|
676
626
|
options?: Pick<GenerateLinkOptions, 'data' | 'redirectTo'>;
|
|
677
627
|
};
|
|
678
|
-
export type GenerateInviteOrMagiclinkParams = {
|
|
628
|
+
export declare type GenerateInviteOrMagiclinkParams = {
|
|
679
629
|
type: 'invite' | 'magiclink';
|
|
680
630
|
/** The user's email */
|
|
681
631
|
email: string;
|
|
682
632
|
options?: Pick<GenerateLinkOptions, 'data' | 'redirectTo'>;
|
|
683
633
|
};
|
|
684
|
-
export type GenerateRecoveryLinkParams = {
|
|
634
|
+
export declare type GenerateRecoveryLinkParams = {
|
|
685
635
|
type: 'recovery';
|
|
686
636
|
/** The user's email */
|
|
687
637
|
email: string;
|
|
688
638
|
options?: Pick<GenerateLinkOptions, 'redirectTo'>;
|
|
689
639
|
};
|
|
690
|
-
export type GenerateEmailChangeLinkParams = {
|
|
640
|
+
export declare type GenerateEmailChangeLinkParams = {
|
|
691
641
|
type: 'email_change_current' | 'email_change_new';
|
|
692
642
|
/** The user's email */
|
|
693
643
|
email: string;
|
|
@@ -707,22 +657,13 @@ export interface GenerateLinkOptions {
|
|
|
707
657
|
/** The URL which will be appended to the email link generated. */
|
|
708
658
|
redirectTo?: string;
|
|
709
659
|
}
|
|
710
|
-
export type GenerateLinkParams = GenerateSignupLinkParams | GenerateInviteOrMagiclinkParams | GenerateRecoveryLinkParams | GenerateEmailChangeLinkParams;
|
|
711
|
-
export type GenerateLinkResponse = {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
};
|
|
716
|
-
error: null;
|
|
717
|
-
} | {
|
|
718
|
-
data: {
|
|
719
|
-
properties: null;
|
|
720
|
-
user: null;
|
|
721
|
-
};
|
|
722
|
-
error: AuthError;
|
|
723
|
-
};
|
|
660
|
+
export declare type GenerateLinkParams = GenerateSignupLinkParams | GenerateInviteOrMagiclinkParams | GenerateRecoveryLinkParams | GenerateEmailChangeLinkParams;
|
|
661
|
+
export declare type GenerateLinkResponse = RequestResultSafeDestructure<{
|
|
662
|
+
properties: GenerateLinkProperties;
|
|
663
|
+
user: User;
|
|
664
|
+
}>;
|
|
724
665
|
/** The properties related to the email link generated */
|
|
725
|
-
export type GenerateLinkProperties = {
|
|
666
|
+
export declare type GenerateLinkProperties = {
|
|
726
667
|
/**
|
|
727
668
|
* The email link to send to the user.
|
|
728
669
|
* The action_link follows the following format: auth/v1/verify?type={verification_type}&token={hashed_token}&redirect_to={redirect_to}
|
|
@@ -742,113 +683,95 @@ export type GenerateLinkProperties = {
|
|
|
742
683
|
/** The verification type that the email link is associated to. */
|
|
743
684
|
verification_type: GenerateLinkType;
|
|
744
685
|
};
|
|
745
|
-
export type GenerateLinkType = 'signup' | 'invite' | 'magiclink' | 'recovery' | 'email_change_current' | 'email_change_new';
|
|
746
|
-
export type MFAEnrollParams = MFAEnrollTOTPParams | MFAEnrollPhoneParams;
|
|
747
|
-
export type MFAUnenrollParams = {
|
|
686
|
+
export declare type GenerateLinkType = 'signup' | 'invite' | 'magiclink' | 'recovery' | 'email_change_current' | 'email_change_new';
|
|
687
|
+
export declare type MFAEnrollParams = MFAEnrollTOTPParams | MFAEnrollPhoneParams;
|
|
688
|
+
export declare type MFAUnenrollParams = {
|
|
748
689
|
/** ID of the factor being unenrolled. */
|
|
749
690
|
factorId: string;
|
|
750
691
|
};
|
|
751
|
-
|
|
692
|
+
declare type MFAVerifyParamsBase = {
|
|
752
693
|
/** ID of the factor being verified. Returned in enroll(). */
|
|
753
694
|
factorId: string;
|
|
754
695
|
/** ID of the challenge being verified. Returned in challenge(). */
|
|
755
696
|
challengeId: string;
|
|
697
|
+
};
|
|
698
|
+
declare type MFAVerifyTOTPParamFields = {
|
|
756
699
|
/** Verification code provided by the user. */
|
|
757
700
|
code: string;
|
|
758
701
|
};
|
|
759
|
-
export type
|
|
702
|
+
export declare type MFAVerifyTOTPParams = Prettify<MFAVerifyParamsBase & MFAVerifyTOTPParamFields>;
|
|
703
|
+
declare type MFAVerifyPhoneParamFields = MFAVerifyTOTPParamFields;
|
|
704
|
+
export declare type MFAVerifyPhoneParams = Prettify<MFAVerifyParamsBase & MFAVerifyPhoneParamFields>;
|
|
705
|
+
export declare type MFAVerifyParams = MFAVerifyTOTPParams | MFAVerifyPhoneParams;
|
|
706
|
+
declare type MFAChallengeParamsBase = {
|
|
760
707
|
/** ID of the factor to be challenged. Returned in enroll(). */
|
|
761
708
|
factorId: string;
|
|
762
|
-
/** Messaging channel to use (e.g. whatsapp or sms). Only relevant for phone factors */
|
|
763
|
-
channel?: 'sms' | 'whatsapp';
|
|
764
|
-
};
|
|
765
|
-
export type MFAChallengeAndVerifyParams = {
|
|
766
|
-
/** ID of the factor being verified. Returned in enroll(). */
|
|
767
|
-
factorId: string;
|
|
768
|
-
/** Verification code provided by the user. */
|
|
769
|
-
code: string;
|
|
770
|
-
};
|
|
771
|
-
export type AuthMFAVerifyResponse = {
|
|
772
|
-
data: {
|
|
773
|
-
/** New access token (JWT) after successful verification. */
|
|
774
|
-
access_token: string;
|
|
775
|
-
/** Type of token, typically `Bearer`. */
|
|
776
|
-
token_type: string;
|
|
777
|
-
/** Number of seconds in which the access token will expire. */
|
|
778
|
-
expires_in: number;
|
|
779
|
-
/** Refresh token you can use to obtain new access tokens when expired. */
|
|
780
|
-
refresh_token: string;
|
|
781
|
-
/** Updated user profile. */
|
|
782
|
-
user: User;
|
|
783
|
-
};
|
|
784
|
-
error: null;
|
|
785
|
-
} | {
|
|
786
|
-
data: null;
|
|
787
|
-
error: AuthError;
|
|
788
|
-
};
|
|
789
|
-
export type AuthMFAEnrollResponse = AuthMFAEnrollTOTPResponse | AuthMFAEnrollPhoneResponse;
|
|
790
|
-
export type AuthMFAUnenrollResponse = {
|
|
791
|
-
data: {
|
|
792
|
-
/** ID of the factor that was successfully unenrolled. */
|
|
793
|
-
id: string;
|
|
794
|
-
};
|
|
795
|
-
error: null;
|
|
796
|
-
} | {
|
|
797
|
-
data: null;
|
|
798
|
-
error: AuthError;
|
|
799
|
-
};
|
|
800
|
-
export type AuthMFAChallengeResponse = {
|
|
801
|
-
data: {
|
|
802
|
-
/** ID of the newly created challenge. */
|
|
803
|
-
id: string;
|
|
804
|
-
/** Factor Type which generated the challenge */
|
|
805
|
-
type: 'totp' | 'phone';
|
|
806
|
-
/** Timestamp in UNIX seconds when this challenge will no longer be usable. */
|
|
807
|
-
expires_at: number;
|
|
808
|
-
};
|
|
809
|
-
error: null;
|
|
810
|
-
} | {
|
|
811
|
-
data: null;
|
|
812
|
-
error: AuthError;
|
|
813
|
-
};
|
|
814
|
-
export type AuthMFAListFactorsResponse = {
|
|
815
|
-
data: {
|
|
816
|
-
/** All available factors (verified and unverified). */
|
|
817
|
-
all: Factor[];
|
|
818
|
-
/** Only verified TOTP factors. (A subset of `all`.) */
|
|
819
|
-
totp: Factor[];
|
|
820
|
-
/** Only verified Phone factors. (A subset of `all`.) */
|
|
821
|
-
phone: Factor[];
|
|
822
|
-
};
|
|
823
|
-
error: null;
|
|
824
|
-
} | {
|
|
825
|
-
data: null;
|
|
826
|
-
error: AuthError;
|
|
827
|
-
};
|
|
828
|
-
export type AuthenticatorAssuranceLevels = 'aal1' | 'aal2';
|
|
829
|
-
export type AuthMFAGetAuthenticatorAssuranceLevelResponse = {
|
|
830
|
-
data: {
|
|
831
|
-
/** Current AAL level of the session. */
|
|
832
|
-
currentLevel: AuthenticatorAssuranceLevels | null;
|
|
833
|
-
/**
|
|
834
|
-
* Next possible AAL level for the session. If the next level is higher
|
|
835
|
-
* than the current one, the user should go through MFA.
|
|
836
|
-
*
|
|
837
|
-
* @see {@link GoTrueMFAApi#challenge}
|
|
838
|
-
*/
|
|
839
|
-
nextLevel: AuthenticatorAssuranceLevels | null;
|
|
840
|
-
/**
|
|
841
|
-
* A list of all authentication methods attached to this session. Use
|
|
842
|
-
* the information here to detect the last time a user verified a
|
|
843
|
-
* factor, for example if implementing a step-up scenario.
|
|
844
|
-
*/
|
|
845
|
-
currentAuthenticationMethods: AMREntry[];
|
|
846
|
-
};
|
|
847
|
-
error: null;
|
|
848
|
-
} | {
|
|
849
|
-
data: null;
|
|
850
|
-
error: AuthError;
|
|
851
709
|
};
|
|
710
|
+
declare const MFATOTPChannels: readonly ["sms", "whatsapp"];
|
|
711
|
+
export declare type MFATOTPChannel = typeof MFATOTPChannels[number];
|
|
712
|
+
export declare type MFAChallengeTOTPParams = Prettify<MFAChallengeParamsBase>;
|
|
713
|
+
declare type MFAChallengePhoneParamFields<Channel extends MFATOTPChannel = MFATOTPChannel> = {
|
|
714
|
+
/** Messaging channel to use (e.g. whatsapp or sms). Only relevant for phone factors */
|
|
715
|
+
channel: Channel;
|
|
716
|
+
};
|
|
717
|
+
export declare type MFAChallengePhoneParams = Prettify<MFAChallengeParamsBase & MFAChallengePhoneParamFields>;
|
|
718
|
+
export declare type MFAChallengeParams = MFAChallengeTOTPParams | MFAChallengePhoneParams;
|
|
719
|
+
declare type MFAChallengeAndVerifyParamsBase = Omit<MFAVerifyParamsBase, 'challengeId'>;
|
|
720
|
+
declare type MFAChallengeAndVerifyTOTPParamFields = MFAVerifyTOTPParamFields;
|
|
721
|
+
declare type MFAChallengeAndVerifyTOTPParams = Prettify<MFAChallengeAndVerifyParamsBase & MFAChallengeAndVerifyTOTPParamFields>;
|
|
722
|
+
declare type MFAChallengeAndVerifyPhoneParamFields = MFAVerifyPhoneParamFields;
|
|
723
|
+
declare type MFAChallengeAndVerifyPhoneParams = Prettify<MFAChallengeAndVerifyParamsBase & MFAChallengeAndVerifyPhoneParamFields>;
|
|
724
|
+
export declare type MFAChallengeAndVerifyParams = MFAChallengeAndVerifyTOTPParams | MFAChallengeAndVerifyPhoneParams;
|
|
725
|
+
export declare type AuthMFAVerifyResponse = RequestResult<{
|
|
726
|
+
/** New access token (JWT) after successful verification. */
|
|
727
|
+
access_token: string;
|
|
728
|
+
/** Type of token, always `bearer`. */
|
|
729
|
+
token_type: 'bearer';
|
|
730
|
+
/** Number of seconds in which the access token will expire. */
|
|
731
|
+
expires_in: number;
|
|
732
|
+
/** Refresh token you can use to obtain new access tokens when expired. */
|
|
733
|
+
refresh_token: string;
|
|
734
|
+
/** Updated user profile. */
|
|
735
|
+
user: User;
|
|
736
|
+
}>;
|
|
737
|
+
export declare type AuthMFAEnrollResponse = AuthMFAEnrollTOTPResponse | AuthMFAEnrollPhoneResponse;
|
|
738
|
+
export declare type AuthMFAUnenrollResponse = RequestResult<{
|
|
739
|
+
/** ID of the factor that was successfully unenrolled. */
|
|
740
|
+
id: string;
|
|
741
|
+
}>;
|
|
742
|
+
export declare type AuthMFAChallengeResponse<T extends FactorType> = RequestResult<{
|
|
743
|
+
/** ID of the newly created challenge. */
|
|
744
|
+
id: string;
|
|
745
|
+
/** Factor Type which generated the challenge */
|
|
746
|
+
type: T;
|
|
747
|
+
/** Timestamp in UNIX seconds when this challenge will no longer be usable. */
|
|
748
|
+
expires_at: number;
|
|
749
|
+
}>;
|
|
750
|
+
/** response of ListFactors, which should contain all the types of factors that are available, this ensures we always include all */
|
|
751
|
+
export declare type AuthMFAListFactorsResponse<T extends typeof FactorTypes = typeof FactorTypes> = RequestResult<{
|
|
752
|
+
/** All available factors (verified and unverified). */
|
|
753
|
+
all: Prettify<Factor>[];
|
|
754
|
+
} & {
|
|
755
|
+
[K in T[number]]: Prettify<Factor<K, 'verified'>>[];
|
|
756
|
+
}>;
|
|
757
|
+
export declare type AuthenticatorAssuranceLevels = 'aal1' | 'aal2';
|
|
758
|
+
export declare type AuthMFAGetAuthenticatorAssuranceLevelResponse = RequestResult<{
|
|
759
|
+
/** Current AAL level of the session. */
|
|
760
|
+
currentLevel: AuthenticatorAssuranceLevels | null;
|
|
761
|
+
/**
|
|
762
|
+
* Next possible AAL level for the session. If the next level is higher
|
|
763
|
+
* than the current one, the user should go through MFA.
|
|
764
|
+
*
|
|
765
|
+
* @see {@link GoTrueMFAApi#challenge}
|
|
766
|
+
*/
|
|
767
|
+
nextLevel: AuthenticatorAssuranceLevels | null;
|
|
768
|
+
/**
|
|
769
|
+
* A list of all authentication methods attached to this session. Use
|
|
770
|
+
* the information here to detect the last time a user verified a
|
|
771
|
+
* factor, for example if implementing a step-up scenario.
|
|
772
|
+
*/
|
|
773
|
+
currentAuthenticationMethods: AMREntry[];
|
|
774
|
+
}>;
|
|
852
775
|
/**
|
|
853
776
|
* Contains the full multi-factor authentication API.
|
|
854
777
|
*
|
|
@@ -862,7 +785,6 @@ export interface GoTrueMFAApi {
|
|
|
862
785
|
* The user has to enter the code from their authenticator app to verify it.
|
|
863
786
|
*
|
|
864
787
|
* Upon verifying a factor, all other sessions are logged out and the current session's authenticator level is promoted to `aal2`.
|
|
865
|
-
*
|
|
866
788
|
*/
|
|
867
789
|
enroll(params: MFAEnrollTOTPParams): Promise<AuthMFAEnrollTOTPResponse>;
|
|
868
790
|
enroll(params: MFAEnrollPhoneParams): Promise<AuthMFAEnrollPhoneResponse>;
|
|
@@ -871,11 +793,15 @@ export interface GoTrueMFAApi {
|
|
|
871
793
|
* Prepares a challenge used to verify that a user has access to a MFA
|
|
872
794
|
* factor.
|
|
873
795
|
*/
|
|
874
|
-
challenge(params:
|
|
796
|
+
challenge(params: MFAChallengeTOTPParams): Promise<Prettify<AuthMFAChallengeResponse<'totp'>>>;
|
|
797
|
+
challenge(params: MFAChallengePhoneParams): Promise<Prettify<AuthMFAChallengeResponse<'phone'>>>;
|
|
798
|
+
challenge(params: MFAChallengeParams): Promise<Prettify<AuthMFAChallengeResponse<'totp' | 'phone'>>>;
|
|
875
799
|
/**
|
|
876
800
|
* Verifies a code against a challenge. The verification code is
|
|
877
801
|
* provided by the user by entering a code seen in their authenticator app.
|
|
878
802
|
*/
|
|
803
|
+
verify(params: MFAVerifyTOTPParams): Promise<AuthMFAVerifyResponse>;
|
|
804
|
+
verify(params: MFAVerifyPhoneParams): Promise<AuthMFAVerifyResponse>;
|
|
879
805
|
verify(params: MFAVerifyParams): Promise<AuthMFAVerifyResponse>;
|
|
880
806
|
/**
|
|
881
807
|
* Unenroll removes a MFA factor.
|
|
@@ -914,20 +840,14 @@ export interface GoTrueMFAApi {
|
|
|
914
840
|
/**
|
|
915
841
|
* @expermental
|
|
916
842
|
*/
|
|
917
|
-
export type AuthMFAAdminDeleteFactorResponse = {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
};
|
|
922
|
-
error: null;
|
|
923
|
-
} | {
|
|
924
|
-
data: null;
|
|
925
|
-
error: AuthError;
|
|
926
|
-
};
|
|
843
|
+
export declare type AuthMFAAdminDeleteFactorResponse = RequestResult<{
|
|
844
|
+
/** ID of the factor that was successfully deleted. */
|
|
845
|
+
id: string;
|
|
846
|
+
}>;
|
|
927
847
|
/**
|
|
928
848
|
* @expermental
|
|
929
849
|
*/
|
|
930
|
-
export type AuthMFAAdminDeleteFactorParams = {
|
|
850
|
+
export declare type AuthMFAAdminDeleteFactorParams = {
|
|
931
851
|
/** ID of the MFA factor to delete. */
|
|
932
852
|
id: string;
|
|
933
853
|
/** ID of the user whose factor is being deleted. */
|
|
@@ -936,20 +856,14 @@ export type AuthMFAAdminDeleteFactorParams = {
|
|
|
936
856
|
/**
|
|
937
857
|
* @expermental
|
|
938
858
|
*/
|
|
939
|
-
export type AuthMFAAdminListFactorsResponse = {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
};
|
|
944
|
-
error: null;
|
|
945
|
-
} | {
|
|
946
|
-
data: null;
|
|
947
|
-
error: AuthError;
|
|
948
|
-
};
|
|
859
|
+
export declare type AuthMFAAdminListFactorsResponse = RequestResult<{
|
|
860
|
+
/** All factors attached to the user. */
|
|
861
|
+
factors: Factor[];
|
|
862
|
+
}>;
|
|
949
863
|
/**
|
|
950
864
|
* @expermental
|
|
951
865
|
*/
|
|
952
|
-
export type AuthMFAAdminListFactorsParams = {
|
|
866
|
+
export declare type AuthMFAAdminListFactorsParams = {
|
|
953
867
|
/** ID of the user. */
|
|
954
868
|
userId: string;
|
|
955
869
|
};
|
|
@@ -974,12 +888,12 @@ export interface GoTrueAdminMFAApi {
|
|
|
974
888
|
*/
|
|
975
889
|
deleteFactor(params: AuthMFAAdminDeleteFactorParams): Promise<AuthMFAAdminDeleteFactorResponse>;
|
|
976
890
|
}
|
|
977
|
-
type AnyFunction = (...args: any[]) => any;
|
|
978
|
-
type MaybePromisify<T> = T | Promise<T>;
|
|
979
|
-
type PromisifyMethods<T> = {
|
|
891
|
+
declare type AnyFunction = (...args: any[]) => any;
|
|
892
|
+
declare type MaybePromisify<T> = T | Promise<T>;
|
|
893
|
+
declare type PromisifyMethods<T> = {
|
|
980
894
|
[K in keyof T]: T[K] extends AnyFunction ? (...args: Parameters<T[K]>) => MaybePromisify<ReturnType<T[K]>> : T[K];
|
|
981
895
|
};
|
|
982
|
-
export type SupportedStorage = PromisifyMethods<Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>> & {
|
|
896
|
+
export declare type SupportedStorage = PromisifyMethods<Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>> & {
|
|
983
897
|
/**
|
|
984
898
|
* If set to `true` signals to the library that the storage medium is used
|
|
985
899
|
* on a server and the values may not be authentic, such as reading from
|
|
@@ -989,29 +903,23 @@ export type SupportedStorage = PromisifyMethods<Pick<Storage, 'getItem' | 'setIt
|
|
|
989
903
|
*/
|
|
990
904
|
isServer?: boolean;
|
|
991
905
|
};
|
|
992
|
-
export type InitializeResult = {
|
|
906
|
+
export declare type InitializeResult = {
|
|
993
907
|
error: AuthError | null;
|
|
994
908
|
};
|
|
995
|
-
export type CallRefreshTokenResult =
|
|
996
|
-
|
|
997
|
-
error: null;
|
|
998
|
-
} | {
|
|
999
|
-
session: null;
|
|
1000
|
-
error: AuthError;
|
|
1001
|
-
};
|
|
1002
|
-
export type Pagination = {
|
|
909
|
+
export declare type CallRefreshTokenResult = RequestResult<Session>;
|
|
910
|
+
export declare type Pagination = {
|
|
1003
911
|
[key: string]: any;
|
|
1004
912
|
nextPage: number | null;
|
|
1005
913
|
lastPage: number;
|
|
1006
914
|
total: number;
|
|
1007
915
|
};
|
|
1008
|
-
export type PageParams = {
|
|
916
|
+
export declare type PageParams = {
|
|
1009
917
|
/** The page number */
|
|
1010
918
|
page?: number;
|
|
1011
919
|
/** Number of items returned per page */
|
|
1012
920
|
perPage?: number;
|
|
1013
921
|
};
|
|
1014
|
-
export type SignOut = {
|
|
922
|
+
export declare type SignOut = {
|
|
1015
923
|
/**
|
|
1016
924
|
* Determines which sessions should be
|
|
1017
925
|
* logged out. Global means all
|
|
@@ -1024,72 +932,58 @@ export type SignOut = {
|
|
|
1024
932
|
*/
|
|
1025
933
|
scope?: 'global' | 'local' | 'others';
|
|
1026
934
|
};
|
|
1027
|
-
|
|
935
|
+
declare type MFAEnrollParamsBase<T extends FactorType> = {
|
|
1028
936
|
/** The type of factor being enrolled. */
|
|
1029
|
-
factorType:
|
|
1030
|
-
/** Domain which the user is enrolled with. */
|
|
1031
|
-
issuer?: string;
|
|
937
|
+
factorType: T;
|
|
1032
938
|
/** Human readable name assigned to the factor. */
|
|
1033
939
|
friendlyName?: string;
|
|
1034
940
|
};
|
|
1035
|
-
|
|
1036
|
-
/**
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
941
|
+
declare type MFAEnrollTOTPParamFields = {
|
|
942
|
+
/** Domain which the user is enrolled with. */
|
|
943
|
+
issuer?: string;
|
|
944
|
+
};
|
|
945
|
+
export declare type MFAEnrollTOTPParams = Prettify<MFAEnrollParamsBase<'totp'> & MFAEnrollTOTPParamFields>;
|
|
946
|
+
declare type MFAEnrollPhoneParamFields = {
|
|
1040
947
|
/** Phone number associated with a factor. Number should conform to E.164 format */
|
|
1041
948
|
phone: string;
|
|
1042
949
|
};
|
|
1043
|
-
export type
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
/** Contains a QR code encoding the authenticator URI. You can
|
|
1052
|
-
* convert it to a URL by prepending `data:image/svg+xml;utf-8,` to
|
|
1053
|
-
* the value. Avoid logging this value to the console. */
|
|
1054
|
-
qr_code: string;
|
|
1055
|
-
/** The TOTP secret (also encoded in the QR code). Show this secret
|
|
1056
|
-
* in a password-style field to the user, in case they are unable to
|
|
1057
|
-
* scan the QR code. Avoid logging this value to the console. */
|
|
1058
|
-
secret: string;
|
|
1059
|
-
/** The authenticator URI encoded within the QR code, should you need
|
|
1060
|
-
* to use it. Avoid loggin this value to the console. */
|
|
1061
|
-
uri: string;
|
|
1062
|
-
};
|
|
1063
|
-
/** Friendly name of the factor, useful for distinguishing between factors **/
|
|
1064
|
-
friendly_name?: string;
|
|
1065
|
-
};
|
|
1066
|
-
error: null;
|
|
1067
|
-
} | {
|
|
1068
|
-
data: null;
|
|
1069
|
-
error: AuthError;
|
|
950
|
+
export declare type MFAEnrollPhoneParams = Prettify<MFAEnrollParamsBase<'phone'> & MFAEnrollPhoneParamFields>;
|
|
951
|
+
declare type AuthMFAEnrollResponseBase<T extends FactorType> = {
|
|
952
|
+
/** ID of the factor that was just enrolled (in an unverified state). */
|
|
953
|
+
id: string;
|
|
954
|
+
/** Type of MFA factor.*/
|
|
955
|
+
type: T;
|
|
956
|
+
/** Friendly name of the factor, useful for distinguishing between factors **/
|
|
957
|
+
friendly_name?: string;
|
|
1070
958
|
};
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
959
|
+
declare type AuthMFAEnrollTOTPResponseFields = {
|
|
960
|
+
/** TOTP enrollment information. */
|
|
961
|
+
totp: {
|
|
962
|
+
/** Contains a QR code encoding the authenticator URI. You can
|
|
963
|
+
* convert it to a URL by prepending `data:image/svg+xml;utf-8,` to
|
|
964
|
+
* the value. Avoid logging this value to the console. */
|
|
965
|
+
qr_code: string;
|
|
966
|
+
/** The TOTP secret (also encoded in the QR code). Show this secret
|
|
967
|
+
* in a password-style field to the user, in case they are unable to
|
|
968
|
+
* scan the QR code. Avoid logging this value to the console. */
|
|
969
|
+
secret: string;
|
|
970
|
+
/** The authenticator URI encoded within the QR code, should you need
|
|
971
|
+
* to use it. Avoid loggin this value to the console. */
|
|
972
|
+
uri: string;
|
|
973
|
+
};
|
|
974
|
+
};
|
|
975
|
+
export declare type AuthMFAEnrollTOTPResponse = RequestResult<Prettify<AuthMFAEnrollResponseBase<'totp'> & AuthMFAEnrollTOTPResponseFields>>;
|
|
976
|
+
declare type AuthMFAEnrollPhoneResponseFields = {
|
|
977
|
+
/** Phone number of the MFA factor in E.164 format. Used to send messages */
|
|
978
|
+
phone: string;
|
|
1086
979
|
};
|
|
1087
|
-
export type
|
|
980
|
+
export declare type AuthMFAEnrollPhoneResponse = RequestResult<Prettify<AuthMFAEnrollResponseBase<'phone'> & AuthMFAEnrollPhoneResponseFields>>;
|
|
981
|
+
export declare type JwtHeader = {
|
|
1088
982
|
alg: 'RS256' | 'ES256' | 'HS256';
|
|
1089
983
|
kid: string;
|
|
1090
984
|
typ: string;
|
|
1091
985
|
};
|
|
1092
|
-
export type RequiredClaims = {
|
|
986
|
+
export declare type RequiredClaims = {
|
|
1093
987
|
iss: string;
|
|
1094
988
|
sub: string;
|
|
1095
989
|
aud: string | string[];
|
|
@@ -1099,7 +993,7 @@ export type RequiredClaims = {
|
|
|
1099
993
|
aal: AuthenticatorAssuranceLevels;
|
|
1100
994
|
session_id: string;
|
|
1101
995
|
};
|
|
1102
|
-
export type JwtPayload = RequiredClaims & {
|
|
996
|
+
export declare type JwtPayload = RequiredClaims & {
|
|
1103
997
|
[key: string]: any;
|
|
1104
998
|
};
|
|
1105
999
|
export interface JWK {
|
|
@@ -1110,6 +1004,6 @@ export interface JWK {
|
|
|
1110
1004
|
[key: string]: any;
|
|
1111
1005
|
}
|
|
1112
1006
|
export declare const SIGN_OUT_SCOPES: readonly ["global", "local", "others"];
|
|
1113
|
-
export type SignOutScope =
|
|
1007
|
+
export declare type SignOutScope = typeof SIGN_OUT_SCOPES[number];
|
|
1114
1008
|
export {};
|
|
1115
1009
|
//# sourceMappingURL=types.d.ts.map
|