@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/src/lib/types.ts
CHANGED
|
@@ -6,6 +6,12 @@ import {
|
|
|
6
6
|
ServerCredentialCreationOptions,
|
|
7
7
|
ServerCredentialRequestOptions,
|
|
8
8
|
WebAuthnApi,
|
|
9
|
+
WebAuthnError,
|
|
10
|
+
} from './webauthn'
|
|
11
|
+
import type {
|
|
12
|
+
RegistrationResponseJSON,
|
|
13
|
+
AuthenticationResponseJSON,
|
|
14
|
+
ServerCredentialResponse,
|
|
9
15
|
} from './webauthn'
|
|
10
16
|
import {
|
|
11
17
|
AuthenticationCredential,
|
|
@@ -120,12 +126,17 @@ export type GoTrueClientOptions = {
|
|
|
120
126
|
/* If debug messages are emitted. Can be used to inspect the behavior of the library. If set to a function, the provided function will be used instead of `console.log()` to perform the logging. */
|
|
121
127
|
debug?: boolean | ((message: string, ...args: any[]) => void)
|
|
122
128
|
/**
|
|
123
|
-
* Provide your own locking mechanism based on the environment. By default
|
|
124
|
-
*
|
|
125
|
-
* `
|
|
126
|
-
*
|
|
129
|
+
* Provide your own locking mechanism based on the environment. By default
|
|
130
|
+
* the client coordinates refreshes itself (single-flight via
|
|
131
|
+
* `refreshingDeferred` + commit guard) and relies on the GoTrue server to
|
|
132
|
+
* resolve cross-tab refresh races. Passing a custom lock opts into a
|
|
133
|
+
* legacy path that wraps every auth operation in your supplied lock — this
|
|
134
|
+
* path is preserved for backwards compatibility (typically React Native
|
|
135
|
+
* `processLock` or Node multi-process setups).
|
|
127
136
|
*
|
|
128
|
-
* @
|
|
137
|
+
* @deprecated Custom locks still work in v2.x for backwards compatibility.
|
|
138
|
+
* The legacy lock path will be removed in v3 — drop this option from your
|
|
139
|
+
* constructor options before upgrading.
|
|
129
140
|
*/
|
|
130
141
|
lock?: LockFunc
|
|
131
142
|
/**
|
|
@@ -139,30 +150,14 @@ export type GoTrueClientOptions = {
|
|
|
139
150
|
*/
|
|
140
151
|
throwOnError?: boolean
|
|
141
152
|
/**
|
|
142
|
-
* The maximum time in milliseconds to wait for acquiring
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* via the Web Locks API to prevent race conditions during session refresh and other operations.
|
|
146
|
-
* This timeout controls how long to wait before attempting lock recovery.
|
|
147
|
-
*
|
|
148
|
-
* - **Positive value**: Wait up to this many milliseconds. If the lock is still held, attempt
|
|
149
|
-
* automatic recovery by stealing it (the previous holder is evicted, its callback continues
|
|
150
|
-
* to completion without exclusive access). This recovers from orphaned locks caused by
|
|
151
|
-
* React Strict Mode double-mount, storage API hangs, or aborted operations.
|
|
152
|
-
* - **Zero (0)**: Fail immediately if the lock is unavailable; throws `LockAcquireTimeoutError`
|
|
153
|
-
* (check `error.isAcquireTimeout === true`).
|
|
154
|
-
* - **Negative value**: Wait indefinitely — can cause permanent deadlocks if the lock is orphaned.
|
|
153
|
+
* The maximum time in milliseconds to wait for acquiring the custom lock
|
|
154
|
+
* supplied via the `lock` option. Only consulted when a custom `lock` is
|
|
155
|
+
* passed — the default lockless path doesn't use this timeout.
|
|
155
156
|
*
|
|
156
157
|
* @default 5000
|
|
157
158
|
*
|
|
158
|
-
* @
|
|
159
|
-
*
|
|
160
|
-
* const client = createClient(url, key, {
|
|
161
|
-
* auth: {
|
|
162
|
-
* lockAcquireTimeout: 5000, // 5 seconds, then steal orphaned lock
|
|
163
|
-
* },
|
|
164
|
-
* })
|
|
165
|
-
* ```
|
|
159
|
+
* @deprecated Only used by the legacy lock path. Will be removed in v3
|
|
160
|
+
* along with the `lock` option.
|
|
166
161
|
*/
|
|
167
162
|
lockAcquireTimeout?: number
|
|
168
163
|
|
|
@@ -174,6 +169,27 @@ export type GoTrueClientOptions = {
|
|
|
174
169
|
* @default false
|
|
175
170
|
*/
|
|
176
171
|
skipAutoInitialize?: boolean
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Opt-in flags for experimental features. These APIs may change without
|
|
175
|
+
* notice and are disabled by default.
|
|
176
|
+
*
|
|
177
|
+
* @experimental
|
|
178
|
+
*/
|
|
179
|
+
experimental?: ExperimentalFeatureFlags
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export type ExperimentalFeatureFlags = {
|
|
183
|
+
/**
|
|
184
|
+
* Enables passkey support:
|
|
185
|
+
* - `auth.signInWithPasskey()`, `auth.registerPasskey()`
|
|
186
|
+
* - `auth.passkey.*`
|
|
187
|
+
* - `auth.admin.passkey.*`
|
|
188
|
+
*
|
|
189
|
+
* Defaults to `false`. Calling any passkey method while this flag is
|
|
190
|
+
* disabled throws a descriptive error at call time.
|
|
191
|
+
*/
|
|
192
|
+
passkey?: boolean
|
|
177
193
|
}
|
|
178
194
|
|
|
179
195
|
const WeakPasswordReasons = ['length', 'characters', 'pwned'] as const
|
|
@@ -212,7 +228,7 @@ export type RequestResult<T, ErrorType extends Error = AuthError> =
|
|
|
212
228
|
|
|
213
229
|
/**
|
|
214
230
|
* similar to RequestResult except it allows you to destructure the possible shape of the success response
|
|
215
|
-
* {@
|
|
231
|
+
* {@link RequestResult}
|
|
216
232
|
*/
|
|
217
233
|
export type RequestResultSafeDestructure<T> =
|
|
218
234
|
| { data: T; error: null }
|
|
@@ -235,7 +251,7 @@ export type AuthResponsePassword = RequestResultSafeDestructure<{
|
|
|
235
251
|
/**
|
|
236
252
|
* AuthOtpResponse is returned when OTP is used.
|
|
237
253
|
*
|
|
238
|
-
* {@
|
|
254
|
+
* {@link AuthResponse}
|
|
239
255
|
*/
|
|
240
256
|
export type AuthOtpResponse = RequestResultSafeDestructure<{
|
|
241
257
|
user: null
|
|
@@ -391,7 +407,7 @@ type FactorVerificationStatus = (typeof FactorVerificationStatuses)[number]
|
|
|
391
407
|
*
|
|
392
408
|
* @see {@link GoTrueMFAApi#enroll}
|
|
393
409
|
* @see {@link GoTrueMFAApi#listFactors}
|
|
394
|
-
* @see {@link
|
|
410
|
+
* @see {@link GoTrueAdminMFAApi#listFactors}
|
|
395
411
|
*/
|
|
396
412
|
export type Factor<
|
|
397
413
|
Type extends FactorType = FactorType,
|
|
@@ -609,16 +625,14 @@ export type SignInAnonymouslyCredentials = {
|
|
|
609
625
|
}
|
|
610
626
|
}
|
|
611
627
|
|
|
612
|
-
export type SignUpWithPasswordCredentials =
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
channel?: 'sms' | 'whatsapp' // only for phone
|
|
619
|
-
}
|
|
628
|
+
export type SignUpWithPasswordCredentials = PasswordCredentialsBase & {
|
|
629
|
+
options?: {
|
|
630
|
+
emailRedirectTo?: string // only for email
|
|
631
|
+
data?: object
|
|
632
|
+
captchaToken?: string
|
|
633
|
+
channel?: 'sms' | 'whatsapp' // only for phone
|
|
620
634
|
}
|
|
621
|
-
|
|
635
|
+
}
|
|
622
636
|
|
|
623
637
|
type PasswordCredentialsBase =
|
|
624
638
|
| { email: string; password: string }
|
|
@@ -668,7 +682,7 @@ export type SignInWithPasswordlessCredentials =
|
|
|
668
682
|
}
|
|
669
683
|
}
|
|
670
684
|
|
|
671
|
-
export type AuthFlowType = 'implicit' | 'pkce'
|
|
685
|
+
export type AuthFlowType = 'implicit' | 'pkce' | (string & {})
|
|
672
686
|
export type SignInWithOAuthCredentials = {
|
|
673
687
|
/** One of the providers supported by GoTrue. */
|
|
674
688
|
provider: Provider
|
|
@@ -833,8 +847,15 @@ export interface VerifyTokenHashParams {
|
|
|
833
847
|
type: EmailOtpType
|
|
834
848
|
}
|
|
835
849
|
|
|
836
|
-
export type MobileOtpType = 'sms' | 'phone_change'
|
|
837
|
-
export type EmailOtpType =
|
|
850
|
+
export type MobileOtpType = 'sms' | 'phone_change' | (string & {})
|
|
851
|
+
export type EmailOtpType =
|
|
852
|
+
| 'signup'
|
|
853
|
+
| 'invite'
|
|
854
|
+
| 'magiclink'
|
|
855
|
+
| 'recovery'
|
|
856
|
+
| 'email_change'
|
|
857
|
+
| 'email'
|
|
858
|
+
| (string & {})
|
|
838
859
|
|
|
839
860
|
export type ResendParams =
|
|
840
861
|
| {
|
|
@@ -995,11 +1016,11 @@ type MFAVerifyTOTPParamFields = {
|
|
|
995
1016
|
code: string
|
|
996
1017
|
}
|
|
997
1018
|
|
|
998
|
-
export type MFAVerifyTOTPParams =
|
|
1019
|
+
export type MFAVerifyTOTPParams = MFAVerifyParamsBase & MFAVerifyTOTPParamFields
|
|
999
1020
|
|
|
1000
1021
|
type MFAVerifyPhoneParamFields = MFAVerifyTOTPParamFields
|
|
1001
1022
|
|
|
1002
|
-
export type MFAVerifyPhoneParams =
|
|
1023
|
+
export type MFAVerifyPhoneParams = MFAVerifyParamsBase & MFAVerifyPhoneParamFields
|
|
1003
1024
|
|
|
1004
1025
|
type MFAVerifyWebauthnParamFieldsBase = {
|
|
1005
1026
|
/** Relying party ID */
|
|
@@ -1032,7 +1053,7 @@ export type MFAVerifyWebauthnParamFields<T extends 'create' | 'request' = 'creat
|
|
|
1032
1053
|
* @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying an Authentication Assertion}
|
|
1033
1054
|
*/
|
|
1034
1055
|
export type MFAVerifyWebauthnParams<T extends 'create' | 'request' = 'create' | 'request'> =
|
|
1035
|
-
|
|
1056
|
+
MFAVerifyParamsBase & MFAVerifyWebauthnParamFields<T>
|
|
1036
1057
|
|
|
1037
1058
|
export type MFAVerifyParams = MFAVerifyTOTPParams | MFAVerifyPhoneParams | MFAVerifyWebauthnParams
|
|
1038
1059
|
|
|
@@ -1044,16 +1065,14 @@ type MFAChallengeParamsBase = {
|
|
|
1044
1065
|
const MFATOTPChannels = ['sms', 'whatsapp'] as const
|
|
1045
1066
|
export type MFATOTPChannel = (typeof MFATOTPChannels)[number]
|
|
1046
1067
|
|
|
1047
|
-
export type MFAChallengeTOTPParams =
|
|
1068
|
+
export type MFAChallengeTOTPParams = MFAChallengeParamsBase
|
|
1048
1069
|
|
|
1049
1070
|
type MFAChallengePhoneParamFields<Channel extends MFATOTPChannel = MFATOTPChannel> = {
|
|
1050
1071
|
/** Messaging channel to use (e.g. whatsapp or sms). Only relevant for phone factors */
|
|
1051
1072
|
channel: Channel
|
|
1052
1073
|
}
|
|
1053
1074
|
|
|
1054
|
-
export type MFAChallengePhoneParams =
|
|
1055
|
-
MFAChallengeParamsBase & MFAChallengePhoneParamFields
|
|
1056
|
-
>
|
|
1075
|
+
export type MFAChallengePhoneParams = MFAChallengeParamsBase & MFAChallengePhoneParamFields
|
|
1057
1076
|
|
|
1058
1077
|
/** WebAuthn parameters for WebAuthn factor challenge */
|
|
1059
1078
|
type MFAChallengeWebauthnParamFields = {
|
|
@@ -1070,9 +1089,7 @@ type MFAChallengeWebauthnParamFields = {
|
|
|
1070
1089
|
* Includes Relying Party information needed for WebAuthn ceremonies.
|
|
1071
1090
|
* @see {@link https://w3c.github.io/webauthn/#sctn-rp-operations W3C WebAuthn Spec - Relying Party Operations}
|
|
1072
1091
|
*/
|
|
1073
|
-
export type MFAChallengeWebauthnParams =
|
|
1074
|
-
MFAChallengeParamsBase & MFAChallengeWebauthnParamFields
|
|
1075
|
-
>
|
|
1092
|
+
export type MFAChallengeWebauthnParams = MFAChallengeParamsBase & MFAChallengeWebauthnParamFields
|
|
1076
1093
|
|
|
1077
1094
|
export type MFAChallengeParams =
|
|
1078
1095
|
| MFAChallengeTOTPParams
|
|
@@ -1083,9 +1100,8 @@ type MFAChallengeAndVerifyParamsBase = Omit<MFAVerifyParamsBase, 'challengeId'>
|
|
|
1083
1100
|
|
|
1084
1101
|
type MFAChallengeAndVerifyTOTPParamFields = MFAVerifyTOTPParamFields
|
|
1085
1102
|
|
|
1086
|
-
type MFAChallengeAndVerifyTOTPParams =
|
|
1087
|
-
|
|
1088
|
-
>
|
|
1103
|
+
type MFAChallengeAndVerifyTOTPParams = MFAChallengeAndVerifyParamsBase &
|
|
1104
|
+
MFAChallengeAndVerifyTOTPParamFields
|
|
1089
1105
|
|
|
1090
1106
|
export type MFAChallengeAndVerifyParams = MFAChallengeAndVerifyTOTPParams
|
|
1091
1107
|
|
|
@@ -1142,7 +1158,7 @@ type AuthMFAChallengeTOTPResponseFields = {
|
|
|
1142
1158
|
}
|
|
1143
1159
|
|
|
1144
1160
|
export type AuthMFAChallengeTOTPResponse = RequestResult<
|
|
1145
|
-
|
|
1161
|
+
AuthMFAChallengeResponseBase<'totp'> & AuthMFAChallengeTOTPResponseFields
|
|
1146
1162
|
>
|
|
1147
1163
|
|
|
1148
1164
|
type AuthMFAChallengePhoneResponseFields = {
|
|
@@ -1150,7 +1166,7 @@ type AuthMFAChallengePhoneResponseFields = {
|
|
|
1150
1166
|
}
|
|
1151
1167
|
|
|
1152
1168
|
export type AuthMFAChallengePhoneResponse = RequestResult<
|
|
1153
|
-
|
|
1169
|
+
AuthMFAChallengeResponseBase<'phone'> & AuthMFAChallengePhoneResponseFields
|
|
1154
1170
|
>
|
|
1155
1171
|
|
|
1156
1172
|
type AuthMFAChallengeWebauthnResponseFields = {
|
|
@@ -1171,7 +1187,7 @@ type AuthMFAChallengeWebauthnResponseFields = {
|
|
|
1171
1187
|
* @see {@link https://w3c.github.io/webauthn/#sctn-credential-creation W3C WebAuthn Spec - Credential Creation}
|
|
1172
1188
|
*/
|
|
1173
1189
|
export type AuthMFAChallengeWebauthnResponse = RequestResult<
|
|
1174
|
-
|
|
1190
|
+
AuthMFAChallengeResponseBase<'webauthn'> & AuthMFAChallengeWebauthnResponseFields
|
|
1175
1191
|
>
|
|
1176
1192
|
|
|
1177
1193
|
type AuthMFAChallengeWebauthnResponseFieldsJSON = {
|
|
@@ -1190,9 +1206,8 @@ type AuthMFAChallengeWebauthnResponseFieldsJSON = {
|
|
|
1190
1206
|
* JSON-serializable version of WebAuthn challenge response.
|
|
1191
1207
|
* Used for server communication with base64url-encoded binary fields.
|
|
1192
1208
|
*/
|
|
1193
|
-
export type AuthMFAChallengeWebauthnResponseDataJSON =
|
|
1194
|
-
|
|
1195
|
-
>
|
|
1209
|
+
export type AuthMFAChallengeWebauthnResponseDataJSON = AuthMFAChallengeResponseBase<'webauthn'> &
|
|
1210
|
+
AuthMFAChallengeWebauthnResponseFieldsJSON
|
|
1196
1211
|
|
|
1197
1212
|
/**
|
|
1198
1213
|
* Server response type for WebAuthn MFA challenge.
|
|
@@ -1211,15 +1226,15 @@ export type AuthMFAListFactorsResponse<T extends typeof FactorTypes = typeof Fac
|
|
|
1211
1226
|
RequestResult<
|
|
1212
1227
|
{
|
|
1213
1228
|
/** All available factors (verified and unverified). */
|
|
1214
|
-
all:
|
|
1229
|
+
all: Factor[]
|
|
1215
1230
|
|
|
1216
1231
|
// Dynamically create a property for each factor type with only verified factors
|
|
1217
1232
|
} & {
|
|
1218
|
-
[K in T[number]]:
|
|
1233
|
+
[K in T[number]]: Factor<K, 'verified'>[]
|
|
1219
1234
|
}
|
|
1220
1235
|
>
|
|
1221
1236
|
|
|
1222
|
-
export type AuthenticatorAssuranceLevels = 'aal1' | 'aal2'
|
|
1237
|
+
export type AuthenticatorAssuranceLevels = 'aal1' | 'aal2' | (string & {})
|
|
1223
1238
|
|
|
1224
1239
|
export type AuthMFAGetAuthenticatorAssuranceLevelResponse = RequestResult<{
|
|
1225
1240
|
/** Current AAL level of the session. */
|
|
@@ -1260,6 +1275,7 @@ export interface GoTrueMFAApi {
|
|
|
1260
1275
|
* Upon verifying a factor, all other sessions are logged out and the current session's authenticator level is promoted to `aal2`.
|
|
1261
1276
|
*
|
|
1262
1277
|
* @category Auth
|
|
1278
|
+
* @subcategory Auth MFA
|
|
1263
1279
|
*
|
|
1264
1280
|
* @remarks
|
|
1265
1281
|
* - Use `totp` or `phone` as the `factorType` and use the returned `id` to create a challenge.
|
|
@@ -1340,6 +1356,7 @@ export interface GoTrueMFAApi {
|
|
|
1340
1356
|
* factor.
|
|
1341
1357
|
*
|
|
1342
1358
|
* @category Auth
|
|
1359
|
+
* @subcategory Auth MFA
|
|
1343
1360
|
*
|
|
1344
1361
|
* @remarks
|
|
1345
1362
|
* - An [enrolled factor](/docs/reference/javascript/auth-mfa-enroll) is required before creating a challenge.
|
|
@@ -1413,6 +1430,7 @@ export interface GoTrueMFAApi {
|
|
|
1413
1430
|
* provided by the user by entering a code seen in their authenticator app.
|
|
1414
1431
|
*
|
|
1415
1432
|
* @category Auth
|
|
1433
|
+
* @subcategory Auth MFA
|
|
1416
1434
|
*
|
|
1417
1435
|
* @remarks
|
|
1418
1436
|
* - To verify a challenge, please [create a challenge](/docs/reference/javascript/auth-mfa-challenge) first.
|
|
@@ -1496,6 +1514,7 @@ export interface GoTrueMFAApi {
|
|
|
1496
1514
|
* A user has to have an `aal2` authenticator level in order to unenroll a `verified` factor.
|
|
1497
1515
|
*
|
|
1498
1516
|
* @category Auth
|
|
1517
|
+
* @subcategory Auth MFA
|
|
1499
1518
|
*
|
|
1500
1519
|
* @example Unenroll a factor
|
|
1501
1520
|
* ```js
|
|
@@ -1521,6 +1540,7 @@ export interface GoTrueMFAApi {
|
|
|
1521
1540
|
* provided by the user by entering a code seen in their authenticator app.
|
|
1522
1541
|
*
|
|
1523
1542
|
* @category Auth
|
|
1543
|
+
* @subcategory Auth MFA
|
|
1524
1544
|
*
|
|
1525
1545
|
* @remarks
|
|
1526
1546
|
* - Intended for use with only TOTP factors.
|
|
@@ -1606,6 +1626,7 @@ export interface GoTrueMFAApi {
|
|
|
1606
1626
|
*
|
|
1607
1627
|
*
|
|
1608
1628
|
* @category Auth
|
|
1629
|
+
* @subcategory Auth MFA
|
|
1609
1630
|
*/
|
|
1610
1631
|
listFactors(): Promise<AuthMFAListFactorsResponse>
|
|
1611
1632
|
|
|
@@ -1625,6 +1646,7 @@ export interface GoTrueMFAApi {
|
|
|
1625
1646
|
* @param jwt Takes in an optional access token JWT. If no JWT is provided, the JWT from the current session is used.
|
|
1626
1647
|
*
|
|
1627
1648
|
* @category Auth
|
|
1649
|
+
* @subcategory Auth MFA
|
|
1628
1650
|
*
|
|
1629
1651
|
* @remarks
|
|
1630
1652
|
* - Authenticator Assurance Level (AAL) is the measure of the strength of an authentication mechanism.
|
|
@@ -1669,14 +1691,14 @@ export interface GoTrueMFAApi {
|
|
|
1669
1691
|
}
|
|
1670
1692
|
|
|
1671
1693
|
/**
|
|
1672
|
-
* @
|
|
1694
|
+
* @experimental
|
|
1673
1695
|
*/
|
|
1674
1696
|
export type AuthMFAAdminDeleteFactorResponse = RequestResult<{
|
|
1675
1697
|
/** ID of the factor that was successfully deleted. */
|
|
1676
1698
|
id: string
|
|
1677
1699
|
}>
|
|
1678
1700
|
/**
|
|
1679
|
-
* @
|
|
1701
|
+
* @experimental
|
|
1680
1702
|
*/
|
|
1681
1703
|
export type AuthMFAAdminDeleteFactorParams = {
|
|
1682
1704
|
/** ID of the MFA factor to delete. */
|
|
@@ -1687,7 +1709,7 @@ export type AuthMFAAdminDeleteFactorParams = {
|
|
|
1687
1709
|
}
|
|
1688
1710
|
|
|
1689
1711
|
/**
|
|
1690
|
-
* @
|
|
1712
|
+
* @experimental
|
|
1691
1713
|
*/
|
|
1692
1714
|
export type AuthMFAAdminListFactorsResponse = RequestResult<{
|
|
1693
1715
|
/** All factors attached to the user. */
|
|
@@ -1695,7 +1717,7 @@ export type AuthMFAAdminListFactorsResponse = RequestResult<{
|
|
|
1695
1717
|
}>
|
|
1696
1718
|
|
|
1697
1719
|
/**
|
|
1698
|
-
* @
|
|
1720
|
+
* @experimental
|
|
1699
1721
|
*/
|
|
1700
1722
|
export type AuthMFAAdminListFactorsParams = {
|
|
1701
1723
|
/** ID of the user. */
|
|
@@ -1705,7 +1727,7 @@ export type AuthMFAAdminListFactorsParams = {
|
|
|
1705
1727
|
/**
|
|
1706
1728
|
* Contains the full multi-factor authentication administration API.
|
|
1707
1729
|
*
|
|
1708
|
-
* @
|
|
1730
|
+
* @experimental
|
|
1709
1731
|
*/
|
|
1710
1732
|
export interface GoTrueAdminMFAApi {
|
|
1711
1733
|
/**
|
|
@@ -1713,6 +1735,7 @@ export interface GoTrueAdminMFAApi {
|
|
|
1713
1735
|
*
|
|
1714
1736
|
*
|
|
1715
1737
|
* @category Auth
|
|
1738
|
+
* @subcategory Auth Admin
|
|
1716
1739
|
*
|
|
1717
1740
|
* @example List all factors for a user
|
|
1718
1741
|
* ```js
|
|
@@ -1746,9 +1769,10 @@ export interface GoTrueAdminMFAApi {
|
|
|
1746
1769
|
*
|
|
1747
1770
|
* @see {@link GoTrueMFAApi#unenroll}
|
|
1748
1771
|
*
|
|
1749
|
-
* @
|
|
1772
|
+
* @experimental
|
|
1750
1773
|
*
|
|
1751
1774
|
* @category Auth
|
|
1775
|
+
* @subcategory Auth Admin
|
|
1752
1776
|
*
|
|
1753
1777
|
* @example Delete a factor for a user
|
|
1754
1778
|
* ```js
|
|
@@ -1837,15 +1861,13 @@ type MFAEnrollTOTPParamFields = {
|
|
|
1837
1861
|
issuer?: string
|
|
1838
1862
|
}
|
|
1839
1863
|
|
|
1840
|
-
export type MFAEnrollTOTPParams =
|
|
1864
|
+
export type MFAEnrollTOTPParams = MFAEnrollParamsBase<'totp'> & MFAEnrollTOTPParamFields
|
|
1841
1865
|
|
|
1842
1866
|
type MFAEnrollPhoneParamFields = {
|
|
1843
1867
|
/** Phone number associated with a factor. Number should conform to E.164 format */
|
|
1844
1868
|
phone: string
|
|
1845
1869
|
}
|
|
1846
|
-
export type MFAEnrollPhoneParams =
|
|
1847
|
-
MFAEnrollParamsBase<'phone'> & MFAEnrollPhoneParamFields
|
|
1848
|
-
>
|
|
1870
|
+
export type MFAEnrollPhoneParams = MFAEnrollParamsBase<'phone'> & MFAEnrollPhoneParamFields
|
|
1849
1871
|
|
|
1850
1872
|
type MFAEnrollWebauthnFields = {
|
|
1851
1873
|
/** no extra fields for now, kept for consistency and for possible future changes */
|
|
@@ -1856,9 +1878,7 @@ type MFAEnrollWebauthnFields = {
|
|
|
1856
1878
|
* Creates an unverified WebAuthn factor that must be verified with a credential.
|
|
1857
1879
|
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
1858
1880
|
*/
|
|
1859
|
-
export type MFAEnrollWebauthnParams =
|
|
1860
|
-
MFAEnrollParamsBase<'webauthn'> & MFAEnrollWebauthnFields
|
|
1861
|
-
>
|
|
1881
|
+
export type MFAEnrollWebauthnParams = MFAEnrollParamsBase<'webauthn'> & MFAEnrollWebauthnFields
|
|
1862
1882
|
|
|
1863
1883
|
type AuthMFAEnrollResponseBase<T extends FactorType> = {
|
|
1864
1884
|
/** ID of the factor that was just enrolled (in an unverified state). */
|
|
@@ -1891,7 +1911,7 @@ type AuthMFAEnrollTOTPResponseFields = {
|
|
|
1891
1911
|
}
|
|
1892
1912
|
|
|
1893
1913
|
export type AuthMFAEnrollTOTPResponse = RequestResult<
|
|
1894
|
-
|
|
1914
|
+
AuthMFAEnrollResponseBase<'totp'> & AuthMFAEnrollTOTPResponseFields
|
|
1895
1915
|
>
|
|
1896
1916
|
|
|
1897
1917
|
type AuthMFAEnrollPhoneResponseFields = {
|
|
@@ -1900,7 +1920,7 @@ type AuthMFAEnrollPhoneResponseFields = {
|
|
|
1900
1920
|
}
|
|
1901
1921
|
|
|
1902
1922
|
export type AuthMFAEnrollPhoneResponse = RequestResult<
|
|
1903
|
-
|
|
1923
|
+
AuthMFAEnrollResponseBase<'phone'> & AuthMFAEnrollPhoneResponseFields
|
|
1904
1924
|
>
|
|
1905
1925
|
|
|
1906
1926
|
type AuthMFAEnrollWebauthnFields = {
|
|
@@ -1913,11 +1933,11 @@ type AuthMFAEnrollWebauthnFields = {
|
|
|
1913
1933
|
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
1914
1934
|
*/
|
|
1915
1935
|
export type AuthMFAEnrollWebauthnResponse = RequestResult<
|
|
1916
|
-
|
|
1936
|
+
AuthMFAEnrollResponseBase<'webauthn'> & AuthMFAEnrollWebauthnFields
|
|
1917
1937
|
>
|
|
1918
1938
|
|
|
1919
1939
|
export type JwtHeader = {
|
|
1920
|
-
alg: 'RS256' | 'ES256' | 'HS256'
|
|
1940
|
+
alg: 'RS256' | 'ES256' | 'HS256' | (string & {})
|
|
1921
1941
|
kid: string
|
|
1922
1942
|
typ: string
|
|
1923
1943
|
}
|
|
@@ -1968,7 +1988,7 @@ export interface JwtPayload extends RequiredClaims {
|
|
|
1968
1988
|
}
|
|
1969
1989
|
|
|
1970
1990
|
export interface JWK {
|
|
1971
|
-
kty: 'RSA' | 'EC' | 'oct'
|
|
1991
|
+
kty: 'RSA' | 'EC' | 'oct' | (string & {})
|
|
1972
1992
|
key_ops: string[]
|
|
1973
1993
|
alg?: string
|
|
1974
1994
|
kid?: string
|
|
@@ -1982,7 +2002,7 @@ export type SignOutScope = (typeof SIGN_OUT_SCOPES)[number]
|
|
|
1982
2002
|
* OAuth client grant types supported by the OAuth 2.1 server.
|
|
1983
2003
|
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
1984
2004
|
*/
|
|
1985
|
-
export type OAuthClientGrantType = 'authorization_code' | 'refresh_token'
|
|
2005
|
+
export type OAuthClientGrantType = 'authorization_code' | 'refresh_token' | (string & {})
|
|
1986
2006
|
|
|
1987
2007
|
/**
|
|
1988
2008
|
* OAuth client response types supported by the OAuth 2.1 server.
|
|
@@ -2119,6 +2139,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
2119
2139
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2120
2140
|
*
|
|
2121
2141
|
* @category Auth
|
|
2142
|
+
* @subcategory OAuth Admin
|
|
2122
2143
|
*/
|
|
2123
2144
|
listClients(params?: PageParams): Promise<OAuthClientListResponse>
|
|
2124
2145
|
|
|
@@ -2129,6 +2150,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
2129
2150
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2130
2151
|
*
|
|
2131
2152
|
* @category Auth
|
|
2153
|
+
* @subcategory OAuth Admin
|
|
2132
2154
|
*/
|
|
2133
2155
|
createClient(params: CreateOAuthClientParams): Promise<OAuthClientResponse>
|
|
2134
2156
|
|
|
@@ -2139,6 +2161,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
2139
2161
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2140
2162
|
*
|
|
2141
2163
|
* @category Auth
|
|
2164
|
+
* @subcategory OAuth Admin
|
|
2142
2165
|
*/
|
|
2143
2166
|
getClient(clientId: string): Promise<OAuthClientResponse>
|
|
2144
2167
|
|
|
@@ -2149,6 +2172,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
2149
2172
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2150
2173
|
*
|
|
2151
2174
|
* @category Auth
|
|
2175
|
+
* @subcategory OAuth Admin
|
|
2152
2176
|
*/
|
|
2153
2177
|
updateClient(clientId: string, params: UpdateOAuthClientParams): Promise<OAuthClientResponse>
|
|
2154
2178
|
|
|
@@ -2159,6 +2183,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
2159
2183
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2160
2184
|
*
|
|
2161
2185
|
* @category Auth
|
|
2186
|
+
* @subcategory OAuth Admin
|
|
2162
2187
|
*/
|
|
2163
2188
|
deleteClient(clientId: string): Promise<{ data: null; error: AuthError | null }>
|
|
2164
2189
|
|
|
@@ -2169,6 +2194,7 @@ export interface GoTrueAdminOAuthApi {
|
|
|
2169
2194
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2170
2195
|
*
|
|
2171
2196
|
* @category Auth
|
|
2197
|
+
* @subcategory OAuth Admin
|
|
2172
2198
|
*/
|
|
2173
2199
|
regenerateClientSecret(clientId: string): Promise<OAuthClientResponse>
|
|
2174
2200
|
}
|
|
@@ -2224,6 +2250,14 @@ export type CustomOAuthProvider = {
|
|
|
2224
2250
|
acceptable_client_ids?: string[]
|
|
2225
2251
|
/** OAuth scopes requested during authorization */
|
|
2226
2252
|
scopes?: string[]
|
|
2253
|
+
/**
|
|
2254
|
+
* Allowlist of raw identity provider claim keys to copy verbatim into the
|
|
2255
|
+
* user's `custom_claims` field (within `identity_data` and
|
|
2256
|
+
* `raw_user_meta_data`), e.g. `["groups", "org_id", "mail"]`. This is an
|
|
2257
|
+
* opt-in allowlist that defaults to empty (no claims captured) and operates
|
|
2258
|
+
* independently from `attribute_mapping`.
|
|
2259
|
+
*/
|
|
2260
|
+
custom_claims_allowlist?: string[]
|
|
2227
2261
|
/** Whether PKCE is enabled */
|
|
2228
2262
|
pkce_enabled?: boolean
|
|
2229
2263
|
/** Mapping of provider attributes to Supabase user attributes */
|
|
@@ -2274,6 +2308,14 @@ export type CreateCustomProviderParams = {
|
|
|
2274
2308
|
acceptable_client_ids?: string[]
|
|
2275
2309
|
/** OAuth scopes requested during authorization */
|
|
2276
2310
|
scopes?: string[]
|
|
2311
|
+
/**
|
|
2312
|
+
* Allowlist of raw identity provider claim keys to copy verbatim into the
|
|
2313
|
+
* user's `custom_claims` field (within `identity_data` and
|
|
2314
|
+
* `raw_user_meta_data`), e.g. `["groups", "org_id", "mail"]`. This is an
|
|
2315
|
+
* opt-in allowlist that defaults to empty (no claims captured) and operates
|
|
2316
|
+
* independently from `attribute_mapping`.
|
|
2317
|
+
*/
|
|
2318
|
+
custom_claims_allowlist?: string[]
|
|
2277
2319
|
/** Whether PKCE is enabled */
|
|
2278
2320
|
pkce_enabled?: boolean
|
|
2279
2321
|
/** Mapping of provider attributes to Supabase user attributes */
|
|
@@ -2316,6 +2358,14 @@ export type UpdateCustomProviderParams = {
|
|
|
2316
2358
|
acceptable_client_ids?: string[]
|
|
2317
2359
|
/** OAuth scopes requested during authorization */
|
|
2318
2360
|
scopes?: string[]
|
|
2361
|
+
/**
|
|
2362
|
+
* Allowlist of raw identity provider claim keys to copy verbatim into the
|
|
2363
|
+
* user's `custom_claims` field (within `identity_data` and
|
|
2364
|
+
* `raw_user_meta_data`), e.g. `["groups", "org_id", "mail"]`. This is an
|
|
2365
|
+
* opt-in allowlist that defaults to empty (no claims captured) and operates
|
|
2366
|
+
* independently from `attribute_mapping`.
|
|
2367
|
+
*/
|
|
2368
|
+
custom_claims_allowlist?: string[]
|
|
2319
2369
|
/** Whether PKCE is enabled */
|
|
2320
2370
|
pkce_enabled?: boolean
|
|
2321
2371
|
/** Mapping of provider attributes to Supabase user attributes */
|
|
@@ -2376,6 +2426,9 @@ export interface GoTrueAdminCustomProvidersApi {
|
|
|
2376
2426
|
* Lists all custom providers with optional type filter.
|
|
2377
2427
|
*
|
|
2378
2428
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2429
|
+
*
|
|
2430
|
+
* @category Auth
|
|
2431
|
+
* @subcategory Auth Admin
|
|
2379
2432
|
*/
|
|
2380
2433
|
listProviders(params?: ListCustomProvidersParams): Promise<CustomProviderListResponse>
|
|
2381
2434
|
|
|
@@ -2389,6 +2442,9 @@ export interface GoTrueAdminCustomProvidersApi {
|
|
|
2389
2442
|
* in the document does not match the expected issuer.
|
|
2390
2443
|
*
|
|
2391
2444
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2445
|
+
*
|
|
2446
|
+
* @category Auth
|
|
2447
|
+
* @subcategory Auth Admin
|
|
2392
2448
|
*/
|
|
2393
2449
|
createProvider(params: CreateCustomProviderParams): Promise<CustomProviderResponse>
|
|
2394
2450
|
|
|
@@ -2396,6 +2452,9 @@ export interface GoTrueAdminCustomProvidersApi {
|
|
|
2396
2452
|
* Gets details of a specific custom provider by identifier.
|
|
2397
2453
|
*
|
|
2398
2454
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2455
|
+
*
|
|
2456
|
+
* @category Auth
|
|
2457
|
+
* @subcategory Auth Admin
|
|
2399
2458
|
*/
|
|
2400
2459
|
getProvider(identifier: string): Promise<CustomProviderResponse>
|
|
2401
2460
|
|
|
@@ -2408,6 +2467,9 @@ export interface GoTrueAdminCustomProvidersApi {
|
|
|
2408
2467
|
* the issuer does not match.
|
|
2409
2468
|
*
|
|
2410
2469
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2470
|
+
*
|
|
2471
|
+
* @category Auth
|
|
2472
|
+
* @subcategory Auth Admin
|
|
2411
2473
|
*/
|
|
2412
2474
|
updateProvider(
|
|
2413
2475
|
identifier: string,
|
|
@@ -2418,6 +2480,9 @@ export interface GoTrueAdminCustomProvidersApi {
|
|
|
2418
2480
|
* Deletes a custom provider.
|
|
2419
2481
|
*
|
|
2420
2482
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2483
|
+
*
|
|
2484
|
+
* @category Auth
|
|
2485
|
+
* @subcategory Auth Admin
|
|
2421
2486
|
*/
|
|
2422
2487
|
deleteProvider(identifier: string): Promise<{ data: null; error: AuthError | null }>
|
|
2423
2488
|
}
|
|
@@ -2570,6 +2635,7 @@ export interface AuthOAuthServerApi {
|
|
|
2570
2635
|
* @returns Authorization details or redirect URL depending on consent status
|
|
2571
2636
|
*
|
|
2572
2637
|
* @category Auth
|
|
2638
|
+
* @subcategory OAuth Server
|
|
2573
2639
|
*/
|
|
2574
2640
|
getAuthorizationDetails(authorizationId: string): Promise<AuthOAuthAuthorizationDetailsResponse>
|
|
2575
2641
|
|
|
@@ -2586,6 +2652,7 @@ export interface AuthOAuthServerApi {
|
|
|
2586
2652
|
* @returns Redirect URL to send the user back to the OAuth client with authorization code
|
|
2587
2653
|
*
|
|
2588
2654
|
* @category Auth
|
|
2655
|
+
* @subcategory OAuth Server
|
|
2589
2656
|
*/
|
|
2590
2657
|
approveAuthorization(
|
|
2591
2658
|
authorizationId: string,
|
|
@@ -2605,6 +2672,7 @@ export interface AuthOAuthServerApi {
|
|
|
2605
2672
|
* @returns Redirect URL to send the user back to the OAuth client with error information
|
|
2606
2673
|
*
|
|
2607
2674
|
* @category Auth
|
|
2675
|
+
* @subcategory OAuth Server
|
|
2608
2676
|
*/
|
|
2609
2677
|
denyAuthorization(
|
|
2610
2678
|
authorizationId: string,
|
|
@@ -2618,6 +2686,7 @@ export interface AuthOAuthServerApi {
|
|
|
2618
2686
|
* @returns Response with array of OAuth grants with client information and granted scopes
|
|
2619
2687
|
*
|
|
2620
2688
|
* @category Auth
|
|
2689
|
+
* @subcategory OAuth Server
|
|
2621
2690
|
*/
|
|
2622
2691
|
listGrants(): Promise<AuthOAuthGrantsResponse>
|
|
2623
2692
|
|
|
@@ -2633,6 +2702,229 @@ export interface AuthOAuthServerApi {
|
|
|
2633
2702
|
* @returns Empty response on successful revocation
|
|
2634
2703
|
*
|
|
2635
2704
|
* @category Auth
|
|
2705
|
+
* @subcategory OAuth Server
|
|
2636
2706
|
*/
|
|
2637
2707
|
revokeGrant(options: { clientId: string }): Promise<AuthOAuthRevokeGrantResponse>
|
|
2638
2708
|
}
|
|
2709
|
+
|
|
2710
|
+
// --- Passkey Types ---
|
|
2711
|
+
|
|
2712
|
+
/** Response from POST /passkeys/registration/options */
|
|
2713
|
+
export type PasskeyRegistrationOptionsResponse = {
|
|
2714
|
+
challenge_id: string
|
|
2715
|
+
options: ServerCredentialCreationOptions
|
|
2716
|
+
expires_at: number
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
/** Request body for POST /passkeys/registration/verify */
|
|
2720
|
+
export type PasskeyRegistrationVerifyParams = {
|
|
2721
|
+
challenge_id: string
|
|
2722
|
+
credential: RegistrationResponseJSON
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
/** Response from POST /passkeys/registration/verify */
|
|
2726
|
+
export type PasskeyMetadata = {
|
|
2727
|
+
id: string
|
|
2728
|
+
friendly_name?: string
|
|
2729
|
+
created_at: string
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
/** Response from POST /passkeys/authentication/options */
|
|
2733
|
+
export type PasskeyAuthenticationOptionsResponse = {
|
|
2734
|
+
challenge_id: string
|
|
2735
|
+
options: ServerCredentialRequestOptions
|
|
2736
|
+
expires_at: number
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
/** Request body for POST /passkeys/authentication/verify */
|
|
2740
|
+
export type PasskeyAuthenticationVerifyParams = {
|
|
2741
|
+
challenge_id: string
|
|
2742
|
+
credential: AuthenticationResponseJSON
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
/** Item in the passkeys list (GET /passkeys/ and admin list) */
|
|
2746
|
+
export type PasskeyListItem = {
|
|
2747
|
+
id: string
|
|
2748
|
+
friendly_name?: string
|
|
2749
|
+
created_at: string
|
|
2750
|
+
last_used_at?: string
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
// --- Passkey SDK Method Parameter/Response Types ---
|
|
2754
|
+
|
|
2755
|
+
export type SignInWithPasskeyCredentials = {
|
|
2756
|
+
options?: {
|
|
2757
|
+
captchaToken?: string
|
|
2758
|
+
signal?: AbortSignal
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
export type RegisterPasskeyCredentials = {
|
|
2763
|
+
options?: {
|
|
2764
|
+
signal?: AbortSignal
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
export type VerifyPasskeyRegistrationParams = {
|
|
2769
|
+
/** Challenge ID from startRegistration */
|
|
2770
|
+
challengeId: string
|
|
2771
|
+
/** Serialized credential from navigator.credentials.create() */
|
|
2772
|
+
credential: ServerCredentialResponse
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
export type StartPasskeyAuthenticationParams = {
|
|
2776
|
+
options?: {
|
|
2777
|
+
captchaToken?: string
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
export type VerifyPasskeyAuthenticationParams = {
|
|
2782
|
+
/** Challenge ID from startAuthentication */
|
|
2783
|
+
challengeId: string
|
|
2784
|
+
/** Serialized credential from navigator.credentials.get() */
|
|
2785
|
+
credential: ServerCredentialResponse
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
export type PasskeyUpdateParams = {
|
|
2789
|
+
/** UUID of the passkey to update */
|
|
2790
|
+
passkeyId: string
|
|
2791
|
+
/** New friendly name (max 120 chars) */
|
|
2792
|
+
friendlyName: string
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2795
|
+
export type PasskeyDeleteParams = {
|
|
2796
|
+
/** UUID of the passkey to delete */
|
|
2797
|
+
passkeyId: string
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2800
|
+
// --- Passkey Response Types ---
|
|
2801
|
+
|
|
2802
|
+
export type AuthPasskeyRegistrationOptionsResponse =
|
|
2803
|
+
RequestResult<PasskeyRegistrationOptionsResponse>
|
|
2804
|
+
export type AuthPasskeyRegistrationVerifyResponse = RequestResult<
|
|
2805
|
+
PasskeyMetadata,
|
|
2806
|
+
WebAuthnError | AuthError
|
|
2807
|
+
>
|
|
2808
|
+
export type AuthPasskeyAuthenticationOptionsResponse =
|
|
2809
|
+
RequestResult<PasskeyAuthenticationOptionsResponse>
|
|
2810
|
+
export type AuthPasskeyAuthenticationVerifyResponse = RequestResult<
|
|
2811
|
+
{ session: Session | null; user: User | null },
|
|
2812
|
+
WebAuthnError | AuthError
|
|
2813
|
+
>
|
|
2814
|
+
export type AuthPasskeyListResponse = RequestResult<PasskeyListItem[]>
|
|
2815
|
+
export type AuthPasskeyUpdateResponse = RequestResult<PasskeyListItem>
|
|
2816
|
+
export type AuthPasskeyDeleteResponse = RequestResult<null>
|
|
2817
|
+
|
|
2818
|
+
// --- Passkey Admin Types ---
|
|
2819
|
+
|
|
2820
|
+
export type AuthPasskeyAdminListParams = {
|
|
2821
|
+
userId: string
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
export type AuthPasskeyAdminDeleteParams = {
|
|
2825
|
+
userId: string
|
|
2826
|
+
passkeyId: string
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2829
|
+
// --- Passkey Namespace Interfaces ---
|
|
2830
|
+
|
|
2831
|
+
/**
|
|
2832
|
+
* Lower-level two-step API and management methods for passkeys.
|
|
2833
|
+
* Access via `supabase.auth.passkey`.
|
|
2834
|
+
*/
|
|
2835
|
+
export interface AuthPasskeyApi {
|
|
2836
|
+
// Two-step registration
|
|
2837
|
+
/**
|
|
2838
|
+
* Starts the passkey registration ceremony. Fetches a registration challenge
|
|
2839
|
+
* and credential creation options from the server. Used as the first step of
|
|
2840
|
+
* a two-step registration flow when the caller wants to handle
|
|
2841
|
+
* `navigator.credentials.create()` themselves.
|
|
2842
|
+
*
|
|
2843
|
+
* @category Auth
|
|
2844
|
+
* @subcategory Auth Passkey
|
|
2845
|
+
*/
|
|
2846
|
+
startRegistration(): Promise<AuthPasskeyRegistrationOptionsResponse>
|
|
2847
|
+
|
|
2848
|
+
/**
|
|
2849
|
+
* Verifies a passkey registration credential against a previously issued
|
|
2850
|
+
* challenge. Used as the second step of a two-step registration flow.
|
|
2851
|
+
*
|
|
2852
|
+
* @category Auth
|
|
2853
|
+
* @subcategory Auth Passkey
|
|
2854
|
+
*/
|
|
2855
|
+
verifyRegistration(
|
|
2856
|
+
params: VerifyPasskeyRegistrationParams
|
|
2857
|
+
): Promise<AuthPasskeyRegistrationVerifyResponse>
|
|
2858
|
+
|
|
2859
|
+
// Two-step authentication
|
|
2860
|
+
/**
|
|
2861
|
+
* Starts the passkey authentication ceremony. Fetches an authentication
|
|
2862
|
+
* challenge and credential request options from the server. Used as the
|
|
2863
|
+
* first step of a two-step sign-in flow when the caller wants to handle
|
|
2864
|
+
* `navigator.credentials.get()` themselves.
|
|
2865
|
+
*
|
|
2866
|
+
* @category Auth
|
|
2867
|
+
* @subcategory Auth Passkey
|
|
2868
|
+
*/
|
|
2869
|
+
startAuthentication(
|
|
2870
|
+
params?: StartPasskeyAuthenticationParams
|
|
2871
|
+
): Promise<AuthPasskeyAuthenticationOptionsResponse>
|
|
2872
|
+
|
|
2873
|
+
/**
|
|
2874
|
+
* Verifies a passkey authentication credential against a previously issued
|
|
2875
|
+
* challenge. Used as the second step of a two-step sign-in flow.
|
|
2876
|
+
*
|
|
2877
|
+
* @category Auth
|
|
2878
|
+
* @subcategory Auth Passkey
|
|
2879
|
+
*/
|
|
2880
|
+
verifyAuthentication(
|
|
2881
|
+
params: VerifyPasskeyAuthenticationParams
|
|
2882
|
+
): Promise<AuthPasskeyAuthenticationVerifyResponse>
|
|
2883
|
+
|
|
2884
|
+
// Management
|
|
2885
|
+
/**
|
|
2886
|
+
* Lists all passkeys registered for the currently signed-in user.
|
|
2887
|
+
*
|
|
2888
|
+
* @category Auth
|
|
2889
|
+
* @subcategory Auth Passkey
|
|
2890
|
+
*/
|
|
2891
|
+
list(): Promise<AuthPasskeyListResponse>
|
|
2892
|
+
|
|
2893
|
+
/**
|
|
2894
|
+
* Updates a passkey's friendly name.
|
|
2895
|
+
*
|
|
2896
|
+
* @category Auth
|
|
2897
|
+
* @subcategory Auth Passkey
|
|
2898
|
+
*/
|
|
2899
|
+
update(params: PasskeyUpdateParams): Promise<AuthPasskeyUpdateResponse>
|
|
2900
|
+
|
|
2901
|
+
/**
|
|
2902
|
+
* Deletes a passkey for the currently signed-in user.
|
|
2903
|
+
*
|
|
2904
|
+
* @category Auth
|
|
2905
|
+
* @subcategory Auth Passkey
|
|
2906
|
+
*/
|
|
2907
|
+
delete(params: PasskeyDeleteParams): Promise<AuthPasskeyDeleteResponse>
|
|
2908
|
+
}
|
|
2909
|
+
|
|
2910
|
+
export interface GoTrueAdminPasskeyApi {
|
|
2911
|
+
/**
|
|
2912
|
+
* Lists all passkeys registered for a specific user.
|
|
2913
|
+
*
|
|
2914
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2915
|
+
*
|
|
2916
|
+
* @category Auth
|
|
2917
|
+
* @subcategory Passkey Admin
|
|
2918
|
+
*/
|
|
2919
|
+
listPasskeys(params: AuthPasskeyAdminListParams): Promise<AuthPasskeyListResponse>
|
|
2920
|
+
|
|
2921
|
+
/**
|
|
2922
|
+
* Deletes a specific passkey for a specific user.
|
|
2923
|
+
*
|
|
2924
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
2925
|
+
*
|
|
2926
|
+
* @category Auth
|
|
2927
|
+
* @subcategory Passkey Admin
|
|
2928
|
+
*/
|
|
2929
|
+
deletePasskey(params: AuthPasskeyAdminDeleteParams): Promise<AuthPasskeyDeleteResponse>
|
|
2930
|
+
}
|