@supabase/auth-js 2.73.0-rc.5 → 2.73.1-canary.4
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.d.ts +41 -1
- package/dist/main/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/main/GoTrueAdminApi.js +137 -0
- package/dist/main/GoTrueAdminApi.js.map +1 -1
- package/dist/main/GoTrueClient.d.ts +20 -1
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +18 -22
- package/dist/main/GoTrueClient.js.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 +1 -1
- 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 +254 -122
- package/dist/main/lib/types.d.ts.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 +3 -3
- package/dist/main/lib/webauthn.d.ts.map +1 -1
- package/dist/main/lib/webauthn.dom.d.ts +9 -9
- package/dist/main/lib/webauthn.dom.d.ts.map +1 -1
- package/dist/main/lib/webauthn.errors.d.ts +1 -1
- package/dist/main/lib/webauthn.errors.d.ts.map +1 -1
- package/dist/main/lib/webauthn.errors.js +4 -4
- package/dist/main/lib/webauthn.errors.js.map +1 -1
- package/dist/main/lib/webauthn.js +11 -11
- package/dist/main/lib/webauthn.js.map +1 -1
- package/dist/module/GoTrueAdminApi.d.ts +41 -1
- package/dist/module/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/module/GoTrueAdminApi.js +137 -0
- package/dist/module/GoTrueAdminApi.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts +20 -1
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +19 -22
- 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.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 +254 -122
- package/dist/module/lib/types.d.ts.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 +3 -3
- package/dist/module/lib/webauthn.d.ts.map +1 -1
- package/dist/module/lib/webauthn.dom.d.ts +9 -9
- package/dist/module/lib/webauthn.dom.d.ts.map +1 -1
- package/dist/module/lib/webauthn.errors.d.ts +1 -1
- package/dist/module/lib/webauthn.errors.d.ts.map +1 -1
- package/dist/module/lib/webauthn.errors.js.map +1 -1
- package/dist/module/lib/webauthn.js +1 -1
- package/dist/module/lib/webauthn.js.map +1 -1
- package/package.json +13 -34
- package/src/GoTrueAdminApi.ts +163 -0
- package/src/GoTrueClient.ts +28 -9
- package/src/lib/types.ts +149 -7
- package/src/lib/version.ts +7 -1
- package/src/lib/webauthn.dom.ts +1 -1
package/dist/main/lib/types.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import type { SolanaSignInInput, SolanaSignInOutput } from './web3/solana';
|
|
|
5
5
|
import { ServerCredentialCreationOptions, ServerCredentialRequestOptions, WebAuthnApi } from './webauthn';
|
|
6
6
|
import { AuthenticationCredential, PublicKeyCredentialCreationOptionsFuture, PublicKeyCredentialRequestOptionsFuture, RegistrationCredential } from './webauthn.dom';
|
|
7
7
|
/** One of the providers supported by GoTrue. */
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
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;
|
|
11
11
|
/**
|
|
12
12
|
* Provide your own global lock implementation instead of the default
|
|
13
13
|
* implementation. The function should acquire a lock for the duration of the
|
|
@@ -23,8 +23,8 @@ export declare type AuthChangeEvent = 'INITIAL_SESSION' | 'PASSWORD_RECOVERY' |
|
|
|
23
23
|
* acquired after this much time (ms).
|
|
24
24
|
* @param fn The operation to execute when the lock is acquired.
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
27
|
-
export
|
|
26
|
+
export type LockFunc = <R>(name: string, acquireTimeout: number, fn: () => Promise<R>) => Promise<R>;
|
|
27
|
+
export type GoTrueClientOptions = {
|
|
28
28
|
url?: string;
|
|
29
29
|
headers?: {
|
|
30
30
|
[key: string]: string;
|
|
@@ -58,8 +58,8 @@ export declare type GoTrueClientOptions = {
|
|
|
58
58
|
hasCustomAuthorizationHeader?: boolean;
|
|
59
59
|
};
|
|
60
60
|
declare const WeakPasswordReasons: readonly ["length", "characters", "pwned"];
|
|
61
|
-
export
|
|
62
|
-
export
|
|
61
|
+
export type WeakPasswordReasons = (typeof WeakPasswordReasons)[number];
|
|
62
|
+
export type WeakPassword = {
|
|
63
63
|
reasons: WeakPasswordReasons[];
|
|
64
64
|
message: string;
|
|
65
65
|
};
|
|
@@ -67,7 +67,7 @@ export declare type WeakPassword = {
|
|
|
67
67
|
* Resolve mapped types and show the derived keys and their types when hovering in
|
|
68
68
|
* VS Code, instead of just showing the names those mapped types are defined with.
|
|
69
69
|
*/
|
|
70
|
-
export
|
|
70
|
+
export type Prettify<T> = T extends Function ? T : {
|
|
71
71
|
[K in keyof T]: T[K];
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
@@ -75,11 +75,11 @@ export declare type Prettify<T> = T extends Function ? T : {
|
|
|
75
75
|
* This prevents typos and ensures type safety at compile time.
|
|
76
76
|
* Unlike regular Omit, this will error if you try to omit a non-existent key.
|
|
77
77
|
*/
|
|
78
|
-
export
|
|
78
|
+
export type StrictOmit<T, K extends keyof T> = Omit<T, K>;
|
|
79
79
|
/**
|
|
80
80
|
* a shared result type that encapsulates errors instead of throwing them, allows you to optionally specify the ErrorType
|
|
81
81
|
*/
|
|
82
|
-
export
|
|
82
|
+
export type RequestResult<T, ErrorType extends Error = AuthError> = {
|
|
83
83
|
data: T;
|
|
84
84
|
error: null;
|
|
85
85
|
} | {
|
|
@@ -90,7 +90,7 @@ export declare type RequestResult<T, ErrorType extends Error = AuthError> = {
|
|
|
90
90
|
* similar to RequestResult except it allows you to destructure the possible shape of the success response
|
|
91
91
|
* {@see RequestResult}
|
|
92
92
|
*/
|
|
93
|
-
export
|
|
93
|
+
export type RequestResultSafeDestructure<T> = {
|
|
94
94
|
data: T;
|
|
95
95
|
error: null;
|
|
96
96
|
} | {
|
|
@@ -99,11 +99,11 @@ export declare type RequestResultSafeDestructure<T> = {
|
|
|
99
99
|
} : null;
|
|
100
100
|
error: AuthError;
|
|
101
101
|
};
|
|
102
|
-
export
|
|
102
|
+
export type AuthResponse = RequestResultSafeDestructure<{
|
|
103
103
|
user: User | null;
|
|
104
104
|
session: Session | null;
|
|
105
105
|
}>;
|
|
106
|
-
export
|
|
106
|
+
export type AuthResponsePassword = RequestResultSafeDestructure<{
|
|
107
107
|
user: User | null;
|
|
108
108
|
session: Session | null;
|
|
109
109
|
weak_password?: WeakPassword | null;
|
|
@@ -113,21 +113,21 @@ export declare type AuthResponsePassword = RequestResultSafeDestructure<{
|
|
|
113
113
|
*
|
|
114
114
|
* {@see AuthResponse}
|
|
115
115
|
*/
|
|
116
|
-
export
|
|
116
|
+
export type AuthOtpResponse = RequestResultSafeDestructure<{
|
|
117
117
|
user: null;
|
|
118
118
|
session: null;
|
|
119
119
|
messageId?: string | null;
|
|
120
120
|
}>;
|
|
121
|
-
export
|
|
121
|
+
export type AuthTokenResponse = RequestResultSafeDestructure<{
|
|
122
122
|
user: User;
|
|
123
123
|
session: Session;
|
|
124
124
|
}>;
|
|
125
|
-
export
|
|
125
|
+
export type AuthTokenResponsePassword = RequestResultSafeDestructure<{
|
|
126
126
|
user: User;
|
|
127
127
|
session: Session;
|
|
128
128
|
weakPassword?: WeakPassword;
|
|
129
129
|
}>;
|
|
130
|
-
export
|
|
130
|
+
export type OAuthResponse = {
|
|
131
131
|
data: {
|
|
132
132
|
provider: Provider;
|
|
133
133
|
url: string;
|
|
@@ -140,7 +140,7 @@ export declare type OAuthResponse = {
|
|
|
140
140
|
};
|
|
141
141
|
error: AuthError;
|
|
142
142
|
};
|
|
143
|
-
export
|
|
143
|
+
export type SSOResponse = RequestResult<{
|
|
144
144
|
/**
|
|
145
145
|
* URL to open in a browser which will complete the sign-in flow by
|
|
146
146
|
* taking the user to the identity provider's authentication flow.
|
|
@@ -150,7 +150,7 @@ export declare type SSOResponse = RequestResult<{
|
|
|
150
150
|
*/
|
|
151
151
|
url: string;
|
|
152
152
|
}>;
|
|
153
|
-
export
|
|
153
|
+
export type UserResponse = RequestResultSafeDestructure<{
|
|
154
154
|
user: User;
|
|
155
155
|
}>;
|
|
156
156
|
export interface Session {
|
|
@@ -186,7 +186,7 @@ export interface Session {
|
|
|
186
186
|
user: User;
|
|
187
187
|
}
|
|
188
188
|
declare const AMRMethods: readonly ["password", "otp", "oauth", "totp", "mfa/totp", "mfa/phone", "mfa/webauthn", "anonymous", "sso/saml", "magiclink", "web3"];
|
|
189
|
-
export
|
|
189
|
+
export type AMRMethod = (typeof AMRMethods)[number] | (string & {});
|
|
190
190
|
/**
|
|
191
191
|
* An authentication methord reference (AMR) entry.
|
|
192
192
|
*
|
|
@@ -220,12 +220,12 @@ declare const FactorTypes: readonly ["totp", "phone", "webauthn"];
|
|
|
220
220
|
/**
|
|
221
221
|
* Type of factor. `totp` and `phone` supported with this version
|
|
222
222
|
*/
|
|
223
|
-
export
|
|
223
|
+
export type FactorType = (typeof FactorTypes)[number];
|
|
224
224
|
declare const FactorVerificationStatuses: readonly ["verified", "unverified"];
|
|
225
225
|
/**
|
|
226
226
|
* The verification status of the factor, default is `unverified` after `.enroll()`, then `verified` after the user verifies it with `.verify()`
|
|
227
227
|
*/
|
|
228
|
-
|
|
228
|
+
type FactorVerificationStatus = (typeof FactorVerificationStatuses)[number];
|
|
229
229
|
/**
|
|
230
230
|
* A MFA factor.
|
|
231
231
|
*
|
|
@@ -233,7 +233,7 @@ declare type FactorVerificationStatus = typeof FactorVerificationStatuses[number
|
|
|
233
233
|
* @see {@link GoTrueMFAApi#listFactors}
|
|
234
234
|
* @see {@link GoTrueMFAAdminApi#listFactors}
|
|
235
235
|
*/
|
|
236
|
-
export
|
|
236
|
+
export type Factor<Type extends FactorType = FactorType, Status extends FactorVerificationStatus = (typeof FactorVerificationStatuses)[number]> = {
|
|
237
237
|
/** ID of the factor. */
|
|
238
238
|
id: string;
|
|
239
239
|
/** Friendly name of the factor, useful to disambiguate between multiple factors. */
|
|
@@ -391,7 +391,7 @@ export interface Subscription {
|
|
|
391
391
|
*/
|
|
392
392
|
unsubscribe: () => void;
|
|
393
393
|
}
|
|
394
|
-
export
|
|
394
|
+
export type SignInAnonymouslyCredentials = {
|
|
395
395
|
options?: {
|
|
396
396
|
/**
|
|
397
397
|
* A custom data object to store the user's metadata. This maps to the `auth.users.raw_user_meta_data` column.
|
|
@@ -403,7 +403,7 @@ export declare type SignInAnonymouslyCredentials = {
|
|
|
403
403
|
captchaToken?: string;
|
|
404
404
|
};
|
|
405
405
|
};
|
|
406
|
-
export
|
|
406
|
+
export type SignUpWithPasswordCredentials = Prettify<PasswordCredentialsBase & {
|
|
407
407
|
options?: {
|
|
408
408
|
emailRedirectTo?: string;
|
|
409
409
|
data?: object;
|
|
@@ -411,19 +411,19 @@ export declare type SignUpWithPasswordCredentials = Prettify<PasswordCredentials
|
|
|
411
411
|
channel?: 'sms' | 'whatsapp';
|
|
412
412
|
};
|
|
413
413
|
}>;
|
|
414
|
-
|
|
414
|
+
type PasswordCredentialsBase = {
|
|
415
415
|
email: string;
|
|
416
416
|
password: string;
|
|
417
417
|
} | {
|
|
418
418
|
phone: string;
|
|
419
419
|
password: string;
|
|
420
420
|
};
|
|
421
|
-
export
|
|
421
|
+
export type SignInWithPasswordCredentials = PasswordCredentialsBase & {
|
|
422
422
|
options?: {
|
|
423
423
|
captchaToken?: string;
|
|
424
424
|
};
|
|
425
425
|
};
|
|
426
|
-
export
|
|
426
|
+
export type SignInWithPasswordlessCredentials = {
|
|
427
427
|
/** The user's email address. */
|
|
428
428
|
email: string;
|
|
429
429
|
options?: {
|
|
@@ -458,8 +458,8 @@ export declare type SignInWithPasswordlessCredentials = {
|
|
|
458
458
|
channel?: 'sms' | 'whatsapp';
|
|
459
459
|
};
|
|
460
460
|
};
|
|
461
|
-
export
|
|
462
|
-
export
|
|
461
|
+
export type AuthFlowType = 'implicit' | 'pkce';
|
|
462
|
+
export type SignInWithOAuthCredentials = {
|
|
463
463
|
/** One of the providers supported by GoTrue. */
|
|
464
464
|
provider: Provider;
|
|
465
465
|
options?: {
|
|
@@ -475,7 +475,7 @@ export declare type SignInWithOAuthCredentials = {
|
|
|
475
475
|
skipBrowserRedirect?: boolean;
|
|
476
476
|
};
|
|
477
477
|
};
|
|
478
|
-
export
|
|
478
|
+
export type SignInWithIdTokenCredentials = {
|
|
479
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). */
|
|
480
480
|
provider: 'google' | 'apple' | 'azure' | 'facebook' | 'kakao' | (string & {});
|
|
481
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. */
|
|
@@ -489,14 +489,14 @@ export declare type SignInWithIdTokenCredentials = {
|
|
|
489
489
|
captchaToken?: string;
|
|
490
490
|
};
|
|
491
491
|
};
|
|
492
|
-
export
|
|
492
|
+
export type SolanaWallet = {
|
|
493
493
|
signIn?: (...inputs: SolanaSignInInput[]) => Promise<SolanaSignInOutput | SolanaSignInOutput[]>;
|
|
494
494
|
publicKey?: {
|
|
495
495
|
toBase58: () => string;
|
|
496
496
|
} | null;
|
|
497
497
|
signMessage?: (message: Uint8Array, encoding?: 'utf8' | string) => Promise<Uint8Array> | undefined;
|
|
498
498
|
};
|
|
499
|
-
export
|
|
499
|
+
export type SolanaWeb3Credentials = {
|
|
500
500
|
chain: 'solana';
|
|
501
501
|
/** Wallet interface to use. If not specified will default to `window.solana`. */
|
|
502
502
|
wallet?: SolanaWallet;
|
|
@@ -520,8 +520,8 @@ export declare type SolanaWeb3Credentials = {
|
|
|
520
520
|
captchaToken?: string;
|
|
521
521
|
};
|
|
522
522
|
};
|
|
523
|
-
export
|
|
524
|
-
export
|
|
523
|
+
export type EthereumWallet = EIP1193Provider;
|
|
524
|
+
export type EthereumWeb3Credentials = {
|
|
525
525
|
chain: 'ethereum';
|
|
526
526
|
/** Wallet interface to use. If not specified will default to `window.ethereum`. */
|
|
527
527
|
wallet?: EthereumWallet;
|
|
@@ -545,8 +545,8 @@ export declare type EthereumWeb3Credentials = {
|
|
|
545
545
|
captchaToken?: string;
|
|
546
546
|
};
|
|
547
547
|
};
|
|
548
|
-
export
|
|
549
|
-
export
|
|
548
|
+
export type Web3Credentials = SolanaWeb3Credentials | EthereumWeb3Credentials;
|
|
549
|
+
export type VerifyOtpParams = VerifyMobileOtpParams | VerifyEmailOtpParams | VerifyTokenHashParams;
|
|
550
550
|
export interface VerifyMobileOtpParams {
|
|
551
551
|
/** The user's phone number. */
|
|
552
552
|
phone: string;
|
|
@@ -588,9 +588,9 @@ export interface VerifyTokenHashParams {
|
|
|
588
588
|
/** The user's verification type. */
|
|
589
589
|
type: EmailOtpType;
|
|
590
590
|
}
|
|
591
|
-
export
|
|
592
|
-
export
|
|
593
|
-
export
|
|
591
|
+
export type MobileOtpType = 'sms' | 'phone_change';
|
|
592
|
+
export type EmailOtpType = 'signup' | 'invite' | 'magiclink' | 'recovery' | 'email_change' | 'email';
|
|
593
|
+
export type ResendParams = {
|
|
594
594
|
type: Extract<EmailOtpType, 'signup' | 'email_change'>;
|
|
595
595
|
email: string;
|
|
596
596
|
options?: {
|
|
@@ -607,7 +607,7 @@ export declare type ResendParams = {
|
|
|
607
607
|
captchaToken?: string;
|
|
608
608
|
};
|
|
609
609
|
};
|
|
610
|
-
export
|
|
610
|
+
export type SignInWithSSO = {
|
|
611
611
|
/** UUID of the SSO provider to invoke single-sign on to. */
|
|
612
612
|
providerId: string;
|
|
613
613
|
options?: {
|
|
@@ -626,25 +626,25 @@ export declare type SignInWithSSO = {
|
|
|
626
626
|
captchaToken?: string;
|
|
627
627
|
};
|
|
628
628
|
};
|
|
629
|
-
export
|
|
629
|
+
export type GenerateSignupLinkParams = {
|
|
630
630
|
type: 'signup';
|
|
631
631
|
email: string;
|
|
632
632
|
password: string;
|
|
633
633
|
options?: Pick<GenerateLinkOptions, 'data' | 'redirectTo'>;
|
|
634
634
|
};
|
|
635
|
-
export
|
|
635
|
+
export type GenerateInviteOrMagiclinkParams = {
|
|
636
636
|
type: 'invite' | 'magiclink';
|
|
637
637
|
/** The user's email */
|
|
638
638
|
email: string;
|
|
639
639
|
options?: Pick<GenerateLinkOptions, 'data' | 'redirectTo'>;
|
|
640
640
|
};
|
|
641
|
-
export
|
|
641
|
+
export type GenerateRecoveryLinkParams = {
|
|
642
642
|
type: 'recovery';
|
|
643
643
|
/** The user's email */
|
|
644
644
|
email: string;
|
|
645
645
|
options?: Pick<GenerateLinkOptions, 'redirectTo'>;
|
|
646
646
|
};
|
|
647
|
-
export
|
|
647
|
+
export type GenerateEmailChangeLinkParams = {
|
|
648
648
|
type: 'email_change_current' | 'email_change_new';
|
|
649
649
|
/** The user's email */
|
|
650
650
|
email: string;
|
|
@@ -664,13 +664,13 @@ export interface GenerateLinkOptions {
|
|
|
664
664
|
/** The URL which will be appended to the email link generated. */
|
|
665
665
|
redirectTo?: string;
|
|
666
666
|
}
|
|
667
|
-
export
|
|
668
|
-
export
|
|
667
|
+
export type GenerateLinkParams = GenerateSignupLinkParams | GenerateInviteOrMagiclinkParams | GenerateRecoveryLinkParams | GenerateEmailChangeLinkParams;
|
|
668
|
+
export type GenerateLinkResponse = RequestResultSafeDestructure<{
|
|
669
669
|
properties: GenerateLinkProperties;
|
|
670
670
|
user: User;
|
|
671
671
|
}>;
|
|
672
672
|
/** The properties related to the email link generated */
|
|
673
|
-
export
|
|
673
|
+
export type GenerateLinkProperties = {
|
|
674
674
|
/**
|
|
675
675
|
* The email link to send to the user.
|
|
676
676
|
* The action_link follows the following format: auth/v1/verify?type={verification_type}&token={hashed_token}&redirect_to={redirect_to}
|
|
@@ -690,32 +690,32 @@ export declare type GenerateLinkProperties = {
|
|
|
690
690
|
/** The verification type that the email link is associated to. */
|
|
691
691
|
verification_type: GenerateLinkType;
|
|
692
692
|
};
|
|
693
|
-
export
|
|
694
|
-
export
|
|
695
|
-
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 = {
|
|
696
696
|
/** ID of the factor being unenrolled. */
|
|
697
697
|
factorId: string;
|
|
698
698
|
};
|
|
699
|
-
|
|
699
|
+
type MFAVerifyParamsBase = {
|
|
700
700
|
/** ID of the factor being verified. Returned in enroll(). */
|
|
701
701
|
factorId: string;
|
|
702
702
|
/** ID of the challenge being verified. Returned in challenge(). */
|
|
703
703
|
challengeId: string;
|
|
704
704
|
};
|
|
705
|
-
|
|
705
|
+
type MFAVerifyTOTPParamFields = {
|
|
706
706
|
/** Verification code provided by the user. */
|
|
707
707
|
code: string;
|
|
708
708
|
};
|
|
709
|
-
export
|
|
710
|
-
|
|
711
|
-
export
|
|
712
|
-
|
|
709
|
+
export type MFAVerifyTOTPParams = Prettify<MFAVerifyParamsBase & MFAVerifyTOTPParamFields>;
|
|
710
|
+
type MFAVerifyPhoneParamFields = MFAVerifyTOTPParamFields;
|
|
711
|
+
export type MFAVerifyPhoneParams = Prettify<MFAVerifyParamsBase & MFAVerifyPhoneParamFields>;
|
|
712
|
+
type MFAVerifyWebauthnParamFieldsBase = {
|
|
713
713
|
/** Relying party ID */
|
|
714
714
|
rpId: string;
|
|
715
715
|
/** Relying party origins */
|
|
716
716
|
rpOrigins?: string[];
|
|
717
717
|
};
|
|
718
|
-
|
|
718
|
+
type MFAVerifyWebauthnCredentialParamFields<T extends 'create' | 'request' = 'create' | 'request'> = {
|
|
719
719
|
/** Operation type */
|
|
720
720
|
type: T;
|
|
721
721
|
/** Creation response from the authenticator (for enrollment/unverified factors) */
|
|
@@ -726,7 +726,7 @@ declare type MFAVerifyWebauthnCredentialParamFields<T extends 'create' | 'reques
|
|
|
726
726
|
* Supports both credential creation (registration) and request (authentication) flows.
|
|
727
727
|
* @template T - Type of WebAuthn operation: 'create' for registration, 'request' for authentication
|
|
728
728
|
*/
|
|
729
|
-
export
|
|
729
|
+
export type MFAVerifyWebauthnParamFields<T extends 'create' | 'request' = 'create' | 'request'> = {
|
|
730
730
|
webauthn: MFAVerifyWebauthnParamFieldsBase & MFAVerifyWebauthnCredentialParamFields<T>;
|
|
731
731
|
};
|
|
732
732
|
/**
|
|
@@ -735,22 +735,22 @@ export declare type MFAVerifyWebauthnParamFields<T extends 'create' | 'request'
|
|
|
735
735
|
* @template T - Type of WebAuthn operation: 'create' for registration, 'request' for authentication
|
|
736
736
|
* @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying an Authentication Assertion}
|
|
737
737
|
*/
|
|
738
|
-
export
|
|
739
|
-
export
|
|
740
|
-
|
|
738
|
+
export type MFAVerifyWebauthnParams<T extends 'create' | 'request' = 'create' | 'request'> = Prettify<MFAVerifyParamsBase & MFAVerifyWebauthnParamFields<T>>;
|
|
739
|
+
export type MFAVerifyParams = MFAVerifyTOTPParams | MFAVerifyPhoneParams | MFAVerifyWebauthnParams;
|
|
740
|
+
type MFAChallengeParamsBase = {
|
|
741
741
|
/** ID of the factor to be challenged. Returned in enroll(). */
|
|
742
742
|
factorId: string;
|
|
743
743
|
};
|
|
744
744
|
declare const MFATOTPChannels: readonly ["sms", "whatsapp"];
|
|
745
|
-
export
|
|
746
|
-
export
|
|
747
|
-
|
|
745
|
+
export type MFATOTPChannel = (typeof MFATOTPChannels)[number];
|
|
746
|
+
export type MFAChallengeTOTPParams = Prettify<MFAChallengeParamsBase>;
|
|
747
|
+
type MFAChallengePhoneParamFields<Channel extends MFATOTPChannel = MFATOTPChannel> = {
|
|
748
748
|
/** Messaging channel to use (e.g. whatsapp or sms). Only relevant for phone factors */
|
|
749
749
|
channel: Channel;
|
|
750
750
|
};
|
|
751
|
-
export
|
|
751
|
+
export type MFAChallengePhoneParams = Prettify<MFAChallengeParamsBase & MFAChallengePhoneParamFields>;
|
|
752
752
|
/** WebAuthn parameters for WebAuthn factor challenge */
|
|
753
|
-
|
|
753
|
+
type MFAChallengeWebauthnParamFields = {
|
|
754
754
|
webauthn: {
|
|
755
755
|
/** Relying party ID */
|
|
756
756
|
rpId: string;
|
|
@@ -763,17 +763,17 @@ declare type MFAChallengeWebauthnParamFields = {
|
|
|
763
763
|
* Includes Relying Party information needed for WebAuthn ceremonies.
|
|
764
764
|
* @see {@link https://w3c.github.io/webauthn/#sctn-rp-operations W3C WebAuthn Spec - Relying Party Operations}
|
|
765
765
|
*/
|
|
766
|
-
export
|
|
767
|
-
export
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
export
|
|
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
772
|
/**
|
|
773
773
|
* Data returned after successful MFA verification.
|
|
774
774
|
* Contains new session tokens and updated user information.
|
|
775
775
|
*/
|
|
776
|
-
export
|
|
776
|
+
export type AuthMFAVerifyResponseData = {
|
|
777
777
|
/** New access token (JWT) after successful verification. */
|
|
778
778
|
access_token: string;
|
|
779
779
|
/** Type of token, always `bearer`. */
|
|
@@ -789,13 +789,13 @@ export declare type AuthMFAVerifyResponseData = {
|
|
|
789
789
|
* Response type for MFA verification operations.
|
|
790
790
|
* Returns session tokens on successful verification.
|
|
791
791
|
*/
|
|
792
|
-
export
|
|
793
|
-
export
|
|
794
|
-
export
|
|
792
|
+
export type AuthMFAVerifyResponse = RequestResult<AuthMFAVerifyResponseData>;
|
|
793
|
+
export type AuthMFAEnrollResponse = AuthMFAEnrollTOTPResponse | AuthMFAEnrollPhoneResponse | AuthMFAEnrollWebauthnResponse;
|
|
794
|
+
export type AuthMFAUnenrollResponse = RequestResult<{
|
|
795
795
|
/** ID of the factor that was successfully unenrolled. */
|
|
796
796
|
id: string;
|
|
797
797
|
}>;
|
|
798
|
-
|
|
798
|
+
type AuthMFAChallengeResponseBase<T extends FactorType> = {
|
|
799
799
|
/** ID of the newly created challenge. */
|
|
800
800
|
id: string;
|
|
801
801
|
/** Factor Type which generated the challenge */
|
|
@@ -803,11 +803,11 @@ declare type AuthMFAChallengeResponseBase<T extends FactorType> = {
|
|
|
803
803
|
/** Timestamp in UNIX seconds when this challenge will no longer be usable. */
|
|
804
804
|
expires_at: number;
|
|
805
805
|
};
|
|
806
|
-
|
|
807
|
-
export
|
|
808
|
-
|
|
809
|
-
export
|
|
810
|
-
|
|
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
811
|
webauthn: {
|
|
812
812
|
type: 'create';
|
|
813
813
|
credential_options: {
|
|
@@ -825,8 +825,8 @@ declare type AuthMFAChallengeWebauthnResponseFields = {
|
|
|
825
825
|
* Contains credential creation or request options from the server.
|
|
826
826
|
* @see {@link https://w3c.github.io/webauthn/#sctn-credential-creation W3C WebAuthn Spec - Credential Creation}
|
|
827
827
|
*/
|
|
828
|
-
export
|
|
829
|
-
|
|
828
|
+
export type AuthMFAChallengeWebauthnResponse = RequestResult<Prettify<AuthMFAChallengeResponseBase<'webauthn'> & AuthMFAChallengeWebauthnResponseFields>>;
|
|
829
|
+
type AuthMFAChallengeWebauthnResponseFieldsJSON = {
|
|
830
830
|
webauthn: {
|
|
831
831
|
type: 'create';
|
|
832
832
|
credential_options: {
|
|
@@ -843,22 +843,22 @@ declare type AuthMFAChallengeWebauthnResponseFieldsJSON = {
|
|
|
843
843
|
* JSON-serializable version of WebAuthn challenge response.
|
|
844
844
|
* Used for server communication with base64url-encoded binary fields.
|
|
845
845
|
*/
|
|
846
|
-
export
|
|
846
|
+
export type AuthMFAChallengeWebauthnResponseDataJSON = Prettify<AuthMFAChallengeResponseBase<'webauthn'> & AuthMFAChallengeWebauthnResponseFieldsJSON>;
|
|
847
847
|
/**
|
|
848
848
|
* Server response type for WebAuthn MFA challenge.
|
|
849
849
|
* Contains JSON-formatted WebAuthn options ready for browser API.
|
|
850
850
|
*/
|
|
851
|
-
export
|
|
852
|
-
export
|
|
851
|
+
export type AuthMFAChallengeWebauthnServerResponse = RequestResult<AuthMFAChallengeWebauthnResponseDataJSON>;
|
|
852
|
+
export type AuthMFAChallengeResponse = AuthMFAChallengeTOTPResponse | AuthMFAChallengePhoneResponse | AuthMFAChallengeWebauthnResponse;
|
|
853
853
|
/** response of ListFactors, which should contain all the types of factors that are available, this ensures we always include all */
|
|
854
|
-
export
|
|
854
|
+
export type AuthMFAListFactorsResponse<T extends typeof FactorTypes = typeof FactorTypes> = RequestResult<{
|
|
855
855
|
/** All available factors (verified and unverified). */
|
|
856
856
|
all: Prettify<Factor>[];
|
|
857
857
|
} & {
|
|
858
858
|
[K in T[number]]: Prettify<Factor<K, 'verified'>>[];
|
|
859
859
|
}>;
|
|
860
|
-
export
|
|
861
|
-
export
|
|
860
|
+
export type AuthenticatorAssuranceLevels = 'aal1' | 'aal2';
|
|
861
|
+
export type AuthMFAGetAuthenticatorAssuranceLevelResponse = RequestResult<{
|
|
862
862
|
/** Current AAL level of the session. */
|
|
863
863
|
currentLevel: AuthenticatorAssuranceLevels | null;
|
|
864
864
|
/**
|
|
@@ -947,14 +947,14 @@ export interface GoTrueMFAApi {
|
|
|
947
947
|
/**
|
|
948
948
|
* @expermental
|
|
949
949
|
*/
|
|
950
|
-
export
|
|
950
|
+
export type AuthMFAAdminDeleteFactorResponse = RequestResult<{
|
|
951
951
|
/** ID of the factor that was successfully deleted. */
|
|
952
952
|
id: string;
|
|
953
953
|
}>;
|
|
954
954
|
/**
|
|
955
955
|
* @expermental
|
|
956
956
|
*/
|
|
957
|
-
export
|
|
957
|
+
export type AuthMFAAdminDeleteFactorParams = {
|
|
958
958
|
/** ID of the MFA factor to delete. */
|
|
959
959
|
id: string;
|
|
960
960
|
/** ID of the user whose factor is being deleted. */
|
|
@@ -963,14 +963,14 @@ export declare type AuthMFAAdminDeleteFactorParams = {
|
|
|
963
963
|
/**
|
|
964
964
|
* @expermental
|
|
965
965
|
*/
|
|
966
|
-
export
|
|
966
|
+
export type AuthMFAAdminListFactorsResponse = RequestResult<{
|
|
967
967
|
/** All factors attached to the user. */
|
|
968
968
|
factors: Factor[];
|
|
969
969
|
}>;
|
|
970
970
|
/**
|
|
971
971
|
* @expermental
|
|
972
972
|
*/
|
|
973
|
-
export
|
|
973
|
+
export type AuthMFAAdminListFactorsParams = {
|
|
974
974
|
/** ID of the user. */
|
|
975
975
|
userId: string;
|
|
976
976
|
};
|
|
@@ -995,12 +995,12 @@ export interface GoTrueAdminMFAApi {
|
|
|
995
995
|
*/
|
|
996
996
|
deleteFactor(params: AuthMFAAdminDeleteFactorParams): Promise<AuthMFAAdminDeleteFactorResponse>;
|
|
997
997
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
998
|
+
type AnyFunction = (...args: any[]) => any;
|
|
999
|
+
type MaybePromisify<T> = T | Promise<T>;
|
|
1000
|
+
type PromisifyMethods<T> = {
|
|
1001
1001
|
[K in keyof T]: T[K] extends AnyFunction ? (...args: Parameters<T[K]>) => MaybePromisify<ReturnType<T[K]>> : T[K];
|
|
1002
1002
|
};
|
|
1003
|
-
export
|
|
1003
|
+
export type SupportedStorage = PromisifyMethods<Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>> & {
|
|
1004
1004
|
/**
|
|
1005
1005
|
* If set to `true` signals to the library that the storage medium is used
|
|
1006
1006
|
* on a server and the values may not be authentic, such as reading from
|
|
@@ -1010,23 +1010,23 @@ export declare type SupportedStorage = PromisifyMethods<Pick<Storage, 'getItem'
|
|
|
1010
1010
|
*/
|
|
1011
1011
|
isServer?: boolean;
|
|
1012
1012
|
};
|
|
1013
|
-
export
|
|
1013
|
+
export type InitializeResult = {
|
|
1014
1014
|
error: AuthError | null;
|
|
1015
1015
|
};
|
|
1016
|
-
export
|
|
1017
|
-
export
|
|
1016
|
+
export type CallRefreshTokenResult = RequestResult<Session>;
|
|
1017
|
+
export type Pagination = {
|
|
1018
1018
|
[key: string]: any;
|
|
1019
1019
|
nextPage: number | null;
|
|
1020
1020
|
lastPage: number;
|
|
1021
1021
|
total: number;
|
|
1022
1022
|
};
|
|
1023
|
-
export
|
|
1023
|
+
export type PageParams = {
|
|
1024
1024
|
/** The page number */
|
|
1025
1025
|
page?: number;
|
|
1026
1026
|
/** Number of items returned per page */
|
|
1027
1027
|
perPage?: number;
|
|
1028
1028
|
};
|
|
1029
|
-
export
|
|
1029
|
+
export type SignOut = {
|
|
1030
1030
|
/**
|
|
1031
1031
|
* Determines which sessions should be
|
|
1032
1032
|
* logged out. Global means all
|
|
@@ -1039,30 +1039,30 @@ export declare type SignOut = {
|
|
|
1039
1039
|
*/
|
|
1040
1040
|
scope?: 'global' | 'local' | 'others';
|
|
1041
1041
|
};
|
|
1042
|
-
|
|
1042
|
+
type MFAEnrollParamsBase<T extends FactorType> = {
|
|
1043
1043
|
/** The type of factor being enrolled. */
|
|
1044
1044
|
factorType: T;
|
|
1045
1045
|
/** Human readable name assigned to the factor. */
|
|
1046
1046
|
friendlyName?: string;
|
|
1047
1047
|
};
|
|
1048
|
-
|
|
1048
|
+
type MFAEnrollTOTPParamFields = {
|
|
1049
1049
|
/** Domain which the user is enrolled with. */
|
|
1050
1050
|
issuer?: string;
|
|
1051
1051
|
};
|
|
1052
|
-
export
|
|
1053
|
-
|
|
1052
|
+
export type MFAEnrollTOTPParams = Prettify<MFAEnrollParamsBase<'totp'> & MFAEnrollTOTPParamFields>;
|
|
1053
|
+
type MFAEnrollPhoneParamFields = {
|
|
1054
1054
|
/** Phone number associated with a factor. Number should conform to E.164 format */
|
|
1055
1055
|
phone: string;
|
|
1056
1056
|
};
|
|
1057
|
-
export
|
|
1058
|
-
|
|
1057
|
+
export type MFAEnrollPhoneParams = Prettify<MFAEnrollParamsBase<'phone'> & MFAEnrollPhoneParamFields>;
|
|
1058
|
+
type MFAEnrollWebauthnFields = {};
|
|
1059
1059
|
/**
|
|
1060
1060
|
* Parameters for enrolling a WebAuthn factor.
|
|
1061
1061
|
* Creates an unverified WebAuthn factor that must be verified with a credential.
|
|
1062
1062
|
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
1063
1063
|
*/
|
|
1064
|
-
export
|
|
1065
|
-
|
|
1064
|
+
export type MFAEnrollWebauthnParams = Prettify<MFAEnrollParamsBase<'webauthn'> & MFAEnrollWebauthnFields>;
|
|
1065
|
+
type AuthMFAEnrollResponseBase<T extends FactorType> = {
|
|
1066
1066
|
/** ID of the factor that was just enrolled (in an unverified state). */
|
|
1067
1067
|
id: string;
|
|
1068
1068
|
/** Type of MFA factor.*/
|
|
@@ -1070,7 +1070,7 @@ declare type AuthMFAEnrollResponseBase<T extends FactorType> = {
|
|
|
1070
1070
|
/** Friendly name of the factor, useful for distinguishing between factors **/
|
|
1071
1071
|
friendly_name?: string;
|
|
1072
1072
|
};
|
|
1073
|
-
|
|
1073
|
+
type AuthMFAEnrollTOTPResponseFields = {
|
|
1074
1074
|
/** TOTP enrollment information. */
|
|
1075
1075
|
totp: {
|
|
1076
1076
|
/** Contains a QR code encoding the authenticator URI. You can
|
|
@@ -1086,25 +1086,25 @@ declare type AuthMFAEnrollTOTPResponseFields = {
|
|
|
1086
1086
|
uri: string;
|
|
1087
1087
|
};
|
|
1088
1088
|
};
|
|
1089
|
-
export
|
|
1090
|
-
|
|
1089
|
+
export type AuthMFAEnrollTOTPResponse = RequestResult<Prettify<AuthMFAEnrollResponseBase<'totp'> & AuthMFAEnrollTOTPResponseFields>>;
|
|
1090
|
+
type AuthMFAEnrollPhoneResponseFields = {
|
|
1091
1091
|
/** Phone number of the MFA factor in E.164 format. Used to send messages */
|
|
1092
1092
|
phone: string;
|
|
1093
1093
|
};
|
|
1094
|
-
export
|
|
1095
|
-
|
|
1094
|
+
export type AuthMFAEnrollPhoneResponse = RequestResult<Prettify<AuthMFAEnrollResponseBase<'phone'> & AuthMFAEnrollPhoneResponseFields>>;
|
|
1095
|
+
type AuthMFAEnrollWebauthnFields = {};
|
|
1096
1096
|
/**
|
|
1097
1097
|
* Response type for WebAuthn factor enrollment.
|
|
1098
1098
|
* Returns the enrolled factor ID and metadata.
|
|
1099
1099
|
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
1100
1100
|
*/
|
|
1101
|
-
export
|
|
1102
|
-
export
|
|
1101
|
+
export type AuthMFAEnrollWebauthnResponse = RequestResult<Prettify<AuthMFAEnrollResponseBase<'webauthn'> & AuthMFAEnrollWebauthnFields>>;
|
|
1102
|
+
export type JwtHeader = {
|
|
1103
1103
|
alg: 'RS256' | 'ES256' | 'HS256';
|
|
1104
1104
|
kid: string;
|
|
1105
1105
|
typ: string;
|
|
1106
1106
|
};
|
|
1107
|
-
export
|
|
1107
|
+
export type RequiredClaims = {
|
|
1108
1108
|
iss: string;
|
|
1109
1109
|
sub: string;
|
|
1110
1110
|
aud: string | string[];
|
|
@@ -1114,7 +1114,7 @@ export declare type RequiredClaims = {
|
|
|
1114
1114
|
aal: AuthenticatorAssuranceLevels;
|
|
1115
1115
|
session_id: string;
|
|
1116
1116
|
};
|
|
1117
|
-
export
|
|
1117
|
+
export type JwtPayload = RequiredClaims & {
|
|
1118
1118
|
[key: string]: any;
|
|
1119
1119
|
};
|
|
1120
1120
|
export interface JWK {
|
|
@@ -1125,6 +1125,138 @@ export interface JWK {
|
|
|
1125
1125
|
[key: string]: any;
|
|
1126
1126
|
}
|
|
1127
1127
|
export declare const SIGN_OUT_SCOPES: readonly ["global", "local", "others"];
|
|
1128
|
-
export
|
|
1128
|
+
export type SignOutScope = (typeof SIGN_OUT_SCOPES)[number];
|
|
1129
|
+
/**
|
|
1130
|
+
* OAuth client grant types supported by the OAuth 2.1 server.
|
|
1131
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1132
|
+
*/
|
|
1133
|
+
export type OAuthClientGrantType = 'authorization_code' | 'refresh_token';
|
|
1134
|
+
/**
|
|
1135
|
+
* OAuth client response types supported by the OAuth 2.1 server.
|
|
1136
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1137
|
+
*/
|
|
1138
|
+
export type OAuthClientResponseType = 'code';
|
|
1139
|
+
/**
|
|
1140
|
+
* OAuth client type indicating whether the client can keep credentials confidential.
|
|
1141
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1142
|
+
*/
|
|
1143
|
+
export type OAuthClientType = 'public' | 'confidential';
|
|
1144
|
+
/**
|
|
1145
|
+
* OAuth client registration type.
|
|
1146
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1147
|
+
*/
|
|
1148
|
+
export type OAuthClientRegistrationType = 'dynamic' | 'manual';
|
|
1149
|
+
/**
|
|
1150
|
+
* OAuth client object returned from the OAuth 2.1 server.
|
|
1151
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1152
|
+
*/
|
|
1153
|
+
export type OAuthClient = {
|
|
1154
|
+
/** Unique identifier for the OAuth client */
|
|
1155
|
+
client_id: string;
|
|
1156
|
+
/** Human-readable name of the OAuth client */
|
|
1157
|
+
client_name: string;
|
|
1158
|
+
/** Client secret (only returned on registration and regeneration) */
|
|
1159
|
+
client_secret?: string;
|
|
1160
|
+
/** Type of OAuth client */
|
|
1161
|
+
client_type: OAuthClientType;
|
|
1162
|
+
/** Token endpoint authentication method */
|
|
1163
|
+
token_endpoint_auth_method: string;
|
|
1164
|
+
/** Registration type of the client */
|
|
1165
|
+
registration_type: OAuthClientRegistrationType;
|
|
1166
|
+
/** URI of the OAuth client */
|
|
1167
|
+
client_uri?: string;
|
|
1168
|
+
/** Array of allowed redirect URIs */
|
|
1169
|
+
redirect_uris: string[];
|
|
1170
|
+
/** Array of allowed grant types */
|
|
1171
|
+
grant_types: OAuthClientGrantType[];
|
|
1172
|
+
/** Array of allowed response types */
|
|
1173
|
+
response_types: OAuthClientResponseType[];
|
|
1174
|
+
/** Scope of the OAuth client */
|
|
1175
|
+
scope?: string;
|
|
1176
|
+
/** Timestamp when the client was created */
|
|
1177
|
+
created_at: string;
|
|
1178
|
+
/** Timestamp when the client was last updated */
|
|
1179
|
+
updated_at: string;
|
|
1180
|
+
};
|
|
1181
|
+
/**
|
|
1182
|
+
* Parameters for creating a new OAuth client.
|
|
1183
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1184
|
+
*/
|
|
1185
|
+
export type CreateOAuthClientParams = {
|
|
1186
|
+
/** Human-readable name of the OAuth client */
|
|
1187
|
+
client_name: string;
|
|
1188
|
+
/** URI of the OAuth client */
|
|
1189
|
+
client_uri?: string;
|
|
1190
|
+
/** Array of allowed redirect URIs */
|
|
1191
|
+
redirect_uris: string[];
|
|
1192
|
+
/** Array of allowed grant types (optional, defaults to authorization_code and refresh_token) */
|
|
1193
|
+
grant_types?: OAuthClientGrantType[];
|
|
1194
|
+
/** Array of allowed response types (optional, defaults to code) */
|
|
1195
|
+
response_types?: OAuthClientResponseType[];
|
|
1196
|
+
/** Scope of the OAuth client */
|
|
1197
|
+
scope?: string;
|
|
1198
|
+
};
|
|
1199
|
+
/**
|
|
1200
|
+
* Response type for OAuth client operations.
|
|
1201
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1202
|
+
*/
|
|
1203
|
+
export type OAuthClientResponse = RequestResult<OAuthClient>;
|
|
1204
|
+
/**
|
|
1205
|
+
* Response type for listing OAuth clients.
|
|
1206
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1207
|
+
*/
|
|
1208
|
+
export type OAuthClientListResponse = {
|
|
1209
|
+
data: {
|
|
1210
|
+
clients: OAuthClient[];
|
|
1211
|
+
aud: string;
|
|
1212
|
+
} & Pagination;
|
|
1213
|
+
error: null;
|
|
1214
|
+
} | {
|
|
1215
|
+
data: {
|
|
1216
|
+
clients: [];
|
|
1217
|
+
};
|
|
1218
|
+
error: AuthError;
|
|
1219
|
+
};
|
|
1220
|
+
/**
|
|
1221
|
+
* Contains all OAuth client administration methods.
|
|
1222
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1223
|
+
*/
|
|
1224
|
+
export interface GoTrueAdminOAuthApi {
|
|
1225
|
+
/**
|
|
1226
|
+
* Lists all OAuth clients with optional pagination.
|
|
1227
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1228
|
+
*
|
|
1229
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1230
|
+
*/
|
|
1231
|
+
listClients(params?: PageParams): Promise<OAuthClientListResponse>;
|
|
1232
|
+
/**
|
|
1233
|
+
* Creates a new OAuth client.
|
|
1234
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1235
|
+
*
|
|
1236
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1237
|
+
*/
|
|
1238
|
+
createClient(params: CreateOAuthClientParams): Promise<OAuthClientResponse>;
|
|
1239
|
+
/**
|
|
1240
|
+
* Gets details of a specific OAuth client.
|
|
1241
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1242
|
+
*
|
|
1243
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1244
|
+
*/
|
|
1245
|
+
getClient(clientId: string): Promise<OAuthClientResponse>;
|
|
1246
|
+
/**
|
|
1247
|
+
* Deletes an OAuth client.
|
|
1248
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1249
|
+
*
|
|
1250
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1251
|
+
*/
|
|
1252
|
+
deleteClient(clientId: string): Promise<OAuthClientResponse>;
|
|
1253
|
+
/**
|
|
1254
|
+
* Regenerates the secret for an OAuth client.
|
|
1255
|
+
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1256
|
+
*
|
|
1257
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1258
|
+
*/
|
|
1259
|
+
regenerateClientSecret(clientId: string): Promise<OAuthClientResponse>;
|
|
1260
|
+
}
|
|
1129
1261
|
export {};
|
|
1130
1262
|
//# sourceMappingURL=types.d.ts.map
|