@supabase/auth-js 2.116.0 → 2.117.0-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/dist/main/GoTrueClient.d.ts +25 -0
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +27 -1
- package/dist/main/GoTrueClient.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/types.d.ts +28 -0
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.d.ts.map +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/lib/version.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts +25 -0
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +27 -1
- package/dist/module/GoTrueClient.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/types.d.ts +28 -0
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.d.ts.map +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/lib/version.js.map +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/GoTrueClient.ts +26 -0
- package/src/lib/error-codes.ts +1 -0
- package/src/lib/types.ts +28 -0
- package/src/lib/version.ts +1 -1
package/package.json
CHANGED
package/src/GoTrueClient.ts
CHANGED
|
@@ -6803,9 +6803,34 @@ export default class GoTrueClient {
|
|
|
6803
6803
|
* 2. Prompts user via navigator.credentials.get()
|
|
6804
6804
|
* 3. Verifies credential with server and creates session
|
|
6805
6805
|
*
|
|
6806
|
+
* Pass `options.mediation: 'conditional'` to use WebAuthn Conditional UI
|
|
6807
|
+
* (passkey autofill) instead of the modal picker; the value is forwarded to
|
|
6808
|
+
* `navigator.credentials.get()` unchanged.
|
|
6809
|
+
*
|
|
6810
|
+
* The challenge fetched in step 1 expires after the server's
|
|
6811
|
+
* GOTRUE_WEBAUTHN_CHALLENGE_EXPIRY_DURATION (5 minutes by default). With
|
|
6812
|
+
* `mediation: 'conditional'` the autofill prompt can stay pending for longer
|
|
6813
|
+
* than that: the browser ceremony then still succeeds, but verification fails
|
|
6814
|
+
* with `error_code: "webauthn_challenge_expired"`. Recover by calling
|
|
6815
|
+
* `signInWithPasskey()` again. It fetches a fresh challenge and, unless you
|
|
6816
|
+
* passed your own `options.signal`, cancels the pending ceremony first, so
|
|
6817
|
+
* the browser never sees two concurrent WebAuthn requests; the earlier call
|
|
6818
|
+
* resolves with a `WebAuthnError` whose code is `ERROR_CEREMONY_ABORTED`. If
|
|
6819
|
+
* you pass your own `signal`, abort it before retrying.
|
|
6820
|
+
*
|
|
6806
6821
|
* Requires `auth.experimental.passkey: true`.
|
|
6807
6822
|
*
|
|
6808
6823
|
* @category Auth
|
|
6824
|
+
*
|
|
6825
|
+
* @example Sign in with Conditional UI (passkey autofill)
|
|
6826
|
+
* ```js
|
|
6827
|
+
* // <input autocomplete="username webauthn" /> somewhere on the page
|
|
6828
|
+
* const { data, error } = await supabase.auth.signInWithPasskey({
|
|
6829
|
+
* options: {
|
|
6830
|
+
* mediation: 'conditional'
|
|
6831
|
+
* }
|
|
6832
|
+
* });
|
|
6833
|
+
* ```
|
|
6809
6834
|
*/
|
|
6810
6835
|
async signInWithPasskey(
|
|
6811
6836
|
credentials?: SignInWithPasskeyCredentials
|
|
@@ -6833,6 +6858,7 @@ export default class GoTrueClient {
|
|
|
6833
6858
|
const { data: credential, error: credentialError } = await getCredential({
|
|
6834
6859
|
publicKey: publicKeyOptions,
|
|
6835
6860
|
signal,
|
|
6861
|
+
mediation: credentials?.options?.mediation,
|
|
6836
6862
|
})
|
|
6837
6863
|
if (credentialError || !credential) {
|
|
6838
6864
|
return this._returnResult({
|
package/src/lib/error-codes.ts
CHANGED
package/src/lib/types.ts
CHANGED
|
@@ -3141,6 +3141,7 @@ export type PasskeyMetadata = {
|
|
|
3141
3141
|
export type PasskeyAuthenticationOptionsResponse = {
|
|
3142
3142
|
challenge_id: string
|
|
3143
3143
|
options: ServerCredentialRequestOptions
|
|
3144
|
+
/** Timestamp in UNIX seconds when this challenge will no longer be usable. */
|
|
3144
3145
|
expires_at: number
|
|
3145
3146
|
}
|
|
3146
3147
|
|
|
@@ -3164,6 +3165,33 @@ export type SignInWithPasskeyCredentials = {
|
|
|
3164
3165
|
options?: {
|
|
3165
3166
|
captchaToken?: string
|
|
3166
3167
|
signal?: AbortSignal
|
|
3168
|
+
/**
|
|
3169
|
+
* Forwarded to `navigator.credentials.get()` as `mediation`.
|
|
3170
|
+
*
|
|
3171
|
+
* Use `'conditional'` to opt into WebAuthn Conditional UI, where the browser
|
|
3172
|
+
* offers passkeys through the autofill prompt instead of a modal picker. The
|
|
3173
|
+
* page also needs an input with `autocomplete="username webauthn"`.
|
|
3174
|
+
*
|
|
3175
|
+
* When omitted the browser's default (modal) behavior is used.
|
|
3176
|
+
*
|
|
3177
|
+
* Note that the server-side challenge expires (5 minutes by default) while
|
|
3178
|
+
* the autofill prompt can stay pending indefinitely; if the user picks a
|
|
3179
|
+
* passkey after that, verification fails with
|
|
3180
|
+
* `error_code: "webauthn_challenge_expired"` and the app should call
|
|
3181
|
+
* `signInWithPasskey()` again. See `signInWithPasskey` for details.
|
|
3182
|
+
*
|
|
3183
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get#mediation MDN - mediation}
|
|
3184
|
+
*
|
|
3185
|
+
* @example
|
|
3186
|
+
* ```ts
|
|
3187
|
+
* const credentials: SignInWithPasskeyCredentials = {
|
|
3188
|
+
* options: {
|
|
3189
|
+
* mediation: 'conditional'
|
|
3190
|
+
* }
|
|
3191
|
+
* }
|
|
3192
|
+
* ```
|
|
3193
|
+
*/
|
|
3194
|
+
mediation?: CredentialMediationRequirement
|
|
3167
3195
|
}
|
|
3168
3196
|
}
|
|
3169
3197
|
|
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 = '2.
|
|
7
|
+
export const version = '2.117.0-canary.0'
|