Skip to content

feat(supabase_flutter): add passkey ceremony helpers - #1408

Merged
spydon merged 3 commits into
mainfrom
feat/passkey-ceremony-helpers
Jun 16, 2026
Merged

spydon merged 3 commits into
mainfrom
feat/passkey-ceremony-helpers

Conversation

@spydon

@spydon spydon commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

📚 Stacked on #1409 (min SDK bump). Review/merge that first; this PR is based on its branch and GitHub will retarget it to main automatically once #1409 merges.

What

Adds two convenience methods on GoTrueClient so developers using passkeys no longer have to hand-write the platform WebAuthn ceremony:

  • supabase.auth.signInWithPasskey({captchaToken})
  • supabase.auth.registerPasskey()

Each runs the full flow end to end: start the challenge with the Supabase server, perform the platform prompt (FaceID/TouchID/security key), and verify the credential with the server.

Why

gotrue already exposes the server side of the ceremony (supabase.auth.passkey.*), but the client side was left entirely to developers. The only reference was a web-only, hand-written dart:js_interop bridge, with nothing for iOS/Android/macOS. This moves that work into the library.

How

  • Pulls in the cross-platform passkeys plugin to drive the ceremony on every supported platform (web included).
  • A thin mapper (passkey_options_mapper.dart) converts gotrue's W3C PublicKeyCredentialCreationOptionsJSON / RequestOptionsJSON into the plugin's request types. The plugin's fromJson already reads the same W3C field names, so this is nearly a passthrough; the only normalizations are stripping base64url padding from the challenge/credential ids and defaulting transports to []. The response direction is free (toJson() already matches what gotrue's verify* expects).
  • The new extension and the gotrue passkey API are marked @experimental.

Web

Uses the passkeys package on web as well, for a single code path and wider browser support. Web adopters include the package's bundle.js in index.html (documented in the README). The lightweight js_interop bridge was intentionally not kept/contributed upstream, since Corbado's bundle exists for real reasons (broader browser support, conditional UI, support detection).

Notes

  • passkeys does not support Linux; linux stays in platforms: (removing it would break non-passkey Linux users), so passkey calls there fail at runtime rather than at build time.
  • Platform setup the library cannot do (Associated Domains, assetlinks.json, web bundle.js) is documented in the package README.

Test plan

  • flutter analyze clean, dart format applied
  • Full supabase_flutter suite passing (49/49), including new mapper unit tests (field passthrough, padding stripping, transports defaulting)
  • Manual end-to-end run against a project with passkeys enabled, on web and one native platform

@spydon
spydon force-pushed the feat/passkey-ceremony-helpers branch from 17544a8 to c868ba2 Compare June 15, 2026 15:45
@spydon
spydon changed the base branch from main to chore/bump-min-sdk-3.4 June 15, 2026 15:45
spydon added a commit that referenced this pull request Jun 15, 2026
## What

Raises the minimum Dart SDK to `>=3.4.0` for **every package** in the
workspace (functions_client, gotrue, postgrest, realtime_client,
storage_client, supabase, supabase_flutter, yet_another_json_isolate) so
the floor is consistent across the repo. Also:

- `supabase_flutter`: `environment.flutter` `>=3.19.0` → `>=3.22.0` (the
release that bundled Dart 3.4.0)
- CI: the `test-flutter` matrix floor `3.19.x` → `3.22.x`
- Example app: corrects its stale `>=2.15.0 <3.0.0` constraint to
`>=3.4.0 <4.0.0`

## Why

`supabase_flutter` needs Dart 3.4.0 to add the
[`passkeys`](https://pub.dev/packages/passkeys) plugin (see the stacked
passkey PR #1408): `passkeys` → `passkeys_web ^2.8.1` → `web ^1.1.1`,
and `web >=1.0.0` requires Dart `>=3.4.0`.

```
Because passkeys >=2.17.4 depends on passkeys_web ^2.8.1 which depends on web ^1.1.1,
passkeys >=2.17.4 requires web ^1.1.1.
So, because web >=1.0.0 requires SDK version >=3.4.0 <4.0.0 ...
```

Bumping every package keeps the supported-SDK floor uniform rather than
having `supabase_flutter` diverge from the rest.

> Note: `passkeys`/`passkeys_web` themselves declare `sdk: ">=3.0.0"`
even though they really require 3.4.0. Submitted an upstream fix for
that so the constraint is honest: corbado/flutter-passkeys#243.

## Note

Raising the minimum SDK is a breaking change for consumers still on Dart
3.3.x, so this should land in a minor/major release rather than a patch.

## Test plan

- [x] `melos bootstrap` resolves all 9 packages on Dart 3.4.0+
- [x] CI matrix updated so the min-version job uses an SDK that
satisfies the new floor
Base automatically changed from chore/bump-min-sdk-3.4 to main June 15, 2026 20:48
@spydon
spydon marked this pull request as ready for review June 16, 2026 09:45
@spydon
spydon requested a review from a team as a code owner June 16, 2026 09:45
spydon added a commit that referenced this pull request Jun 16, 2026
Drop the hand-written js_interop authenticator and the manual two-step
start/verify flows now that supabase_flutter exposes registerPasskey() and
signInWithPasskey() (#1408). Load the passkeys web bundle in index.html.
@spydon
spydon force-pushed the feat/passkey-ceremony-helpers branch from 5c80b7e to 77d3dc6 Compare June 16, 2026 09:59
spydon added 2 commits June 16, 2026 12:06
Add registerPasskey() and signInWithPasskey() on GoTrueClient so
developers no longer have to hand-write the platform WebAuthn ceremony.
The ceremony is driven by the cross-platform passkeys plugin, and a thin
mapper converts gotrue's W3C options into the plugin's request types.
… passkeys

The bundled passkeys plugin requires iOS 16.0 / macOS 13.5 (its
PasskeysPlugin is gated with @available), and Flutter registers it
unconditionally, so the example app fails to build below those
versions. Bump the example deployment targets and document that
consumers must target at least iOS 16.0 / macOS 13.5.
@spydon
spydon force-pushed the feat/passkey-ceremony-helpers branch from 77d3dc6 to b9c92c4 Compare June 16, 2026 10:06
The passkeys plugin pulls device_info_plus transitively via
passkeys_doctor. From 12.4.0 it calls the iOS 26.1 isiOSAppOnVision API
without a compile time guard, breaking the iOS build on Xcode older than
the iOS 26.1 SDK (the current CI runners). Cap it in the example until
the runners ship a new enough Xcode.
spydon added a commit that referenced this pull request Jun 16, 2026
Drop the hand-written js_interop authenticator and the manual two-step
start/verify flows now that supabase_flutter exposes registerPasskey() and
signInWithPasskey() (#1408). Load the passkeys web bundle in index.html.
@spydon
spydon merged commit 8c8ec84 into main Jun 16, 2026
12 checks passed
@spydon
spydon deleted the feat/passkey-ceremony-helpers branch June 16, 2026 12:49
spydon added a commit that referenced this pull request Jun 16, 2026
… and launcher (#1407)

## What kind of change does this PR introduce?

Adds an `examples/` directory with a runnable example showing off the
passkey (WebAuthn) support, plus shared local Supabase infrastructure
and a launcher so the same setup can be reused by future examples.

> Based on #1408 (passkey ceremony helpers). Review/merge that first;
this PR targets its branch and GitHub will retarget it to `main` once
#1408 merges.

## What is the new behavior?

### `examples/passkeys`
A Flutter web app demonstrating passkeys with `supabase_flutter`:

- Create an account / sign in with email and password
- Register a passkey for the signed-in user
- Sign in with an existing passkey (no password)
- List, rename and delete passkeys

The full WebAuthn ceremony (including the platform prompt) is handled by
`supabase_flutter` via `registerPasskey()` and `signInWithPasskey()`
from #1408, so the example just calls those. The web build loads the
`passkeys` plugin's JavaScript bundle in `web/index.html`. The README
explains, concisely, what is needed to use passkeys.

### `examples/supabase`
A single shared `config.toml` every example runs against. It enables
passkeys (`[auth.passkey]` + `[auth.webauthn]`), disables email
confirmations for quick sign in, and trims the stack to the data plane
(turns off Studio, the email-testing server, Edge Functions, and
analytics) so `supabase start` is lean.

### `examples/launcher`
A small Dart TUI (`examples/run.sh`) that boots the local Supabase
stack, reads back the local URL and publishable key, lists the examples
and runs the selected one on Chrome with the credentials wired in as
`--dart-define`s. It stops the stack on exit if it started it. New
examples (any directory with a `pubspec.yaml` and `lib/main.dart`) are
discovered automatically.

A root `examples/README.md` explains the whole workflow.

## How was it tested?

- `flutter analyze` / `dart analyze` and `dart format` clean across the
new packages.
- `flutter build web` succeeds for the passkeys example.
- Booted the local stack (Colima) and verified end to end against it:
account sign up returns a session, and the passkey registration and
authentication options endpoints return valid WebAuthn challenges. The
only step not automated is the interactive browser biometric prompt.

## Notes

This is a draft for review of the structure before polishing further
(e.g. additional examples).

Linear: SDK-1058 (sub-issue of SDK-1057)
grdsdev added a commit to supabase/supabase that referenced this pull request Jun 17, 2026
## Summary

Updates docs based on stable releases in `supabase/supabase-flutter`.

## Changes analyzed

- **SDK**: dart
- **Repo**: https://github.com/supabase/supabase-flutter
- **Stable tag range**:
`supabase_flutter-v2.14.1...supabase_flutter-v2.15.0`
- **Commits**:
`81c1590728a5e08bebdc152bd59a7c1e7644c8b2...9030650b74e253020f8c614b3bfb2c993b6061af`

## Documentation updates

`apps/docs/spec/supabase_dart_v2.yml` — adds entries for the new passkey
APIs landed in `supabase_flutter-v2.15.0`
([gotrue#1392](supabase/supabase-flutter#1392),
[supabase_flutter#1408](supabase/supabase-flutter#1408)):

- `signInWithPasskey()` / `registerPasskey()` — high-level helpers on
`supabase_flutter` that drive the full WebAuthn ceremony.
- `auth.passkey.*` — server side of the WebAuthn ceremony: `list`,
`update`, `delete`, `startRegistration`, `verifyRegistration`,
`startAuthentication`, `verifyAuthentication`.
- `auth.admin.passkey.*` — admin endpoints: `listPasskeys`,
`deletePasskey`.

`apps/docs/content/guides/auth/passkeys.mdx` — adds Dart code examples
to every passkey section (Enable in the client, Register, Sign in,
Two-step API, Manage, Admin API) and points the reference links at both
the JavaScript and Dart specs. Bumps the "Requires" admonition to
include `supabase_flutter v2.15.0`.

Other v2.14.2 / v2.15.0 changes that did not require doc updates:

- `feat(realtime): protocol format 2.0.0` — protocol versions are
already documented in `realtime/protocol.mdx`; the SDK now defaults to
v2.0.0 but exposes a `version: RealtimeProtocolVersion.v1` opt-out,
which is an SDK detail rather than a docs change.
- `fix(gotrue): support asymmetric JWTs in getClaims` — bug fix to the
existing `auth.getClaims` (no new API).
- The rest are bug fixes and internal refactors (storage
`createSignedUrls` null handling, postgrest stack traces, gotrue
refresh-token races, PKCE email-change, realtime deaf-socket guards,
lint/test/CI hygiene).

`common-client-libs-sections.json` already contains entries for every
new spec `id`, so the sidebar nav picks them up automatically.

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Added Dart language examples to passkey authentication guide covering
client initialization, user registration, sign-in workflows, two-step
ceremony flows, and passkey management operations
* Updated Dart client specification to document new passkey
authentication functions and admin-level passkey management capabilities

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
matlin pushed a commit to supabase/supabase that referenced this pull request Jun 22, 2026
## Summary

Updates docs based on stable releases in `supabase/supabase-flutter`.

## Changes analyzed

- **SDK**: dart
- **Repo**: https://github.com/supabase/supabase-flutter
- **Stable tag range**:
`supabase_flutter-v2.14.1...supabase_flutter-v2.15.0`
- **Commits**:
`81c1590728a5e08bebdc152bd59a7c1e7644c8b2...9030650b74e253020f8c614b3bfb2c993b6061af`

## Documentation updates

`apps/docs/spec/supabase_dart_v2.yml` — adds entries for the new passkey
APIs landed in `supabase_flutter-v2.15.0`
([gotrue#1392](supabase/supabase-flutter#1392),
[supabase_flutter#1408](supabase/supabase-flutter#1408)):

- `signInWithPasskey()` / `registerPasskey()` — high-level helpers on
`supabase_flutter` that drive the full WebAuthn ceremony.
- `auth.passkey.*` — server side of the WebAuthn ceremony: `list`,
`update`, `delete`, `startRegistration`, `verifyRegistration`,
`startAuthentication`, `verifyAuthentication`.
- `auth.admin.passkey.*` — admin endpoints: `listPasskeys`,
`deletePasskey`.

`apps/docs/content/guides/auth/passkeys.mdx` — adds Dart code examples
to every passkey section (Enable in the client, Register, Sign in,
Two-step API, Manage, Admin API) and points the reference links at both
the JavaScript and Dart specs. Bumps the "Requires" admonition to
include `supabase_flutter v2.15.0`.

Other v2.14.2 / v2.15.0 changes that did not require doc updates:

- `feat(realtime): protocol format 2.0.0` — protocol versions are
already documented in `realtime/protocol.mdx`; the SDK now defaults to
v2.0.0 but exposes a `version: RealtimeProtocolVersion.v1` opt-out,
which is an SDK detail rather than a docs change.
- `fix(gotrue): support asymmetric JWTs in getClaims` — bug fix to the
existing `auth.getClaims` (no new API).
- The rest are bug fixes and internal refactors (storage
`createSignedUrls` null handling, postgrest stack traces, gotrue
refresh-token races, PKCE email-change, realtime deaf-socket guards,
lint/test/CI hygiene).

`common-client-libs-sections.json` already contains entries for every
new spec `id`, so the sidebar nav picks them up automatically.

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Added Dart language examples to passkey authentication guide covering
client initialization, user registration, sign-in workflows, two-step
ceremony flows, and passkey management operations
* Updated Dart client specification to document new passkey
authentication functions and admin-level passkey management capabilities

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants