@depup/supabase__auth-js 2.103.0-depup.0 → 2.110.8-depup.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/AGENTS.md +11 -0
- package/README.md +2 -2
- package/changes.json +1 -1
- package/dist/main/GoTrueAdminApi.d.ts +45 -8
- package/dist/main/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/main/GoTrueAdminApi.js +67 -7
- package/dist/main/GoTrueAdminApi.js.map +1 -1
- package/dist/main/GoTrueClient.d.ts +239 -42
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +946 -164
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/constants.d.ts +8 -0
- package/dist/main/lib/constants.d.ts.map +1 -1
- package/dist/main/lib/constants.js +9 -1
- package/dist/main/lib/constants.js.map +1 -1
- package/dist/main/lib/errors.d.ts +42 -3
- package/dist/main/lib/errors.d.ts.map +1 -1
- package/dist/main/lib/errors.js +44 -13
- package/dist/main/lib/errors.js.map +1 -1
- package/dist/main/lib/fetch.d.ts +28 -8
- package/dist/main/lib/fetch.d.ts.map +1 -1
- package/dist/main/lib/fetch.js +28 -6
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +4 -1
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +15 -4
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/locks.d.ts +29 -35
- package/dist/main/lib/locks.d.ts.map +1 -1
- package/dist/main/lib/locks.js +37 -38
- package/dist/main/lib/locks.js.map +1 -1
- package/dist/main/lib/types.d.ts +305 -64
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/types.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/lib/webauthn.d.ts +8 -0
- package/dist/main/lib/webauthn.d.ts.map +1 -1
- package/dist/main/lib/webauthn.dom.d.ts +3 -3
- package/dist/main/lib/webauthn.dom.d.ts.map +1 -1
- package/dist/main/lib/webauthn.errors.d.ts +5 -0
- package/dist/main/lib/webauthn.errors.d.ts.map +1 -1
- package/dist/main/lib/webauthn.errors.js +7 -0
- package/dist/main/lib/webauthn.errors.js.map +1 -1
- package/dist/main/lib/webauthn.js +1 -0
- package/dist/main/lib/webauthn.js.map +1 -1
- package/dist/module/GoTrueAdminApi.d.ts +45 -8
- package/dist/module/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/module/GoTrueAdminApi.js +68 -8
- package/dist/module/GoTrueAdminApi.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts +239 -42
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +951 -169
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/constants.d.ts +8 -0
- package/dist/module/lib/constants.d.ts.map +1 -1
- package/dist/module/lib/constants.js +8 -0
- package/dist/module/lib/constants.js.map +1 -1
- package/dist/module/lib/errors.d.ts +42 -3
- package/dist/module/lib/errors.d.ts.map +1 -1
- package/dist/module/lib/errors.js +41 -12
- package/dist/module/lib/errors.js.map +1 -1
- package/dist/module/lib/fetch.d.ts +28 -8
- package/dist/module/lib/fetch.d.ts.map +1 -1
- package/dist/module/lib/fetch.js +28 -6
- package/dist/module/lib/fetch.js.map +1 -1
- package/dist/module/lib/helpers.d.ts +4 -1
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js +14 -4
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/locks.d.ts +29 -35
- package/dist/module/lib/locks.d.ts.map +1 -1
- package/dist/module/lib/locks.js +37 -38
- package/dist/module/lib/locks.js.map +1 -1
- package/dist/module/lib/types.d.ts +305 -64
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/types.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/lib/webauthn.d.ts +8 -0
- package/dist/module/lib/webauthn.d.ts.map +1 -1
- package/dist/module/lib/webauthn.dom.d.ts +3 -3
- package/dist/module/lib/webauthn.dom.d.ts.map +1 -1
- package/dist/module/lib/webauthn.errors.d.ts +5 -0
- package/dist/module/lib/webauthn.errors.d.ts.map +1 -1
- package/dist/module/lib/webauthn.errors.js +7 -0
- 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/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/README.md +25 -0
- package/migrations/lockless-coordination.md +155 -0
- package/package.json +25 -12
- package/src/GoTrueAdminApi.ts +99 -7
- package/src/GoTrueClient.ts +1117 -181
- package/src/lib/constants.ts +9 -0
- package/src/lib/errors.ts +76 -9
- package/src/lib/fetch.ts +66 -24
- package/src/lib/helpers.ts +19 -6
- package/src/lib/locks.ts +44 -42
- package/src/lib/types.ts +374 -82
- package/src/lib/version.ts +1 -1
- package/src/lib/webauthn.dom.ts +3 -3
- package/src/lib/webauthn.errors.ts +12 -0
- package/src/lib/webauthn.ts +1 -1
package/dist/main/lib/types.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { AuthError } from './errors';
|
|
|
2
2
|
import { Fetch } from './fetch';
|
|
3
3
|
import { EIP1193Provider, EthereumSignInInput, Hex } from './web3/ethereum';
|
|
4
4
|
import type { SolanaSignInInput, SolanaSignInOutput } from './web3/solana';
|
|
5
|
-
import { ServerCredentialCreationOptions, ServerCredentialRequestOptions, WebAuthnApi } from './webauthn';
|
|
5
|
+
import { ServerCredentialCreationOptions, ServerCredentialRequestOptions, WebAuthnApi, WebAuthnError } from './webauthn';
|
|
6
|
+
import type { RegistrationResponseJSON, AuthenticationResponseJSON, ServerCredentialResponse } from './webauthn';
|
|
6
7
|
import { AuthenticationCredential, PublicKeyCredentialCreationOptionsFuture, PublicKeyCredentialRequestOptionsFuture, RegistrationCredential } from './webauthn.dom';
|
|
7
8
|
/** One of the providers supported by GoTrue. Use the `custom:` prefix for custom OIDC providers (e.g. `custom:my-oidc-provider`). */
|
|
8
9
|
export type Provider = 'apple' | 'azure' | 'bitbucket' | 'discord' | 'facebook' | 'figma' | 'github' | 'gitlab' | 'google' | 'kakao' | 'keycloak' | 'linkedin' | 'linkedin_oidc' | 'notion' | 'slack' | 'slack_oidc' | 'spotify' | 'twitch'
|
|
@@ -72,12 +73,17 @@ export type GoTrueClientOptions = {
|
|
|
72
73
|
flowType?: AuthFlowType;
|
|
73
74
|
debug?: boolean | ((message: string, ...args: any[]) => void);
|
|
74
75
|
/**
|
|
75
|
-
* Provide your own locking mechanism based on the environment. By default
|
|
76
|
-
*
|
|
77
|
-
* `
|
|
78
|
-
*
|
|
76
|
+
* Provide your own locking mechanism based on the environment. By default
|
|
77
|
+
* the client coordinates refreshes itself (single-flight via
|
|
78
|
+
* `refreshingDeferred` + commit guard) and relies on the GoTrue server to
|
|
79
|
+
* resolve cross-tab refresh races. Passing a custom lock opts into a
|
|
80
|
+
* legacy path that wraps every auth operation in your supplied lock — this
|
|
81
|
+
* path is preserved for backwards compatibility (typically React Native
|
|
82
|
+
* `processLock` or Node multi-process setups).
|
|
79
83
|
*
|
|
80
|
-
* @
|
|
84
|
+
* @deprecated Custom locks still work in v2.x for backwards compatibility.
|
|
85
|
+
* The legacy lock path will be removed in v3 — drop this option from your
|
|
86
|
+
* constructor options before upgrading.
|
|
81
87
|
*/
|
|
82
88
|
lock?: LockFunc;
|
|
83
89
|
/**
|
|
@@ -91,30 +97,14 @@ export type GoTrueClientOptions = {
|
|
|
91
97
|
*/
|
|
92
98
|
throwOnError?: boolean;
|
|
93
99
|
/**
|
|
94
|
-
* The maximum time in milliseconds to wait for acquiring
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* via the Web Locks API to prevent race conditions during session refresh and other operations.
|
|
98
|
-
* This timeout controls how long to wait before attempting lock recovery.
|
|
99
|
-
*
|
|
100
|
-
* - **Positive value**: Wait up to this many milliseconds. If the lock is still held, attempt
|
|
101
|
-
* automatic recovery by stealing it (the previous holder is evicted, its callback continues
|
|
102
|
-
* to completion without exclusive access). This recovers from orphaned locks caused by
|
|
103
|
-
* React Strict Mode double-mount, storage API hangs, or aborted operations.
|
|
104
|
-
* - **Zero (0)**: Fail immediately if the lock is unavailable; throws `LockAcquireTimeoutError`
|
|
105
|
-
* (check `error.isAcquireTimeout === true`).
|
|
106
|
-
* - **Negative value**: Wait indefinitely — can cause permanent deadlocks if the lock is orphaned.
|
|
100
|
+
* The maximum time in milliseconds to wait for acquiring the custom lock
|
|
101
|
+
* supplied via the `lock` option. Only consulted when a custom `lock` is
|
|
102
|
+
* passed — the default lockless path doesn't use this timeout.
|
|
107
103
|
*
|
|
108
104
|
* @default 5000
|
|
109
105
|
*
|
|
110
|
-
* @
|
|
111
|
-
*
|
|
112
|
-
* const client = createClient(url, key, {
|
|
113
|
-
* auth: {
|
|
114
|
-
* lockAcquireTimeout: 5000, // 5 seconds, then steal orphaned lock
|
|
115
|
-
* },
|
|
116
|
-
* })
|
|
117
|
-
* ```
|
|
106
|
+
* @deprecated Only used by the legacy lock path. Will be removed in v3
|
|
107
|
+
* along with the `lock` option.
|
|
118
108
|
*/
|
|
119
109
|
lockAcquireTimeout?: number;
|
|
120
110
|
/**
|
|
@@ -125,6 +115,25 @@ export type GoTrueClientOptions = {
|
|
|
125
115
|
* @default false
|
|
126
116
|
*/
|
|
127
117
|
skipAutoInitialize?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Opt-in flags for experimental features. These APIs may change without
|
|
120
|
+
* notice and are disabled by default.
|
|
121
|
+
*
|
|
122
|
+
* @experimental
|
|
123
|
+
*/
|
|
124
|
+
experimental?: ExperimentalFeatureFlags;
|
|
125
|
+
};
|
|
126
|
+
export type ExperimentalFeatureFlags = {
|
|
127
|
+
/**
|
|
128
|
+
* Enables passkey support:
|
|
129
|
+
* - `auth.signInWithPasskey()`, `auth.registerPasskey()`
|
|
130
|
+
* - `auth.passkey.*`
|
|
131
|
+
* - `auth.admin.passkey.*`
|
|
132
|
+
*
|
|
133
|
+
* Defaults to `false`. Calling any passkey method while this flag is
|
|
134
|
+
* disabled throws a descriptive error at call time.
|
|
135
|
+
*/
|
|
136
|
+
passkey?: boolean;
|
|
128
137
|
};
|
|
129
138
|
declare const WeakPasswordReasons: readonly ["length", "characters", "pwned"];
|
|
130
139
|
export type WeakPasswordReasons = (typeof WeakPasswordReasons)[number];
|
|
@@ -157,7 +166,7 @@ export type RequestResult<T, ErrorType extends Error = AuthError> = {
|
|
|
157
166
|
};
|
|
158
167
|
/**
|
|
159
168
|
* similar to RequestResult except it allows you to destructure the possible shape of the success response
|
|
160
|
-
* {@
|
|
169
|
+
* {@link RequestResult}
|
|
161
170
|
*/
|
|
162
171
|
export type RequestResultSafeDestructure<T> = {
|
|
163
172
|
data: T;
|
|
@@ -180,7 +189,7 @@ export type AuthResponsePassword = RequestResultSafeDestructure<{
|
|
|
180
189
|
/**
|
|
181
190
|
* AuthOtpResponse is returned when OTP is used.
|
|
182
191
|
*
|
|
183
|
-
* {@
|
|
192
|
+
* {@link AuthResponse}
|
|
184
193
|
*/
|
|
185
194
|
export type AuthOtpResponse = RequestResultSafeDestructure<{
|
|
186
195
|
user: null;
|
|
@@ -304,7 +313,7 @@ type FactorVerificationStatus = (typeof FactorVerificationStatuses)[number];
|
|
|
304
313
|
*
|
|
305
314
|
* @see {@link GoTrueMFAApi#enroll}
|
|
306
315
|
* @see {@link GoTrueMFAApi#listFactors}
|
|
307
|
-
* @see {@link
|
|
316
|
+
* @see {@link GoTrueAdminMFAApi#listFactors}
|
|
308
317
|
*/
|
|
309
318
|
export type Factor<Type extends FactorType = FactorType, Status extends FactorVerificationStatus = (typeof FactorVerificationStatuses)[number]> = {
|
|
310
319
|
/** ID of the factor. */
|
|
@@ -495,14 +504,14 @@ export type SignInAnonymouslyCredentials = {
|
|
|
495
504
|
captchaToken?: string;
|
|
496
505
|
};
|
|
497
506
|
};
|
|
498
|
-
export type SignUpWithPasswordCredentials =
|
|
507
|
+
export type SignUpWithPasswordCredentials = PasswordCredentialsBase & {
|
|
499
508
|
options?: {
|
|
500
509
|
emailRedirectTo?: string;
|
|
501
510
|
data?: object;
|
|
502
511
|
captchaToken?: string;
|
|
503
512
|
channel?: 'sms' | 'whatsapp';
|
|
504
513
|
};
|
|
505
|
-
}
|
|
514
|
+
};
|
|
506
515
|
type PasswordCredentialsBase = {
|
|
507
516
|
email: string;
|
|
508
517
|
password: string;
|
|
@@ -550,7 +559,7 @@ export type SignInWithPasswordlessCredentials = {
|
|
|
550
559
|
channel?: 'sms' | 'whatsapp';
|
|
551
560
|
};
|
|
552
561
|
};
|
|
553
|
-
export type AuthFlowType = 'implicit' | 'pkce';
|
|
562
|
+
export type AuthFlowType = 'implicit' | 'pkce' | (string & {});
|
|
554
563
|
export type SignInWithOAuthCredentials = {
|
|
555
564
|
/** One of the providers supported by GoTrue. */
|
|
556
565
|
provider: Provider;
|
|
@@ -680,8 +689,8 @@ export interface VerifyTokenHashParams {
|
|
|
680
689
|
/** The user's verification type. */
|
|
681
690
|
type: EmailOtpType;
|
|
682
691
|
}
|
|
683
|
-
export type MobileOtpType = 'sms' | 'phone_change';
|
|
684
|
-
export type EmailOtpType = 'signup' | 'invite' | 'magiclink' | 'recovery' | 'email_change' | 'email';
|
|
692
|
+
export type MobileOtpType = 'sms' | 'phone_change' | (string & {});
|
|
693
|
+
export type EmailOtpType = 'signup' | 'invite' | 'magiclink' | 'recovery' | 'email_change' | 'email' | (string & {});
|
|
685
694
|
export type ResendParams = {
|
|
686
695
|
type: Extract<EmailOtpType, 'signup' | 'email_change'>;
|
|
687
696
|
email: string;
|
|
@@ -810,9 +819,9 @@ type MFAVerifyTOTPParamFields = {
|
|
|
810
819
|
/** Verification code provided by the user. */
|
|
811
820
|
code: string;
|
|
812
821
|
};
|
|
813
|
-
export type MFAVerifyTOTPParams =
|
|
822
|
+
export type MFAVerifyTOTPParams = MFAVerifyParamsBase & MFAVerifyTOTPParamFields;
|
|
814
823
|
type MFAVerifyPhoneParamFields = MFAVerifyTOTPParamFields;
|
|
815
|
-
export type MFAVerifyPhoneParams =
|
|
824
|
+
export type MFAVerifyPhoneParams = MFAVerifyParamsBase & MFAVerifyPhoneParamFields;
|
|
816
825
|
type MFAVerifyWebauthnParamFieldsBase = {
|
|
817
826
|
/** Relying party ID */
|
|
818
827
|
rpId: string;
|
|
@@ -839,7 +848,7 @@ export type MFAVerifyWebauthnParamFields<T extends 'create' | 'request' = 'creat
|
|
|
839
848
|
* @template T - Type of WebAuthn operation: 'create' for registration, 'request' for authentication
|
|
840
849
|
* @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying an Authentication Assertion}
|
|
841
850
|
*/
|
|
842
|
-
export type MFAVerifyWebauthnParams<T extends 'create' | 'request' = 'create' | 'request'> =
|
|
851
|
+
export type MFAVerifyWebauthnParams<T extends 'create' | 'request' = 'create' | 'request'> = MFAVerifyParamsBase & MFAVerifyWebauthnParamFields<T>;
|
|
843
852
|
export type MFAVerifyParams = MFAVerifyTOTPParams | MFAVerifyPhoneParams | MFAVerifyWebauthnParams;
|
|
844
853
|
type MFAChallengeParamsBase = {
|
|
845
854
|
/** ID of the factor to be challenged. Returned in enroll(). */
|
|
@@ -847,12 +856,12 @@ type MFAChallengeParamsBase = {
|
|
|
847
856
|
};
|
|
848
857
|
declare const MFATOTPChannels: readonly ["sms", "whatsapp"];
|
|
849
858
|
export type MFATOTPChannel = (typeof MFATOTPChannels)[number];
|
|
850
|
-
export type MFAChallengeTOTPParams =
|
|
859
|
+
export type MFAChallengeTOTPParams = MFAChallengeParamsBase;
|
|
851
860
|
type MFAChallengePhoneParamFields<Channel extends MFATOTPChannel = MFATOTPChannel> = {
|
|
852
861
|
/** Messaging channel to use (e.g. whatsapp or sms). Only relevant for phone factors */
|
|
853
862
|
channel: Channel;
|
|
854
863
|
};
|
|
855
|
-
export type MFAChallengePhoneParams =
|
|
864
|
+
export type MFAChallengePhoneParams = MFAChallengeParamsBase & MFAChallengePhoneParamFields;
|
|
856
865
|
/** WebAuthn parameters for WebAuthn factor challenge */
|
|
857
866
|
type MFAChallengeWebauthnParamFields = {
|
|
858
867
|
webauthn: {
|
|
@@ -867,11 +876,11 @@ type MFAChallengeWebauthnParamFields = {
|
|
|
867
876
|
* Includes Relying Party information needed for WebAuthn ceremonies.
|
|
868
877
|
* @see {@link https://w3c.github.io/webauthn/#sctn-rp-operations W3C WebAuthn Spec - Relying Party Operations}
|
|
869
878
|
*/
|
|
870
|
-
export type MFAChallengeWebauthnParams =
|
|
879
|
+
export type MFAChallengeWebauthnParams = MFAChallengeParamsBase & MFAChallengeWebauthnParamFields;
|
|
871
880
|
export type MFAChallengeParams = MFAChallengeTOTPParams | MFAChallengePhoneParams | MFAChallengeWebauthnParams;
|
|
872
881
|
type MFAChallengeAndVerifyParamsBase = Omit<MFAVerifyParamsBase, 'challengeId'>;
|
|
873
882
|
type MFAChallengeAndVerifyTOTPParamFields = MFAVerifyTOTPParamFields;
|
|
874
|
-
type MFAChallengeAndVerifyTOTPParams =
|
|
883
|
+
type MFAChallengeAndVerifyTOTPParams = MFAChallengeAndVerifyParamsBase & MFAChallengeAndVerifyTOTPParamFields;
|
|
875
884
|
export type MFAChallengeAndVerifyParams = MFAChallengeAndVerifyTOTPParams;
|
|
876
885
|
/**
|
|
877
886
|
* Data returned after successful MFA verification.
|
|
@@ -908,9 +917,9 @@ type AuthMFAChallengeResponseBase<T extends FactorType> = {
|
|
|
908
917
|
expires_at: number;
|
|
909
918
|
};
|
|
910
919
|
type AuthMFAChallengeTOTPResponseFields = {};
|
|
911
|
-
export type AuthMFAChallengeTOTPResponse = RequestResult<
|
|
920
|
+
export type AuthMFAChallengeTOTPResponse = RequestResult<AuthMFAChallengeResponseBase<'totp'> & AuthMFAChallengeTOTPResponseFields>;
|
|
912
921
|
type AuthMFAChallengePhoneResponseFields = {};
|
|
913
|
-
export type AuthMFAChallengePhoneResponse = RequestResult<
|
|
922
|
+
export type AuthMFAChallengePhoneResponse = RequestResult<AuthMFAChallengeResponseBase<'phone'> & AuthMFAChallengePhoneResponseFields>;
|
|
914
923
|
type AuthMFAChallengeWebauthnResponseFields = {
|
|
915
924
|
webauthn: {
|
|
916
925
|
type: 'create';
|
|
@@ -929,7 +938,7 @@ type AuthMFAChallengeWebauthnResponseFields = {
|
|
|
929
938
|
* Contains credential creation or request options from the server.
|
|
930
939
|
* @see {@link https://w3c.github.io/webauthn/#sctn-credential-creation W3C WebAuthn Spec - Credential Creation}
|
|
931
940
|
*/
|
|
932
|
-
export type AuthMFAChallengeWebauthnResponse = RequestResult<
|
|
941
|
+
export type AuthMFAChallengeWebauthnResponse = RequestResult<AuthMFAChallengeResponseBase<'webauthn'> & AuthMFAChallengeWebauthnResponseFields>;
|
|
933
942
|
type AuthMFAChallengeWebauthnResponseFieldsJSON = {
|
|
934
943
|
webauthn: {
|
|
935
944
|
type: 'create';
|
|
@@ -947,7 +956,7 @@ type AuthMFAChallengeWebauthnResponseFieldsJSON = {
|
|
|
947
956
|
* JSON-serializable version of WebAuthn challenge response.
|
|
948
957
|
* Used for server communication with base64url-encoded binary fields.
|
|
949
958
|
*/
|
|
950
|
-
export type AuthMFAChallengeWebauthnResponseDataJSON =
|
|
959
|
+
export type AuthMFAChallengeWebauthnResponseDataJSON = AuthMFAChallengeResponseBase<'webauthn'> & AuthMFAChallengeWebauthnResponseFieldsJSON;
|
|
951
960
|
/**
|
|
952
961
|
* Server response type for WebAuthn MFA challenge.
|
|
953
962
|
* Contains JSON-formatted WebAuthn options ready for browser API.
|
|
@@ -957,11 +966,11 @@ export type AuthMFAChallengeResponse = AuthMFAChallengeTOTPResponse | AuthMFACha
|
|
|
957
966
|
/** response of ListFactors, which should contain all the types of factors that are available, this ensures we always include all */
|
|
958
967
|
export type AuthMFAListFactorsResponse<T extends typeof FactorTypes = typeof FactorTypes> = RequestResult<{
|
|
959
968
|
/** All available factors (verified and unverified). */
|
|
960
|
-
all:
|
|
969
|
+
all: Factor[];
|
|
961
970
|
} & {
|
|
962
|
-
[K in T[number]]:
|
|
971
|
+
[K in T[number]]: Factor<K, 'verified'>[];
|
|
963
972
|
}>;
|
|
964
|
-
export type AuthenticatorAssuranceLevels = 'aal1' | 'aal2';
|
|
973
|
+
export type AuthenticatorAssuranceLevels = 'aal1' | 'aal2' | (string & {});
|
|
965
974
|
export type AuthMFAGetAuthenticatorAssuranceLevelResponse = RequestResult<{
|
|
966
975
|
/** Current AAL level of the session. */
|
|
967
976
|
currentLevel: AuthenticatorAssuranceLevels | null;
|
|
@@ -998,6 +1007,7 @@ export interface GoTrueMFAApi {
|
|
|
998
1007
|
* Upon verifying a factor, all other sessions are logged out and the current session's authenticator level is promoted to `aal2`.
|
|
999
1008
|
*
|
|
1000
1009
|
* @category Auth
|
|
1010
|
+
* @subcategory Auth MFA
|
|
1001
1011
|
*
|
|
1002
1012
|
* @remarks
|
|
1003
1013
|
* - Use `totp` or `phone` as the `factorType` and use the returned `id` to create a challenge.
|
|
@@ -1077,6 +1087,7 @@ export interface GoTrueMFAApi {
|
|
|
1077
1087
|
* factor.
|
|
1078
1088
|
*
|
|
1079
1089
|
* @category Auth
|
|
1090
|
+
* @subcategory Auth MFA
|
|
1080
1091
|
*
|
|
1081
1092
|
* @remarks
|
|
1082
1093
|
* - An [enrolled factor](/docs/reference/javascript/auth-mfa-enroll) is required before creating a challenge.
|
|
@@ -1149,6 +1160,7 @@ export interface GoTrueMFAApi {
|
|
|
1149
1160
|
* provided by the user by entering a code seen in their authenticator app.
|
|
1150
1161
|
*
|
|
1151
1162
|
* @category Auth
|
|
1163
|
+
* @subcategory Auth MFA
|
|
1152
1164
|
*
|
|
1153
1165
|
* @remarks
|
|
1154
1166
|
* - To verify a challenge, please [create a challenge](/docs/reference/javascript/auth-mfa-challenge) first.
|
|
@@ -1231,6 +1243,7 @@ export interface GoTrueMFAApi {
|
|
|
1231
1243
|
* A user has to have an `aal2` authenticator level in order to unenroll a `verified` factor.
|
|
1232
1244
|
*
|
|
1233
1245
|
* @category Auth
|
|
1246
|
+
* @subcategory Auth MFA
|
|
1234
1247
|
*
|
|
1235
1248
|
* @example Unenroll a factor
|
|
1236
1249
|
* ```js
|
|
@@ -1255,6 +1268,7 @@ export interface GoTrueMFAApi {
|
|
|
1255
1268
|
* provided by the user by entering a code seen in their authenticator app.
|
|
1256
1269
|
*
|
|
1257
1270
|
* @category Auth
|
|
1271
|
+
* @subcategory Auth MFA
|
|
1258
1272
|
*
|
|
1259
1273
|
* @remarks
|
|
1260
1274
|
* - Intended for use with only TOTP factors.
|
|
@@ -1339,6 +1353,7 @@ export interface GoTrueMFAApi {
|
|
|
1339
1353
|
*
|
|
1340
1354
|
*
|
|
1341
1355
|
* @category Auth
|
|
1356
|
+
* @subcategory Auth MFA
|
|
1342
1357
|
*/
|
|
1343
1358
|
listFactors(): Promise<AuthMFAListFactorsResponse>;
|
|
1344
1359
|
/**
|
|
@@ -1357,6 +1372,7 @@ export interface GoTrueMFAApi {
|
|
|
1357
1372
|
* @param jwt Takes in an optional access token JWT. If no JWT is provided, the JWT from the current session is used.
|
|
1358
1373
|
*
|
|
1359
1374
|
* @category Auth
|
|
1375
|
+
* @subcategory Auth MFA
|
|
1360
1376
|
*
|
|
1361
1377
|
* @remarks
|
|
1362
1378
|
* - Authenticator Assurance Level (AAL) is the measure of the strength of an authentication mechanism.
|
|
@@ -1396,14 +1412,14 @@ export interface GoTrueMFAApi {
|
|
|
1396
1412
|
webauthn: WebAuthnApi;
|
|
1397
1413
|
}
|
|
1398
1414
|
/**
|
|
1399
|
-
* @
|
|
1415
|
+
* @experimental
|
|
1400
1416
|
*/
|
|
1401
1417
|
export type AuthMFAAdminDeleteFactorResponse = RequestResult<{
|
|
1402
1418
|
/** ID of the factor that was successfully deleted. */
|
|
1403
1419
|
id: string;
|
|
1404
1420
|
}>;
|
|
1405
1421
|
/**
|
|
1406
|
-
* @
|
|
1422
|
+
* @experimental
|
|
1407
1423
|
*/
|
|
1408
1424
|
export type AuthMFAAdminDeleteFactorParams = {
|
|
1409
1425
|
/** ID of the MFA factor to delete. */
|
|
@@ -1412,14 +1428,14 @@ export type AuthMFAAdminDeleteFactorParams = {
|
|
|
1412
1428
|
userId: string;
|
|
1413
1429
|
};
|
|
1414
1430
|
/**
|
|
1415
|
-
* @
|
|
1431
|
+
* @experimental
|
|
1416
1432
|
*/
|
|
1417
1433
|
export type AuthMFAAdminListFactorsResponse = RequestResult<{
|
|
1418
1434
|
/** All factors attached to the user. */
|
|
1419
1435
|
factors: Factor[];
|
|
1420
1436
|
}>;
|
|
1421
1437
|
/**
|
|
1422
|
-
* @
|
|
1438
|
+
* @experimental
|
|
1423
1439
|
*/
|
|
1424
1440
|
export type AuthMFAAdminListFactorsParams = {
|
|
1425
1441
|
/** ID of the user. */
|
|
@@ -1428,7 +1444,7 @@ export type AuthMFAAdminListFactorsParams = {
|
|
|
1428
1444
|
/**
|
|
1429
1445
|
* Contains the full multi-factor authentication administration API.
|
|
1430
1446
|
*
|
|
1431
|
-
* @
|
|
1447
|
+
* @experimental
|
|
1432
1448
|
*/
|
|
1433
1449
|
export interface GoTrueAdminMFAApi {
|
|
1434
1450
|
/**
|
|
@@ -1436,6 +1452,7 @@ export interface GoTrueAdminMFAApi {
|
|
|
1436
1452
|
*
|
|
1437
1453
|
*
|
|
1438
1454
|
* @category Auth
|
|
1455
|
+
* @subcategory Auth Admin
|
|
1439
1456
|
*
|
|
1440
1457
|
* @example List all factors for a user
|
|
1441
1458
|
* ```js
|
|
@@ -1468,9 +1485,10 @@ export interface GoTrueAdminMFAApi {
|
|
|
1468
1485
|
*
|
|
1469
1486
|
* @see {@link GoTrueMFAApi#unenroll}
|
|
1470
1487
|
*
|
|
1471
|
-
* @
|
|
1488
|
+
* @experimental
|
|
1472
1489
|
*
|
|
1473
1490
|
* @category Auth
|
|
1491
|
+
* @subcategory Auth Admin
|
|
1474
1492
|
*
|
|
1475
1493
|
* @example Delete a factor for a user
|
|
1476
1494
|
* ```js
|
|
@@ -1546,19 +1564,19 @@ type MFAEnrollTOTPParamFields = {
|
|
|
1546
1564
|
/** Domain which the user is enrolled with. */
|
|
1547
1565
|
issuer?: string;
|
|
1548
1566
|
};
|
|
1549
|
-
export type MFAEnrollTOTPParams =
|
|
1567
|
+
export type MFAEnrollTOTPParams = MFAEnrollParamsBase<'totp'> & MFAEnrollTOTPParamFields;
|
|
1550
1568
|
type MFAEnrollPhoneParamFields = {
|
|
1551
1569
|
/** Phone number associated with a factor. Number should conform to E.164 format */
|
|
1552
1570
|
phone: string;
|
|
1553
1571
|
};
|
|
1554
|
-
export type MFAEnrollPhoneParams =
|
|
1572
|
+
export type MFAEnrollPhoneParams = MFAEnrollParamsBase<'phone'> & MFAEnrollPhoneParamFields;
|
|
1555
1573
|
type MFAEnrollWebauthnFields = {};
|
|
1556
1574
|
/**
|
|
1557
1575
|
* Parameters for enrolling a WebAuthn factor.
|
|
1558
1576
|
* Creates an unverified WebAuthn factor that must be verified with a credential.
|
|
1559
1577
|
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
1560
1578
|
*/
|
|
1561
|
-
export type MFAEnrollWebauthnParams =
|
|
1579
|
+
export type MFAEnrollWebauthnParams = MFAEnrollParamsBase<'webauthn'> & MFAEnrollWebauthnFields;
|
|
1562
1580
|
type AuthMFAEnrollResponseBase<T extends FactorType> = {
|
|
1563
1581
|
/** ID of the factor that was just enrolled (in an unverified state). */
|
|
1564
1582
|
id: string;
|
|
@@ -1583,21 +1601,21 @@ type AuthMFAEnrollTOTPResponseFields = {
|
|
|
1583
1601
|
uri: string;
|
|
1584
1602
|
};
|
|
1585
1603
|
};
|
|
1586
|
-
export type AuthMFAEnrollTOTPResponse = RequestResult<
|
|
1604
|
+
export type AuthMFAEnrollTOTPResponse = RequestResult<AuthMFAEnrollResponseBase<'totp'> & AuthMFAEnrollTOTPResponseFields>;
|
|
1587
1605
|
type AuthMFAEnrollPhoneResponseFields = {
|
|
1588
1606
|
/** Phone number of the MFA factor in E.164 format. Used to send messages */
|
|
1589
1607
|
phone: string;
|
|
1590
1608
|
};
|
|
1591
|
-
export type AuthMFAEnrollPhoneResponse = RequestResult<
|
|
1609
|
+
export type AuthMFAEnrollPhoneResponse = RequestResult<AuthMFAEnrollResponseBase<'phone'> & AuthMFAEnrollPhoneResponseFields>;
|
|
1592
1610
|
type AuthMFAEnrollWebauthnFields = {};
|
|
1593
1611
|
/**
|
|
1594
1612
|
* Response type for WebAuthn factor enrollment.
|
|
1595
1613
|
* Returns the enrolled factor ID and metadata.
|
|
1596
1614
|
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
1597
1615
|
*/
|
|
1598
|
-
export type AuthMFAEnrollWebauthnResponse = RequestResult<
|
|
1616
|
+
export type AuthMFAEnrollWebauthnResponse = RequestResult<AuthMFAEnrollResponseBase<'webauthn'> & AuthMFAEnrollWebauthnFields>;
|
|
1599
1617
|
export type JwtHeader = {
|
|
1600
|
-
alg: 'RS256' | 'ES256' | 'HS256';
|
|
1618
|
+
alg: 'RS256' | 'ES256' | 'HS256' | (string & {});
|
|
1601
1619
|
kid: string;
|
|
1602
1620
|
typ: string;
|
|
1603
1621
|
};
|
|
@@ -1638,7 +1656,7 @@ export interface JwtPayload extends RequiredClaims {
|
|
|
1638
1656
|
[key: string]: any;
|
|
1639
1657
|
}
|
|
1640
1658
|
export interface JWK {
|
|
1641
|
-
kty: 'RSA' | 'EC' | 'oct';
|
|
1659
|
+
kty: 'RSA' | 'EC' | 'oct' | (string & {});
|
|
1642
1660
|
key_ops: string[];
|
|
1643
1661
|
alg?: string;
|
|
1644
1662
|
kid?: string;
|
|
@@ -1650,7 +1668,7 @@ export type SignOutScope = (typeof SIGN_OUT_SCOPES)[number];
|
|
|
1650
1668
|
* OAuth client grant types supported by the OAuth 2.1 server.
|
|
1651
1669
|
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1652
1670
|
*/
|
|
1653
|
-
export type OAuthClientGrantType = 'authorization_code' | 'refresh_token';
|
|
1671
|
+
export type OAuthClientGrantType = 'authorization_code' | 'refresh_token' | (string & {});
|
|
1654
1672
|
/**
|
|
1655
1673
|
* OAuth client response types supported by the OAuth 2.1 server.
|
|
1656
1674
|
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
@@ -1777,6 +1795,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
1777
1795
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1778
1796
|
*
|
|
1779
1797
|
* @category Auth
|
|
1798
|
+
* @subcategory OAuth Admin
|
|
1780
1799
|
*/
|
|
1781
1800
|
listClients(params?: PageParams): Promise<OAuthClientListResponse>;
|
|
1782
1801
|
/**
|
|
@@ -1786,6 +1805,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
1786
1805
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1787
1806
|
*
|
|
1788
1807
|
* @category Auth
|
|
1808
|
+
* @subcategory OAuth Admin
|
|
1789
1809
|
*/
|
|
1790
1810
|
createClient(params: CreateOAuthClientParams): Promise<OAuthClientResponse>;
|
|
1791
1811
|
/**
|
|
@@ -1795,6 +1815,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
1795
1815
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1796
1816
|
*
|
|
1797
1817
|
* @category Auth
|
|
1818
|
+
* @subcategory OAuth Admin
|
|
1798
1819
|
*/
|
|
1799
1820
|
getClient(clientId: string): Promise<OAuthClientResponse>;
|
|
1800
1821
|
/**
|
|
@@ -1804,6 +1825,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
1804
1825
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1805
1826
|
*
|
|
1806
1827
|
* @category Auth
|
|
1828
|
+
* @subcategory OAuth Admin
|
|
1807
1829
|
*/
|
|
1808
1830
|
updateClient(clientId: string, params: UpdateOAuthClientParams): Promise<OAuthClientResponse>;
|
|
1809
1831
|
/**
|
|
@@ -1813,6 +1835,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
1813
1835
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1814
1836
|
*
|
|
1815
1837
|
* @category Auth
|
|
1838
|
+
* @subcategory OAuth Admin
|
|
1816
1839
|
*/
|
|
1817
1840
|
deleteClient(clientId: string): Promise<{
|
|
1818
1841
|
data: null;
|
|
@@ -1825,6 +1848,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
1825
1848
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
1826
1849
|
*
|
|
1827
1850
|
* @category Auth
|
|
1851
|
+
* @subcategory OAuth Admin
|
|
1828
1852
|
*/
|
|
1829
1853
|
regenerateClientSecret(clientId: string): Promise<OAuthClientResponse>;
|
|
1830
1854
|
}
|
|
@@ -1877,6 +1901,14 @@ export type CustomOAuthProvider = {
|
|
|
1877
1901
|
acceptable_client_ids?: string[];
|
|
1878
1902
|
/** OAuth scopes requested during authorization */
|
|
1879
1903
|
scopes?: string[];
|
|
1904
|
+
/**
|
|
1905
|
+
* Allowlist of raw identity provider claim keys to copy verbatim into the
|
|
1906
|
+
* user's `custom_claims` field (within `identity_data` and
|
|
1907
|
+
* `raw_user_meta_data`), e.g. `["groups", "org_id", "mail"]`. This is an
|
|
1908
|
+
* opt-in allowlist that defaults to empty (no claims captured) and operates
|
|
1909
|
+
* independently from `attribute_mapping`.
|
|
1910
|
+
*/
|
|
1911
|
+
custom_claims_allowlist?: string[];
|
|
1880
1912
|
/** Whether PKCE is enabled */
|
|
1881
1913
|
pkce_enabled?: boolean;
|
|
1882
1914
|
/** Mapping of provider attributes to Supabase user attributes */
|
|
@@ -1926,6 +1958,14 @@ export type CreateCustomProviderParams = {
|
|
|
1926
1958
|
acceptable_client_ids?: string[];
|
|
1927
1959
|
/** OAuth scopes requested during authorization */
|
|
1928
1960
|
scopes?: string[];
|
|
1961
|
+
/**
|
|
1962
|
+
* Allowlist of raw identity provider claim keys to copy verbatim into the
|
|
1963
|
+
* user's `custom_claims` field (within `identity_data` and
|
|
1964
|
+
* `raw_user_meta_data`), e.g. `["groups", "org_id", "mail"]`. This is an
|
|
1965
|
+
* opt-in allowlist that defaults to empty (no claims captured) and operates
|
|
1966
|
+
* independently from `attribute_mapping`.
|
|
1967
|
+
*/
|
|
1968
|
+
custom_claims_allowlist?: string[];
|
|
1929
1969
|
/** Whether PKCE is enabled */
|
|
1930
1970
|
pkce_enabled?: boolean;
|
|
1931
1971
|
/** Mapping of provider attributes to Supabase user attributes */
|
|
@@ -1967,6 +2007,14 @@ export type UpdateCustomProviderParams = {
|
|
|
1967
2007
|
acceptable_client_ids?: string[];
|
|
1968
2008
|
/** OAuth scopes requested during authorization */
|
|
1969
2009
|
scopes?: string[];
|
|
2010
|
+
/**
|
|
2011
|
+
* Allowlist of raw identity provider claim keys to copy verbatim into the
|
|
2012
|
+
* user's `custom_claims` field (within `identity_data` and
|
|
2013
|
+
* `raw_user_meta_data`), e.g. `["groups", "org_id", "mail"]`. This is an
|
|
2014
|
+
* opt-in allowlist that defaults to empty (no claims captured) and operates
|
|
2015
|
+
* independently from `attribute_mapping`.
|
|
2016
|
+
*/
|
|
2017
|
+
custom_claims_allowlist?: string[];
|
|
1970
2018
|
/** Whether PKCE is enabled */
|
|
1971
2019
|
pkce_enabled?: boolean;
|
|
1972
2020
|
/** Mapping of provider attributes to Supabase user attributes */
|
|
@@ -2025,6 +2073,9 @@ export interface GoTrueAdminCustomProvidersApi {
|
|
|
2025
2073
|
* Lists all custom providers with optional type filter.
|
|
2026
2074
|
*
|
|
2027
2075
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2076
|
+
*
|
|
2077
|
+
* @category Auth
|
|
2078
|
+
* @subcategory Auth Admin
|
|
2028
2079
|
*/
|
|
2029
2080
|
listProviders(params?: ListCustomProvidersParams): Promise<CustomProviderListResponse>;
|
|
2030
2081
|
/**
|
|
@@ -2037,12 +2088,18 @@ export interface GoTrueAdminCustomProvidersApi {
|
|
|
2037
2088
|
* in the document does not match the expected issuer.
|
|
2038
2089
|
*
|
|
2039
2090
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2091
|
+
*
|
|
2092
|
+
* @category Auth
|
|
2093
|
+
* @subcategory Auth Admin
|
|
2040
2094
|
*/
|
|
2041
2095
|
createProvider(params: CreateCustomProviderParams): Promise<CustomProviderResponse>;
|
|
2042
2096
|
/**
|
|
2043
2097
|
* Gets details of a specific custom provider by identifier.
|
|
2044
2098
|
*
|
|
2045
2099
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2100
|
+
*
|
|
2101
|
+
* @category Auth
|
|
2102
|
+
* @subcategory Auth Admin
|
|
2046
2103
|
*/
|
|
2047
2104
|
getProvider(identifier: string): Promise<CustomProviderResponse>;
|
|
2048
2105
|
/**
|
|
@@ -2054,12 +2111,18 @@ export interface GoTrueAdminCustomProvidersApi {
|
|
|
2054
2111
|
* the issuer does not match.
|
|
2055
2112
|
*
|
|
2056
2113
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2114
|
+
*
|
|
2115
|
+
* @category Auth
|
|
2116
|
+
* @subcategory Auth Admin
|
|
2057
2117
|
*/
|
|
2058
2118
|
updateProvider(identifier: string, params: UpdateCustomProviderParams): Promise<CustomProviderResponse>;
|
|
2059
2119
|
/**
|
|
2060
2120
|
* Deletes a custom provider.
|
|
2061
2121
|
*
|
|
2062
2122
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2123
|
+
*
|
|
2124
|
+
* @category Auth
|
|
2125
|
+
* @subcategory Auth Admin
|
|
2063
2126
|
*/
|
|
2064
2127
|
deleteProvider(identifier: string): Promise<{
|
|
2065
2128
|
data: null;
|
|
@@ -2204,6 +2267,7 @@ export interface AuthOAuthServerApi {
|
|
|
2204
2267
|
* @returns Authorization details or redirect URL depending on consent status
|
|
2205
2268
|
*
|
|
2206
2269
|
* @category Auth
|
|
2270
|
+
* @subcategory OAuth Server
|
|
2207
2271
|
*/
|
|
2208
2272
|
getAuthorizationDetails(authorizationId: string): Promise<AuthOAuthAuthorizationDetailsResponse>;
|
|
2209
2273
|
/**
|
|
@@ -2219,6 +2283,7 @@ export interface AuthOAuthServerApi {
|
|
|
2219
2283
|
* @returns Redirect URL to send the user back to the OAuth client with authorization code
|
|
2220
2284
|
*
|
|
2221
2285
|
* @category Auth
|
|
2286
|
+
* @subcategory OAuth Server
|
|
2222
2287
|
*/
|
|
2223
2288
|
approveAuthorization(authorizationId: string, options?: {
|
|
2224
2289
|
skipBrowserRedirect?: boolean;
|
|
@@ -2236,6 +2301,7 @@ export interface AuthOAuthServerApi {
|
|
|
2236
2301
|
* @returns Redirect URL to send the user back to the OAuth client with error information
|
|
2237
2302
|
*
|
|
2238
2303
|
* @category Auth
|
|
2304
|
+
* @subcategory OAuth Server
|
|
2239
2305
|
*/
|
|
2240
2306
|
denyAuthorization(authorizationId: string, options?: {
|
|
2241
2307
|
skipBrowserRedirect?: boolean;
|
|
@@ -2247,6 +2313,7 @@ export interface AuthOAuthServerApi {
|
|
|
2247
2313
|
* @returns Response with array of OAuth grants with client information and granted scopes
|
|
2248
2314
|
*
|
|
2249
2315
|
* @category Auth
|
|
2316
|
+
* @subcategory OAuth Server
|
|
2250
2317
|
*/
|
|
2251
2318
|
listGrants(): Promise<AuthOAuthGrantsResponse>;
|
|
2252
2319
|
/**
|
|
@@ -2261,10 +2328,184 @@ export interface AuthOAuthServerApi {
|
|
|
2261
2328
|
* @returns Empty response on successful revocation
|
|
2262
2329
|
*
|
|
2263
2330
|
* @category Auth
|
|
2331
|
+
* @subcategory OAuth Server
|
|
2264
2332
|
*/
|
|
2265
2333
|
revokeGrant(options: {
|
|
2266
2334
|
clientId: string;
|
|
2267
2335
|
}): Promise<AuthOAuthRevokeGrantResponse>;
|
|
2268
2336
|
}
|
|
2337
|
+
/** Response from POST /passkeys/registration/options */
|
|
2338
|
+
export type PasskeyRegistrationOptionsResponse = {
|
|
2339
|
+
challenge_id: string;
|
|
2340
|
+
options: ServerCredentialCreationOptions;
|
|
2341
|
+
expires_at: number;
|
|
2342
|
+
};
|
|
2343
|
+
/** Request body for POST /passkeys/registration/verify */
|
|
2344
|
+
export type PasskeyRegistrationVerifyParams = {
|
|
2345
|
+
challenge_id: string;
|
|
2346
|
+
credential: RegistrationResponseJSON;
|
|
2347
|
+
};
|
|
2348
|
+
/** Response from POST /passkeys/registration/verify */
|
|
2349
|
+
export type PasskeyMetadata = {
|
|
2350
|
+
id: string;
|
|
2351
|
+
friendly_name?: string;
|
|
2352
|
+
created_at: string;
|
|
2353
|
+
};
|
|
2354
|
+
/** Response from POST /passkeys/authentication/options */
|
|
2355
|
+
export type PasskeyAuthenticationOptionsResponse = {
|
|
2356
|
+
challenge_id: string;
|
|
2357
|
+
options: ServerCredentialRequestOptions;
|
|
2358
|
+
expires_at: number;
|
|
2359
|
+
};
|
|
2360
|
+
/** Request body for POST /passkeys/authentication/verify */
|
|
2361
|
+
export type PasskeyAuthenticationVerifyParams = {
|
|
2362
|
+
challenge_id: string;
|
|
2363
|
+
credential: AuthenticationResponseJSON;
|
|
2364
|
+
};
|
|
2365
|
+
/** Item in the passkeys list (GET /passkeys/ and admin list) */
|
|
2366
|
+
export type PasskeyListItem = {
|
|
2367
|
+
id: string;
|
|
2368
|
+
friendly_name?: string;
|
|
2369
|
+
created_at: string;
|
|
2370
|
+
last_used_at?: string;
|
|
2371
|
+
};
|
|
2372
|
+
export type SignInWithPasskeyCredentials = {
|
|
2373
|
+
options?: {
|
|
2374
|
+
captchaToken?: string;
|
|
2375
|
+
signal?: AbortSignal;
|
|
2376
|
+
};
|
|
2377
|
+
};
|
|
2378
|
+
export type RegisterPasskeyCredentials = {
|
|
2379
|
+
options?: {
|
|
2380
|
+
signal?: AbortSignal;
|
|
2381
|
+
};
|
|
2382
|
+
};
|
|
2383
|
+
export type VerifyPasskeyRegistrationParams = {
|
|
2384
|
+
/** Challenge ID from startRegistration */
|
|
2385
|
+
challengeId: string;
|
|
2386
|
+
/** Serialized credential from navigator.credentials.create() */
|
|
2387
|
+
credential: ServerCredentialResponse;
|
|
2388
|
+
};
|
|
2389
|
+
export type StartPasskeyAuthenticationParams = {
|
|
2390
|
+
options?: {
|
|
2391
|
+
captchaToken?: string;
|
|
2392
|
+
};
|
|
2393
|
+
};
|
|
2394
|
+
export type VerifyPasskeyAuthenticationParams = {
|
|
2395
|
+
/** Challenge ID from startAuthentication */
|
|
2396
|
+
challengeId: string;
|
|
2397
|
+
/** Serialized credential from navigator.credentials.get() */
|
|
2398
|
+
credential: ServerCredentialResponse;
|
|
2399
|
+
};
|
|
2400
|
+
export type PasskeyUpdateParams = {
|
|
2401
|
+
/** UUID of the passkey to update */
|
|
2402
|
+
passkeyId: string;
|
|
2403
|
+
/** New friendly name (max 120 chars) */
|
|
2404
|
+
friendlyName: string;
|
|
2405
|
+
};
|
|
2406
|
+
export type PasskeyDeleteParams = {
|
|
2407
|
+
/** UUID of the passkey to delete */
|
|
2408
|
+
passkeyId: string;
|
|
2409
|
+
};
|
|
2410
|
+
export type AuthPasskeyRegistrationOptionsResponse = RequestResult<PasskeyRegistrationOptionsResponse>;
|
|
2411
|
+
export type AuthPasskeyRegistrationVerifyResponse = RequestResult<PasskeyMetadata, WebAuthnError | AuthError>;
|
|
2412
|
+
export type AuthPasskeyAuthenticationOptionsResponse = RequestResult<PasskeyAuthenticationOptionsResponse>;
|
|
2413
|
+
export type AuthPasskeyAuthenticationVerifyResponse = RequestResult<{
|
|
2414
|
+
session: Session | null;
|
|
2415
|
+
user: User | null;
|
|
2416
|
+
}, WebAuthnError | AuthError>;
|
|
2417
|
+
export type AuthPasskeyListResponse = RequestResult<PasskeyListItem[]>;
|
|
2418
|
+
export type AuthPasskeyUpdateResponse = RequestResult<PasskeyListItem>;
|
|
2419
|
+
export type AuthPasskeyDeleteResponse = RequestResult<null>;
|
|
2420
|
+
export type AuthPasskeyAdminListParams = {
|
|
2421
|
+
userId: string;
|
|
2422
|
+
};
|
|
2423
|
+
export type AuthPasskeyAdminDeleteParams = {
|
|
2424
|
+
userId: string;
|
|
2425
|
+
passkeyId: string;
|
|
2426
|
+
};
|
|
2427
|
+
/**
|
|
2428
|
+
* Lower-level two-step API and management methods for passkeys.
|
|
2429
|
+
* Access via `supabase.auth.passkey`.
|
|
2430
|
+
*/
|
|
2431
|
+
export interface AuthPasskeyApi {
|
|
2432
|
+
/**
|
|
2433
|
+
* Starts the passkey registration ceremony. Fetches a registration challenge
|
|
2434
|
+
* and credential creation options from the server. Used as the first step of
|
|
2435
|
+
* a two-step registration flow when the caller wants to handle
|
|
2436
|
+
* `navigator.credentials.create()` themselves.
|
|
2437
|
+
*
|
|
2438
|
+
* @category Auth
|
|
2439
|
+
* @subcategory Auth Passkey
|
|
2440
|
+
*/
|
|
2441
|
+
startRegistration(): Promise<AuthPasskeyRegistrationOptionsResponse>;
|
|
2442
|
+
/**
|
|
2443
|
+
* Verifies a passkey registration credential against a previously issued
|
|
2444
|
+
* challenge. Used as the second step of a two-step registration flow.
|
|
2445
|
+
*
|
|
2446
|
+
* @category Auth
|
|
2447
|
+
* @subcategory Auth Passkey
|
|
2448
|
+
*/
|
|
2449
|
+
verifyRegistration(params: VerifyPasskeyRegistrationParams): Promise<AuthPasskeyRegistrationVerifyResponse>;
|
|
2450
|
+
/**
|
|
2451
|
+
* Starts the passkey authentication ceremony. Fetches an authentication
|
|
2452
|
+
* challenge and credential request options from the server. Used as the
|
|
2453
|
+
* first step of a two-step sign-in flow when the caller wants to handle
|
|
2454
|
+
* `navigator.credentials.get()` themselves.
|
|
2455
|
+
*
|
|
2456
|
+
* @category Auth
|
|
2457
|
+
* @subcategory Auth Passkey
|
|
2458
|
+
*/
|
|
2459
|
+
startAuthentication(params?: StartPasskeyAuthenticationParams): Promise<AuthPasskeyAuthenticationOptionsResponse>;
|
|
2460
|
+
/**
|
|
2461
|
+
* Verifies a passkey authentication credential against a previously issued
|
|
2462
|
+
* challenge. Used as the second step of a two-step sign-in flow.
|
|
2463
|
+
*
|
|
2464
|
+
* @category Auth
|
|
2465
|
+
* @subcategory Auth Passkey
|
|
2466
|
+
*/
|
|
2467
|
+
verifyAuthentication(params: VerifyPasskeyAuthenticationParams): Promise<AuthPasskeyAuthenticationVerifyResponse>;
|
|
2468
|
+
/**
|
|
2469
|
+
* Lists all passkeys registered for the currently signed-in user.
|
|
2470
|
+
*
|
|
2471
|
+
* @category Auth
|
|
2472
|
+
* @subcategory Auth Passkey
|
|
2473
|
+
*/
|
|
2474
|
+
list(): Promise<AuthPasskeyListResponse>;
|
|
2475
|
+
/**
|
|
2476
|
+
* Updates a passkey's friendly name.
|
|
2477
|
+
*
|
|
2478
|
+
* @category Auth
|
|
2479
|
+
* @subcategory Auth Passkey
|
|
2480
|
+
*/
|
|
2481
|
+
update(params: PasskeyUpdateParams): Promise<AuthPasskeyUpdateResponse>;
|
|
2482
|
+
/**
|
|
2483
|
+
* Deletes a passkey for the currently signed-in user.
|
|
2484
|
+
*
|
|
2485
|
+
* @category Auth
|
|
2486
|
+
* @subcategory Auth Passkey
|
|
2487
|
+
*/
|
|
2488
|
+
delete(params: PasskeyDeleteParams): Promise<AuthPasskeyDeleteResponse>;
|
|
2489
|
+
}
|
|
2490
|
+
export interface GoTrueAdminPasskeyApi {
|
|
2491
|
+
/**
|
|
2492
|
+
* Lists all passkeys registered for a specific user.
|
|
2493
|
+
*
|
|
2494
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2495
|
+
*
|
|
2496
|
+
* @category Auth
|
|
2497
|
+
* @subcategory Passkey Admin
|
|
2498
|
+
*/
|
|
2499
|
+
listPasskeys(params: AuthPasskeyAdminListParams): Promise<AuthPasskeyListResponse>;
|
|
2500
|
+
/**
|
|
2501
|
+
* Deletes a specific passkey for a specific user.
|
|
2502
|
+
*
|
|
2503
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2504
|
+
*
|
|
2505
|
+
* @category Auth
|
|
2506
|
+
* @subcategory Passkey Admin
|
|
2507
|
+
*/
|
|
2508
|
+
deletePasskey(params: AuthPasskeyAdminDeleteParams): Promise<AuthPasskeyDeleteResponse>;
|
|
2509
|
+
}
|
|
2269
2510
|
export {};
|
|
2270
2511
|
//# sourceMappingURL=types.d.ts.map
|