@supabase/auth-js 3.0.0-next.0 → 3.0.0-next.10
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/dist/main/GoTrueAdminApi.d.ts +28 -4
- package/dist/main/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/main/GoTrueAdminApi.js +50 -3
- package/dist/main/GoTrueAdminApi.js.map +1 -1
- package/dist/main/GoTrueClient.d.ts +65 -3
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +348 -7
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/fetch.d.ts +1 -1
- package/dist/main/lib/fetch.d.ts.map +1 -1
- package/dist/main/lib/helpers.d.ts +3 -0
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +7 -1
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/types.d.ts +128 -1
- 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.d.ts.map +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/lib/version.js.map +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.js +1 -0
- package/dist/main/lib/webauthn.js.map +1 -1
- package/dist/module/GoTrueAdminApi.d.ts +28 -4
- package/dist/module/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/module/GoTrueAdminApi.js +51 -4
- package/dist/module/GoTrueAdminApi.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts +65 -3
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +350 -9
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/fetch.d.ts +1 -1
- package/dist/module/lib/fetch.d.ts.map +1 -1
- package/dist/module/lib/helpers.d.ts +3 -0
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js +6 -1
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/types.d.ts +128 -1
- 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.d.ts.map +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/lib/version.js.map +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.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/package.json +1 -1
- package/src/GoTrueAdminApi.ts +82 -3
- package/src/GoTrueClient.ts +440 -4
- package/src/lib/fetch.ts +1 -1
- package/src/lib/helpers.ts +9 -1
- package/src/lib/types.ts +178 -0
- package/src/lib/version.ts +1 -1
- 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,
|
|
@@ -174,6 +180,27 @@ export type GoTrueClientOptions = {
|
|
|
174
180
|
* @default false
|
|
175
181
|
*/
|
|
176
182
|
skipAutoInitialize?: boolean
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Opt-in flags for experimental features. These APIs may change without
|
|
186
|
+
* notice and are disabled by default.
|
|
187
|
+
*
|
|
188
|
+
* @experimental
|
|
189
|
+
*/
|
|
190
|
+
experimental?: ExperimentalFeatureFlags
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export type ExperimentalFeatureFlags = {
|
|
194
|
+
/**
|
|
195
|
+
* Enables passkey support:
|
|
196
|
+
* - `auth.signInWithPasskey()`, `auth.registerPasskey()`
|
|
197
|
+
* - `auth.passkey.*`
|
|
198
|
+
* - `auth.admin.passkey.*`
|
|
199
|
+
*
|
|
200
|
+
* Defaults to `false`. Calling any passkey method while this flag is
|
|
201
|
+
* disabled throws a descriptive error at call time.
|
|
202
|
+
*/
|
|
203
|
+
passkey?: boolean
|
|
177
204
|
}
|
|
178
205
|
|
|
179
206
|
const WeakPasswordReasons = ['length', 'characters', 'pwned'] as const
|
|
@@ -2624,3 +2651,154 @@ export interface AuthOAuthServerApi {
|
|
|
2624
2651
|
*/
|
|
2625
2652
|
revokeGrant(options: { clientId: string }): Promise<AuthOAuthRevokeGrantResponse>
|
|
2626
2653
|
}
|
|
2654
|
+
|
|
2655
|
+
// --- Passkey Types ---
|
|
2656
|
+
|
|
2657
|
+
/** Response from POST /passkeys/registration/options */
|
|
2658
|
+
export type PasskeyRegistrationOptionsResponse = {
|
|
2659
|
+
challenge_id: string
|
|
2660
|
+
options: ServerCredentialCreationOptions
|
|
2661
|
+
expires_at: number
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
/** Request body for POST /passkeys/registration/verify */
|
|
2665
|
+
export type PasskeyRegistrationVerifyParams = {
|
|
2666
|
+
challenge_id: string
|
|
2667
|
+
credential: RegistrationResponseJSON
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2670
|
+
/** Response from POST /passkeys/registration/verify */
|
|
2671
|
+
export type PasskeyMetadata = {
|
|
2672
|
+
id: string
|
|
2673
|
+
friendly_name?: string
|
|
2674
|
+
created_at: string
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
/** Response from POST /passkeys/authentication/options */
|
|
2678
|
+
export type PasskeyAuthenticationOptionsResponse = {
|
|
2679
|
+
challenge_id: string
|
|
2680
|
+
options: ServerCredentialRequestOptions
|
|
2681
|
+
expires_at: number
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
/** Request body for POST /passkeys/authentication/verify */
|
|
2685
|
+
export type PasskeyAuthenticationVerifyParams = {
|
|
2686
|
+
challenge_id: string
|
|
2687
|
+
credential: AuthenticationResponseJSON
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
/** Item in the passkeys list (GET /passkeys/ and admin list) */
|
|
2691
|
+
export type PasskeyListItem = {
|
|
2692
|
+
id: string
|
|
2693
|
+
friendly_name?: string
|
|
2694
|
+
created_at: string
|
|
2695
|
+
last_used_at?: string
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
// --- Passkey SDK Method Parameter/Response Types ---
|
|
2699
|
+
|
|
2700
|
+
export type SignInWithPasskeyCredentials = {
|
|
2701
|
+
options?: {
|
|
2702
|
+
captchaToken?: string
|
|
2703
|
+
signal?: AbortSignal
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
export type RegisterPasskeyCredentials = {
|
|
2708
|
+
options?: {
|
|
2709
|
+
signal?: AbortSignal
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
|
|
2713
|
+
export type VerifyPasskeyRegistrationParams = {
|
|
2714
|
+
/** Challenge ID from startRegistration */
|
|
2715
|
+
challengeId: string
|
|
2716
|
+
/** Serialized credential from navigator.credentials.create() */
|
|
2717
|
+
credential: ServerCredentialResponse
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
export type StartPasskeyAuthenticationParams = {
|
|
2721
|
+
options?: {
|
|
2722
|
+
captchaToken?: string
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
export type VerifyPasskeyAuthenticationParams = {
|
|
2727
|
+
/** Challenge ID from startAuthentication */
|
|
2728
|
+
challengeId: string
|
|
2729
|
+
/** Serialized credential from navigator.credentials.get() */
|
|
2730
|
+
credential: ServerCredentialResponse
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
export type PasskeyUpdateParams = {
|
|
2734
|
+
/** UUID of the passkey to update */
|
|
2735
|
+
passkeyId: string
|
|
2736
|
+
/** New friendly name (max 120 chars) */
|
|
2737
|
+
friendlyName: string
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
export type PasskeyDeleteParams = {
|
|
2741
|
+
/** UUID of the passkey to delete */
|
|
2742
|
+
passkeyId: string
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
// --- Passkey Response Types ---
|
|
2746
|
+
|
|
2747
|
+
export type AuthPasskeyRegistrationOptionsResponse =
|
|
2748
|
+
RequestResult<PasskeyRegistrationOptionsResponse>
|
|
2749
|
+
export type AuthPasskeyRegistrationVerifyResponse = RequestResult<
|
|
2750
|
+
PasskeyMetadata,
|
|
2751
|
+
WebAuthnError | AuthError
|
|
2752
|
+
>
|
|
2753
|
+
export type AuthPasskeyAuthenticationOptionsResponse =
|
|
2754
|
+
RequestResult<PasskeyAuthenticationOptionsResponse>
|
|
2755
|
+
export type AuthPasskeyAuthenticationVerifyResponse = RequestResult<
|
|
2756
|
+
{ session: Session | null; user: User | null },
|
|
2757
|
+
WebAuthnError | AuthError
|
|
2758
|
+
>
|
|
2759
|
+
export type AuthPasskeyListResponse = RequestResult<PasskeyListItem[]>
|
|
2760
|
+
export type AuthPasskeyUpdateResponse = RequestResult<PasskeyListItem>
|
|
2761
|
+
export type AuthPasskeyDeleteResponse = RequestResult<null>
|
|
2762
|
+
|
|
2763
|
+
// --- Passkey Admin Types ---
|
|
2764
|
+
|
|
2765
|
+
export type AuthPasskeyAdminListParams = {
|
|
2766
|
+
userId: string
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
export type AuthPasskeyAdminDeleteParams = {
|
|
2770
|
+
userId: string
|
|
2771
|
+
passkeyId: string
|
|
2772
|
+
}
|
|
2773
|
+
|
|
2774
|
+
// --- Passkey Namespace Interfaces ---
|
|
2775
|
+
|
|
2776
|
+
/**
|
|
2777
|
+
* Lower-level two-step API and management methods for passkeys.
|
|
2778
|
+
* Access via `supabase.auth.passkey`.
|
|
2779
|
+
*/
|
|
2780
|
+
export interface AuthPasskeyApi {
|
|
2781
|
+
// Two-step registration
|
|
2782
|
+
startRegistration(): Promise<AuthPasskeyRegistrationOptionsResponse>
|
|
2783
|
+
verifyRegistration(
|
|
2784
|
+
params: VerifyPasskeyRegistrationParams
|
|
2785
|
+
): Promise<AuthPasskeyRegistrationVerifyResponse>
|
|
2786
|
+
|
|
2787
|
+
// Two-step authentication
|
|
2788
|
+
startAuthentication(
|
|
2789
|
+
params?: StartPasskeyAuthenticationParams
|
|
2790
|
+
): Promise<AuthPasskeyAuthenticationOptionsResponse>
|
|
2791
|
+
verifyAuthentication(
|
|
2792
|
+
params: VerifyPasskeyAuthenticationParams
|
|
2793
|
+
): Promise<AuthPasskeyAuthenticationVerifyResponse>
|
|
2794
|
+
|
|
2795
|
+
// Management
|
|
2796
|
+
list(): Promise<AuthPasskeyListResponse>
|
|
2797
|
+
update(params: PasskeyUpdateParams): Promise<AuthPasskeyUpdateResponse>
|
|
2798
|
+
delete(params: PasskeyDeleteParams): Promise<AuthPasskeyDeleteResponse>
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
export interface GoTrueAdminPasskeyApi {
|
|
2802
|
+
listPasskeys(params: AuthPasskeyAdminListParams): Promise<AuthPasskeyListResponse>
|
|
2803
|
+
deletePasskey(params: AuthPasskeyAdminDeleteParams): Promise<AuthPasskeyDeleteResponse>
|
|
2804
|
+
}
|
package/src/lib/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '3.0.0-next.
|
|
7
|
+
export const version = '3.0.0-next.10'
|
package/src/lib/webauthn.ts
CHANGED
|
@@ -356,7 +356,7 @@ export function isValidDomain(hostname: string): boolean {
|
|
|
356
356
|
* @returns {boolean} True if browser supports WebAuthn
|
|
357
357
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential#browser_compatibility MDN - PublicKeyCredential Browser Compatibility}
|
|
358
358
|
*/
|
|
359
|
-
function browserSupportsWebAuthn(): boolean {
|
|
359
|
+
export function browserSupportsWebAuthn(): boolean {
|
|
360
360
|
return !!(
|
|
361
361
|
isBrowser() &&
|
|
362
362
|
'PublicKeyCredential' in window &&
|