@supabase/gotrue-js 2.73.0-rc.3 → 2.79.1-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -4
- package/dist/main/GoTrueAdminApi.js.map +1 -1
- package/dist/main/GoTrueClient.d.ts +21 -2
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +61 -37
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/base64url.d.ts +3 -2
- package/dist/main/lib/base64url.d.ts.map +1 -1
- package/dist/main/lib/base64url.js +10 -11
- package/dist/main/lib/base64url.js.map +1 -1
- package/dist/main/lib/error-codes.d.ts +1 -1
- package/dist/main/lib/error-codes.d.ts.map +1 -1
- package/dist/main/lib/errors.d.ts.map +1 -1
- package/dist/main/lib/errors.js +7 -7
- package/dist/main/lib/errors.js.map +1 -1
- package/dist/main/lib/fetch.d.ts +2 -2
- package/dist/main/lib/fetch.d.ts.map +1 -1
- package/dist/main/lib/fetch.js +8 -9
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +3 -2
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +34 -24
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/local-storage.js +1 -2
- package/dist/main/lib/local-storage.js.map +1 -1
- package/dist/main/lib/locks.js +3 -3
- package/dist/main/lib/locks.js.map +1 -1
- package/dist/main/lib/polyfills.js +1 -2
- package/dist/main/lib/polyfills.js.map +1 -1
- package/dist/main/lib/types.d.ts +233 -112
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/types.js +3 -2
- package/dist/main/lib/types.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.d.ts.map +1 -1
- package/dist/main/lib/version.js +7 -1
- package/dist/main/lib/version.js.map +1 -1
- package/dist/main/lib/web3/ethereum.d.ts +9 -9
- package/dist/main/lib/web3/ethereum.d.ts.map +1 -1
- package/dist/main/lib/web3/ethereum.js +4 -5
- package/dist/main/lib/web3/ethereum.js.map +1 -1
- package/dist/main/lib/web3/solana.d.ts +4 -4
- package/dist/main/lib/web3/solana.d.ts.map +1 -1
- package/dist/main/lib/webauthn.d.ts +274 -0
- package/dist/main/lib/webauthn.d.ts.map +1 -0
- package/dist/main/lib/webauthn.dom.d.ts +583 -0
- package/dist/main/lib/webauthn.dom.d.ts.map +1 -0
- package/dist/main/lib/webauthn.dom.js +4 -0
- package/dist/main/lib/webauthn.dom.js.map +1 -0
- package/dist/main/lib/webauthn.errors.d.ts +80 -0
- package/dist/main/lib/webauthn.errors.d.ts.map +1 -0
- package/dist/main/lib/webauthn.errors.js +265 -0
- package/dist/main/lib/webauthn.errors.js.map +1 -0
- package/dist/main/lib/webauthn.js +702 -0
- package/dist/main/lib/webauthn.js.map +1 -0
- package/dist/module/GoTrueAdminApi.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts +21 -2
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +68 -43
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/base64url.d.ts +3 -2
- package/dist/module/lib/base64url.d.ts.map +1 -1
- package/dist/module/lib/base64url.js.map +1 -1
- package/dist/module/lib/error-codes.d.ts +1 -1
- package/dist/module/lib/error-codes.d.ts.map +1 -1
- package/dist/module/lib/errors.d.ts.map +1 -1
- package/dist/module/lib/fetch.d.ts +2 -2
- package/dist/module/lib/fetch.d.ts.map +1 -1
- package/dist/module/lib/fetch.js.map +1 -1
- package/dist/module/lib/helpers.d.ts +3 -2
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/locks.js.map +1 -1
- package/dist/module/lib/polyfills.js.map +1 -1
- package/dist/module/lib/types.d.ts +233 -112
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/types.js +2 -1
- package/dist/module/lib/types.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.d.ts.map +1 -1
- package/dist/module/lib/version.js +7 -1
- package/dist/module/lib/version.js.map +1 -1
- package/dist/module/lib/web3/ethereum.d.ts +9 -9
- package/dist/module/lib/web3/ethereum.d.ts.map +1 -1
- package/dist/module/lib/web3/ethereum.js.map +1 -1
- package/dist/module/lib/web3/solana.d.ts +4 -4
- package/dist/module/lib/web3/solana.d.ts.map +1 -1
- package/dist/module/lib/webauthn.d.ts +274 -0
- package/dist/module/lib/webauthn.d.ts.map +1 -0
- package/dist/module/lib/webauthn.dom.d.ts +583 -0
- package/dist/module/lib/webauthn.dom.d.ts.map +1 -0
- package/dist/module/lib/webauthn.dom.js +3 -0
- package/dist/module/lib/webauthn.dom.js.map +1 -0
- package/dist/module/lib/webauthn.errors.d.ts +80 -0
- package/dist/module/lib/webauthn.errors.d.ts.map +1 -0
- package/dist/module/lib/webauthn.errors.js +257 -0
- package/dist/module/lib/webauthn.errors.js.map +1 -0
- package/dist/module/lib/webauthn.js +685 -0
- package/dist/module/lib/webauthn.js.map +1 -0
- package/package.json +13 -34
- package/src/GoTrueClient.ts +218 -69
- package/src/lib/base64url.ts +4 -2
- package/src/lib/helpers.ts +2 -1
- package/src/lib/types.ts +212 -33
- package/src/lib/version.ts +7 -1
- package/src/lib/webauthn.dom.ts +636 -0
- package/src/lib/webauthn.errors.ts +317 -0
- package/src/lib/webauthn.ts +929 -0
package/src/lib/types.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { EIP1193Provider } from './web3/ethereum'
|
|
2
1
|
import { AuthError } from './errors'
|
|
3
2
|
import { Fetch } from './fetch'
|
|
3
|
+
import { EIP1193Provider, EthereumSignInInput, Hex } from './web3/ethereum'
|
|
4
4
|
import type { SolanaSignInInput, SolanaSignInOutput } from './web3/solana'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ServerCredentialCreationOptions,
|
|
7
|
+
ServerCredentialRequestOptions,
|
|
8
|
+
WebAuthnApi,
|
|
9
|
+
} from './webauthn'
|
|
10
|
+
import {
|
|
11
|
+
AuthenticationCredential,
|
|
12
|
+
PublicKeyCredentialCreationOptionsFuture,
|
|
13
|
+
PublicKeyCredentialRequestOptionsFuture,
|
|
14
|
+
RegistrationCredential,
|
|
15
|
+
} from './webauthn.dom'
|
|
6
16
|
|
|
7
17
|
/** One of the providers supported by GoTrue. */
|
|
8
18
|
export type Provider =
|
|
@@ -101,7 +111,7 @@ export type GoTrueClientOptions = {
|
|
|
101
111
|
|
|
102
112
|
const WeakPasswordReasons = ['length', 'characters', 'pwned'] as const
|
|
103
113
|
|
|
104
|
-
export type WeakPasswordReasons = typeof WeakPasswordReasons[number]
|
|
114
|
+
export type WeakPasswordReasons = (typeof WeakPasswordReasons)[number]
|
|
105
115
|
export type WeakPassword = {
|
|
106
116
|
reasons: WeakPasswordReasons[]
|
|
107
117
|
message: string
|
|
@@ -113,6 +123,13 @@ export type WeakPassword = {
|
|
|
113
123
|
*/
|
|
114
124
|
export type Prettify<T> = T extends Function ? T : { [K in keyof T]: T[K] }
|
|
115
125
|
|
|
126
|
+
/**
|
|
127
|
+
* A stricter version of TypeScript's Omit that only allows omitting keys that actually exist.
|
|
128
|
+
* This prevents typos and ensures type safety at compile time.
|
|
129
|
+
* Unlike regular Omit, this will error if you try to omit a non-existent key.
|
|
130
|
+
*/
|
|
131
|
+
export type StrictOmit<T, K extends keyof T> = Omit<T, K>
|
|
132
|
+
|
|
116
133
|
/**
|
|
117
134
|
* a shared result type that encapsulates errors instead of throwing them, allows you to optionally specify the ErrorType
|
|
118
135
|
*/
|
|
@@ -242,13 +259,14 @@ const AMRMethods = [
|
|
|
242
259
|
'totp',
|
|
243
260
|
'mfa/totp',
|
|
244
261
|
'mfa/phone',
|
|
262
|
+
'mfa/webauthn',
|
|
245
263
|
'anonymous',
|
|
246
264
|
'sso/saml',
|
|
247
265
|
'magiclink',
|
|
248
266
|
'web3',
|
|
249
267
|
] as const
|
|
250
268
|
|
|
251
|
-
export type AMRMethod = typeof AMRMethods[number] | (string & {})
|
|
269
|
+
export type AMRMethod = (typeof AMRMethods)[number] | (string & {})
|
|
252
270
|
|
|
253
271
|
/**
|
|
254
272
|
* An authentication methord reference (AMR) entry.
|
|
@@ -282,18 +300,19 @@ export interface UserIdentity {
|
|
|
282
300
|
updated_at?: string
|
|
283
301
|
}
|
|
284
302
|
|
|
285
|
-
|
|
303
|
+
const FactorTypes = ['totp', 'phone', 'webauthn'] as const
|
|
304
|
+
|
|
286
305
|
/**
|
|
287
306
|
* Type of factor. `totp` and `phone` supported with this version
|
|
288
307
|
*/
|
|
289
|
-
export type FactorType = typeof FactorTypes[number]
|
|
308
|
+
export type FactorType = (typeof FactorTypes)[number]
|
|
290
309
|
|
|
291
310
|
const FactorVerificationStatuses = ['verified', 'unverified'] as const
|
|
292
311
|
|
|
293
312
|
/**
|
|
294
313
|
* The verification status of the factor, default is `unverified` after `.enroll()`, then `verified` after the user verifies it with `.verify()`
|
|
295
314
|
*/
|
|
296
|
-
type FactorVerificationStatus = typeof FactorVerificationStatuses[number]
|
|
315
|
+
type FactorVerificationStatus = (typeof FactorVerificationStatuses)[number]
|
|
297
316
|
|
|
298
317
|
/**
|
|
299
318
|
* A MFA factor.
|
|
@@ -304,7 +323,7 @@ type FactorVerificationStatus = typeof FactorVerificationStatuses[number]
|
|
|
304
323
|
*/
|
|
305
324
|
export type Factor<
|
|
306
325
|
Type extends FactorType = FactorType,
|
|
307
|
-
Status extends FactorVerificationStatus = typeof FactorVerificationStatuses[number]
|
|
326
|
+
Status extends FactorVerificationStatus = (typeof FactorVerificationStatuses)[number],
|
|
308
327
|
> = {
|
|
309
328
|
/** ID of the factor. */
|
|
310
329
|
id: string
|
|
@@ -359,7 +378,7 @@ export interface User {
|
|
|
359
378
|
identities?: UserIdentity[]
|
|
360
379
|
is_anonymous?: boolean
|
|
361
380
|
is_sso_user?: boolean
|
|
362
|
-
factors?: Factor<FactorType>[]
|
|
381
|
+
factors?: (Factor<FactorType, 'verified'> | Factor<FactorType, 'unverified'>)[]
|
|
363
382
|
deleted_at?: string
|
|
364
383
|
}
|
|
365
384
|
|
|
@@ -853,7 +872,7 @@ export type GenerateLinkType =
|
|
|
853
872
|
| 'email_change_current'
|
|
854
873
|
| 'email_change_new'
|
|
855
874
|
|
|
856
|
-
export type MFAEnrollParams = MFAEnrollTOTPParams | MFAEnrollPhoneParams
|
|
875
|
+
export type MFAEnrollParams = MFAEnrollTOTPParams | MFAEnrollPhoneParams | MFAEnrollWebauthnParams
|
|
857
876
|
|
|
858
877
|
export type MFAUnenrollParams = {
|
|
859
878
|
/** ID of the factor being unenrolled. */
|
|
@@ -878,7 +897,40 @@ type MFAVerifyPhoneParamFields = MFAVerifyTOTPParamFields
|
|
|
878
897
|
|
|
879
898
|
export type MFAVerifyPhoneParams = Prettify<MFAVerifyParamsBase & MFAVerifyPhoneParamFields>
|
|
880
899
|
|
|
881
|
-
|
|
900
|
+
type MFAVerifyWebauthnParamFieldsBase = {
|
|
901
|
+
/** Relying party ID */
|
|
902
|
+
rpId: string
|
|
903
|
+
/** Relying party origins */
|
|
904
|
+
rpOrigins?: string[]
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
type MFAVerifyWebauthnCredentialParamFields<T extends 'create' | 'request' = 'create' | 'request'> =
|
|
908
|
+
{
|
|
909
|
+
/** Operation type */
|
|
910
|
+
type: T
|
|
911
|
+
/** Creation response from the authenticator (for enrollment/unverified factors) */
|
|
912
|
+
credential_response: T extends 'create' ? RegistrationCredential : AuthenticationCredential
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* WebAuthn-specific fields for MFA verification.
|
|
917
|
+
* Supports both credential creation (registration) and request (authentication) flows.
|
|
918
|
+
* @template T - Type of WebAuthn operation: 'create' for registration, 'request' for authentication
|
|
919
|
+
*/
|
|
920
|
+
export type MFAVerifyWebauthnParamFields<T extends 'create' | 'request' = 'create' | 'request'> = {
|
|
921
|
+
webauthn: MFAVerifyWebauthnParamFieldsBase & MFAVerifyWebauthnCredentialParamFields<T>
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Parameters for WebAuthn MFA verification.
|
|
926
|
+
* Used to verify WebAuthn credentials after challenge.
|
|
927
|
+
* @template T - Type of WebAuthn operation: 'create' for registration, 'request' for authentication
|
|
928
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying an Authentication Assertion}
|
|
929
|
+
*/
|
|
930
|
+
export type MFAVerifyWebauthnParams<T extends 'create' | 'request' = 'create' | 'request'> =
|
|
931
|
+
Prettify<MFAVerifyParamsBase & MFAVerifyWebauthnParamFields<T>>
|
|
932
|
+
|
|
933
|
+
export type MFAVerifyParams = MFAVerifyTOTPParams | MFAVerifyPhoneParams | MFAVerifyWebauthnParams
|
|
882
934
|
|
|
883
935
|
type MFAChallengeParamsBase = {
|
|
884
936
|
/** ID of the factor to be challenged. Returned in enroll(). */
|
|
@@ -886,7 +938,7 @@ type MFAChallengeParamsBase = {
|
|
|
886
938
|
}
|
|
887
939
|
|
|
888
940
|
const MFATOTPChannels = ['sms', 'whatsapp'] as const
|
|
889
|
-
export type MFATOTPChannel = typeof MFATOTPChannels[number]
|
|
941
|
+
export type MFATOTPChannel = (typeof MFATOTPChannels)[number]
|
|
890
942
|
|
|
891
943
|
export type MFAChallengeTOTPParams = Prettify<MFAChallengeParamsBase>
|
|
892
944
|
|
|
@@ -899,7 +951,29 @@ export type MFAChallengePhoneParams = Prettify<
|
|
|
899
951
|
MFAChallengeParamsBase & MFAChallengePhoneParamFields
|
|
900
952
|
>
|
|
901
953
|
|
|
902
|
-
|
|
954
|
+
/** WebAuthn parameters for WebAuthn factor challenge */
|
|
955
|
+
type MFAChallengeWebauthnParamFields = {
|
|
956
|
+
webauthn: {
|
|
957
|
+
/** Relying party ID */
|
|
958
|
+
rpId: string
|
|
959
|
+
/** Relying party origins*/
|
|
960
|
+
rpOrigins?: string[]
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* Parameters for initiating a WebAuthn MFA challenge.
|
|
966
|
+
* Includes Relying Party information needed for WebAuthn ceremonies.
|
|
967
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-rp-operations W3C WebAuthn Spec - Relying Party Operations}
|
|
968
|
+
*/
|
|
969
|
+
export type MFAChallengeWebauthnParams = Prettify<
|
|
970
|
+
MFAChallengeParamsBase & MFAChallengeWebauthnParamFields
|
|
971
|
+
>
|
|
972
|
+
|
|
973
|
+
export type MFAChallengeParams =
|
|
974
|
+
| MFAChallengeTOTPParams
|
|
975
|
+
| MFAChallengePhoneParams
|
|
976
|
+
| MFAChallengeWebauthnParams
|
|
903
977
|
|
|
904
978
|
type MFAChallengeAndVerifyParamsBase = Omit<MFAVerifyParamsBase, 'challengeId'>
|
|
905
979
|
|
|
@@ -909,17 +983,13 @@ type MFAChallengeAndVerifyTOTPParams = Prettify<
|
|
|
909
983
|
MFAChallengeAndVerifyParamsBase & MFAChallengeAndVerifyTOTPParamFields
|
|
910
984
|
>
|
|
911
985
|
|
|
912
|
-
type
|
|
913
|
-
|
|
914
|
-
type MFAChallengeAndVerifyPhoneParams = Prettify<
|
|
915
|
-
MFAChallengeAndVerifyParamsBase & MFAChallengeAndVerifyPhoneParamFields
|
|
916
|
-
>
|
|
917
|
-
|
|
918
|
-
export type MFAChallengeAndVerifyParams =
|
|
919
|
-
| MFAChallengeAndVerifyTOTPParams
|
|
920
|
-
| MFAChallengeAndVerifyPhoneParams
|
|
986
|
+
export type MFAChallengeAndVerifyParams = MFAChallengeAndVerifyTOTPParams
|
|
921
987
|
|
|
922
|
-
|
|
988
|
+
/**
|
|
989
|
+
* Data returned after successful MFA verification.
|
|
990
|
+
* Contains new session tokens and updated user information.
|
|
991
|
+
*/
|
|
992
|
+
export type AuthMFAVerifyResponseData = {
|
|
923
993
|
/** New access token (JWT) after successful verification. */
|
|
924
994
|
access_token: string
|
|
925
995
|
|
|
@@ -934,16 +1004,25 @@ export type AuthMFAVerifyResponse = RequestResult<{
|
|
|
934
1004
|
|
|
935
1005
|
/** Updated user profile. */
|
|
936
1006
|
user: User
|
|
937
|
-
}
|
|
1007
|
+
}
|
|
938
1008
|
|
|
939
|
-
|
|
1009
|
+
/**
|
|
1010
|
+
* Response type for MFA verification operations.
|
|
1011
|
+
* Returns session tokens on successful verification.
|
|
1012
|
+
*/
|
|
1013
|
+
export type AuthMFAVerifyResponse = RequestResult<AuthMFAVerifyResponseData>
|
|
1014
|
+
|
|
1015
|
+
export type AuthMFAEnrollResponse =
|
|
1016
|
+
| AuthMFAEnrollTOTPResponse
|
|
1017
|
+
| AuthMFAEnrollPhoneResponse
|
|
1018
|
+
| AuthMFAEnrollWebauthnResponse
|
|
940
1019
|
|
|
941
1020
|
export type AuthMFAUnenrollResponse = RequestResult<{
|
|
942
1021
|
/** ID of the factor that was successfully unenrolled. */
|
|
943
1022
|
id: string
|
|
944
1023
|
}>
|
|
945
1024
|
|
|
946
|
-
|
|
1025
|
+
type AuthMFAChallengeResponseBase<T extends FactorType> = {
|
|
947
1026
|
/** ID of the newly created challenge. */
|
|
948
1027
|
id: string
|
|
949
1028
|
|
|
@@ -952,7 +1031,76 @@ export type AuthMFAChallengeResponse<T extends FactorType> = RequestResult<{
|
|
|
952
1031
|
|
|
953
1032
|
/** Timestamp in UNIX seconds when this challenge will no longer be usable. */
|
|
954
1033
|
expires_at: number
|
|
955
|
-
}
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
type AuthMFAChallengeTOTPResponseFields = {
|
|
1037
|
+
/** no extra fields for now, kept for consistency and for possible future changes */
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
export type AuthMFAChallengeTOTPResponse = RequestResult<
|
|
1041
|
+
Prettify<AuthMFAChallengeResponseBase<'totp'> & AuthMFAChallengeTOTPResponseFields>
|
|
1042
|
+
>
|
|
1043
|
+
|
|
1044
|
+
type AuthMFAChallengePhoneResponseFields = {
|
|
1045
|
+
/** no extra fields for now, kept for consistency and for possible future changes */
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
export type AuthMFAChallengePhoneResponse = RequestResult<
|
|
1049
|
+
Prettify<AuthMFAChallengeResponseBase<'phone'> & AuthMFAChallengePhoneResponseFields>
|
|
1050
|
+
>
|
|
1051
|
+
|
|
1052
|
+
type AuthMFAChallengeWebauthnResponseFields = {
|
|
1053
|
+
webauthn:
|
|
1054
|
+
| {
|
|
1055
|
+
type: 'create'
|
|
1056
|
+
credential_options: { publicKey: PublicKeyCredentialCreationOptionsFuture }
|
|
1057
|
+
}
|
|
1058
|
+
| {
|
|
1059
|
+
type: 'request'
|
|
1060
|
+
credential_options: { publicKey: PublicKeyCredentialRequestOptionsFuture }
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Response type for WebAuthn MFA challenge.
|
|
1066
|
+
* Contains credential creation or request options from the server.
|
|
1067
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-credential-creation W3C WebAuthn Spec - Credential Creation}
|
|
1068
|
+
*/
|
|
1069
|
+
export type AuthMFAChallengeWebauthnResponse = RequestResult<
|
|
1070
|
+
Prettify<AuthMFAChallengeResponseBase<'webauthn'> & AuthMFAChallengeWebauthnResponseFields>
|
|
1071
|
+
>
|
|
1072
|
+
|
|
1073
|
+
type AuthMFAChallengeWebauthnResponseFieldsJSON = {
|
|
1074
|
+
webauthn:
|
|
1075
|
+
| {
|
|
1076
|
+
type: 'create'
|
|
1077
|
+
credential_options: { publicKey: ServerCredentialCreationOptions }
|
|
1078
|
+
}
|
|
1079
|
+
| {
|
|
1080
|
+
type: 'request'
|
|
1081
|
+
credential_options: { publicKey: ServerCredentialRequestOptions }
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* JSON-serializable version of WebAuthn challenge response.
|
|
1087
|
+
* Used for server communication with base64url-encoded binary fields.
|
|
1088
|
+
*/
|
|
1089
|
+
export type AuthMFAChallengeWebauthnResponseDataJSON = Prettify<
|
|
1090
|
+
AuthMFAChallengeResponseBase<'webauthn'> & AuthMFAChallengeWebauthnResponseFieldsJSON
|
|
1091
|
+
>
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* Server response type for WebAuthn MFA challenge.
|
|
1095
|
+
* Contains JSON-formatted WebAuthn options ready for browser API.
|
|
1096
|
+
*/
|
|
1097
|
+
export type AuthMFAChallengeWebauthnServerResponse =
|
|
1098
|
+
RequestResult<AuthMFAChallengeWebauthnResponseDataJSON>
|
|
1099
|
+
|
|
1100
|
+
export type AuthMFAChallengeResponse =
|
|
1101
|
+
| AuthMFAChallengeTOTPResponse
|
|
1102
|
+
| AuthMFAChallengePhoneResponse
|
|
1103
|
+
| AuthMFAChallengeWebauthnResponse
|
|
956
1104
|
|
|
957
1105
|
/** response of ListFactors, which should contain all the types of factors that are available, this ensures we always include all */
|
|
958
1106
|
export type AuthMFAListFactorsResponse<T extends typeof FactorTypes = typeof FactorTypes> =
|
|
@@ -1005,17 +1153,17 @@ export interface GoTrueMFAApi {
|
|
|
1005
1153
|
*/
|
|
1006
1154
|
enroll(params: MFAEnrollTOTPParams): Promise<AuthMFAEnrollTOTPResponse>
|
|
1007
1155
|
enroll(params: MFAEnrollPhoneParams): Promise<AuthMFAEnrollPhoneResponse>
|
|
1156
|
+
enroll(params: MFAEnrollWebauthnParams): Promise<AuthMFAEnrollWebauthnResponse>
|
|
1008
1157
|
enroll(params: MFAEnrollParams): Promise<AuthMFAEnrollResponse>
|
|
1009
1158
|
|
|
1010
1159
|
/**
|
|
1011
1160
|
* Prepares a challenge used to verify that a user has access to a MFA
|
|
1012
1161
|
* factor.
|
|
1013
1162
|
*/
|
|
1014
|
-
challenge(params: MFAChallengeTOTPParams): Promise<Prettify<
|
|
1015
|
-
challenge(params: MFAChallengePhoneParams): Promise<Prettify<
|
|
1016
|
-
challenge(
|
|
1017
|
-
|
|
1018
|
-
): Promise<Prettify<AuthMFAChallengeResponse<'totp' | 'phone'>>>
|
|
1163
|
+
challenge(params: MFAChallengeTOTPParams): Promise<Prettify<AuthMFAChallengeTOTPResponse>>
|
|
1164
|
+
challenge(params: MFAChallengePhoneParams): Promise<Prettify<AuthMFAChallengePhoneResponse>>
|
|
1165
|
+
challenge(params: MFAChallengeWebauthnParams): Promise<Prettify<AuthMFAChallengeWebauthnResponse>>
|
|
1166
|
+
challenge(params: MFAChallengeParams): Promise<AuthMFAChallengeResponse>
|
|
1019
1167
|
|
|
1020
1168
|
/**
|
|
1021
1169
|
* Verifies a code against a challenge. The verification code is
|
|
@@ -1023,6 +1171,7 @@ export interface GoTrueMFAApi {
|
|
|
1023
1171
|
*/
|
|
1024
1172
|
verify(params: MFAVerifyTOTPParams): Promise<AuthMFAVerifyResponse>
|
|
1025
1173
|
verify(params: MFAVerifyPhoneParams): Promise<AuthMFAVerifyResponse>
|
|
1174
|
+
verify(params: MFAVerifyWebauthnParams): Promise<AuthMFAVerifyResponse>
|
|
1026
1175
|
verify(params: MFAVerifyParams): Promise<AuthMFAVerifyResponse>
|
|
1027
1176
|
|
|
1028
1177
|
/**
|
|
@@ -1061,6 +1210,9 @@ export interface GoTrueMFAApi {
|
|
|
1061
1210
|
*
|
|
1062
1211
|
*/
|
|
1063
1212
|
getAuthenticatorAssuranceLevel(): Promise<AuthMFAGetAuthenticatorAssuranceLevelResponse>
|
|
1213
|
+
|
|
1214
|
+
// namespace for the webauthn methods
|
|
1215
|
+
webauthn: WebAuthnApi
|
|
1064
1216
|
}
|
|
1065
1217
|
|
|
1066
1218
|
/**
|
|
@@ -1196,6 +1348,19 @@ export type MFAEnrollPhoneParams = Prettify<
|
|
|
1196
1348
|
MFAEnrollParamsBase<'phone'> & MFAEnrollPhoneParamFields
|
|
1197
1349
|
>
|
|
1198
1350
|
|
|
1351
|
+
type MFAEnrollWebauthnFields = {
|
|
1352
|
+
/** no extra fields for now, kept for consistency and for possible future changes */
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Parameters for enrolling a WebAuthn factor.
|
|
1357
|
+
* Creates an unverified WebAuthn factor that must be verified with a credential.
|
|
1358
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
1359
|
+
*/
|
|
1360
|
+
export type MFAEnrollWebauthnParams = Prettify<
|
|
1361
|
+
MFAEnrollParamsBase<'webauthn'> & MFAEnrollWebauthnFields
|
|
1362
|
+
>
|
|
1363
|
+
|
|
1199
1364
|
type AuthMFAEnrollResponseBase<T extends FactorType> = {
|
|
1200
1365
|
/** ID of the factor that was just enrolled (in an unverified state). */
|
|
1201
1366
|
id: string
|
|
@@ -1234,10 +1399,24 @@ type AuthMFAEnrollPhoneResponseFields = {
|
|
|
1234
1399
|
/** Phone number of the MFA factor in E.164 format. Used to send messages */
|
|
1235
1400
|
phone: string
|
|
1236
1401
|
}
|
|
1402
|
+
|
|
1237
1403
|
export type AuthMFAEnrollPhoneResponse = RequestResult<
|
|
1238
1404
|
Prettify<AuthMFAEnrollResponseBase<'phone'> & AuthMFAEnrollPhoneResponseFields>
|
|
1239
1405
|
>
|
|
1240
1406
|
|
|
1407
|
+
type AuthMFAEnrollWebauthnFields = {
|
|
1408
|
+
/** no extra fields for now, kept for consistency and for possible future changes */
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* Response type for WebAuthn factor enrollment.
|
|
1413
|
+
* Returns the enrolled factor ID and metadata.
|
|
1414
|
+
* @see {@link https://w3c.github.io/webauthn/#sctn-registering-a-new-credential W3C WebAuthn Spec - Registering a New Credential}
|
|
1415
|
+
*/
|
|
1416
|
+
export type AuthMFAEnrollWebauthnResponse = RequestResult<
|
|
1417
|
+
Prettify<AuthMFAEnrollResponseBase<'webauthn'> & AuthMFAEnrollWebauthnFields>
|
|
1418
|
+
>
|
|
1419
|
+
|
|
1241
1420
|
export type JwtHeader = {
|
|
1242
1421
|
alg: 'RS256' | 'ES256' | 'HS256'
|
|
1243
1422
|
kid: string
|
|
@@ -1268,4 +1447,4 @@ export interface JWK {
|
|
|
1268
1447
|
}
|
|
1269
1448
|
|
|
1270
1449
|
export const SIGN_OUT_SCOPES = ['global', 'local', 'others'] as const
|
|
1271
|
-
export type SignOutScope = typeof SIGN_OUT_SCOPES[number]
|
|
1450
|
+
export type SignOutScope = (typeof SIGN_OUT_SCOPES)[number]
|
package/src/lib/version.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// Generated automatically during releases by scripts/update-version-files.ts
|
|
2
|
+
// This file provides runtime access to the package version for:
|
|
3
|
+
// - HTTP request headers (e.g., X-Client-Info header for API requests)
|
|
4
|
+
// - Debugging and support (identifying which version is running)
|
|
5
|
+
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
|
+
// - Ensuring build artifacts match the published package version
|
|
7
|
+
export const version = '2.79.1-canary.0'
|