Skip to content
Shiny PlatformShiny Platform
Controls 3.0MAUI & Blazor NET11 Support

Passkeys

NuGet package Shiny.AppDeviceBridge.Maui

The passkeys bridge lets the page create and use passkeys with the platform authenticator. A WebView page served from loopback can’t use navigator.credentials for your site, because its origin is http://127.0.0.1, not your domain. The bridge hands the ceremony to the native app instead. It ships in Shiny.AppDeviceBridge.Maui, next to the device and sensors bridges, and is built on the passkeys API in .NET MAUI 11 Essentials (Microsoft.Maui.Authentication.Passkeys).

The page acts as the go-between. It fetches the WebAuthn options from your relying party server, passes them to the bridge untouched, and posts the response back for the server to verify. The bridge never creates challenges and never verifies anything. That stays on your server, as it would in a browser.

Platform Backed by
iOS, Mac Catalyst AuthenticationServices: Face ID, Touch ID, iCloud Keychain and other passkey providers
Android Credential Manager: biometrics, screen lock and the user’s passkey provider
Windows Windows Hello (webauthn.dll)
macOS (AppKit), Linux nothing: GET passkeys reports supported: false and the ceremonies answer 501
Terminal window
dotnet add package Shiny.AppDeviceBridge.Maui
builder.UseAppDeviceBridge(
bridge => bridge.AddPasskeysBridge("example.com"),
webApp => { /* … */ }
);

Pass every relying party id the page will use, or call AddPasskeysBridge again to add more. Options for any other id are refused with 403 rp_not_allowed before the authenticator is involved. An id is the site’s host name (example.com), not a URL.

Each relying party must also list the app:

  • iOS and Mac Catalyst: add the associated domain webcredentials:example.com to the app’s entitlements, and the app’s id to the site’s /.well-known/apple-app-site-association under webcredentials.
  • Android: add the app’s package name and signing certificate fingerprint to the site’s /.well-known/assetlinks.json with the delegate_permission/common.get_login_creds relation.
  • Windows: nothing.

Without the association, the platform refuses the ceremony and the bridge answers 409 failed with its message.

import { PasskeysBridge } from "@shinyorg/appdevicebridge";
const passkeys = new PasskeysBridge();
// Registration
const creation = await fetch("/api/passkeys/register/options", { method: "POST" }).then(r => r.json());
const created = await passkeys.create({ options: creation });
await fetch("/api/passkeys/register", { method: "POST", body: JSON.stringify(created.response) });
// Sign in
const request = await fetch("/api/passkeys/login/options", { method: "POST" }).then(r => r.json());
const signedIn = await passkeys.assert({ options: request });
await fetch("/api/passkeys/login", { method: "POST", body: JSON.stringify(signedIn.response) });

In Blazor, register AddPasskeysBridgeClient() and inject IPasskeysBridge, both in Shiny.AppDeviceBridge.Client. Options and Response are JsonElement, so the server’s JSON passes through without a model of its own.

A page that also runs in a browser can check getStatus() and use navigator.credentials when it isn’t hosted.

POST passkeys/create takes the server’s PublicKeyCredentialCreationOptions as options and shows the native “create a passkey” sheet. The options must carry rp.id. It answers with the new credential’s id (base64url) and response, the WebAuthn registration response JSON for your server.

POST passkeys/assert takes the server’s PublicKeyCredentialRequestOptions as options. They must carry rpId, because there’s no page origin to default it from. It answers with the credential id, the userHandle the server set as user.id at registration (for username-less sign-in; null when the authenticator doesn’t return one), and response, the WebAuthn authentication response JSON.

Both take preferImmediatelyAvailable. It keeps the ceremony on this device, with no QR code or “use another device” step: registration happens only if the local authenticator can do it, and sign-in offers only passkeys already on the device. Apple and Android honor it; Windows ignores it.

Aborting the request (an AbortSignal, or a cancelled token in C#) cancels the ceremony.

Status Code When
400 bad_request The options are missing rp.id (create) or rpId (assert), or the platform rejected them as malformed
403 rp_not_allowed The relying party id isn’t one the app registered
409 cancelled The user dismissed the sheet, like a browser’s NotAllowedError
409 failed The ceremony failed: no domain association, no matching passkey, or a platform error. message carries the platform’s reason
501 not_supported macOS (AppKit), Linux, an OS version without passkeys, or the app did not register the bridge
GET/_bridge/passkeys#

Whether this platform and OS version can create and use passkeys, and the relying party ids the app accepts.

C#IPasskeysBridge.GetStatusAsyncTSPasskeysBridge.getStatus
Response
200 PasskeyStatus
PasskeyStatus · 2 fields
supportedbooleanThis platform and OS version can create and use passkeys.
relyingPartyIdsstring[]The relying party ids the app registered; options for any other id are refused.
POST/_bridge/passkeys/create#

Registers a new passkey through the native "create a passkey" sheet. Fails with 400 when the options have no rp.id, 403 rp_not_allowed when the app did not register that id, 409 cancelled when the user dismisses the sheet, and 409 failed when the ceremony fails — most often a missing associated domain (Apple) or Digital Asset Links file (Android) for the relying party.

C#IPasskeysBridge.CreateAsyncTSPasskeysBridge.create
Body
application/json · PasskeyCreateRequest
PasskeyCreateRequest · 2 fields
optionsunknownThe relying party server's PublicKeyCredentialCreationOptions JSON, passed through as it came.
preferImmediatelyAvailablebooleanStay on this device: only create the passkey if the local authenticator can, with no QR code or "use another device" step. Apple and Android; ignored on Windows.
Response
200 PasskeyCreateResult
PasskeyCreateResult · 2 fields
idstringThe new passkey's credential id (base64url), the WebAuthn PublicKeyCredential.id.
responseunknownThe WebAuthn registration response JSON. Post it to the relying party server to verify and store.
Errors
400Bad request403Forbidden409Conflict
POST/_bridge/passkeys/assert#

Signs in with an existing passkey through the native sheet. Fails like create; the options must carry rpId, and 409 failed also covers no matching passkey on the device.

C#IPasskeysBridge.AssertAsyncTSPasskeysBridge.assert
Body
application/json · PasskeyAssertRequest
PasskeyAssertRequest · 2 fields
optionsunknownThe relying party server's PublicKeyCredentialRequestOptions JSON, passed through as it came.
preferImmediatelyAvailablebooleanOnly offer a passkey already on this device. Apple and Android; ignored on Windows.
Response
200 PasskeyAssertResult
PasskeyAssertResult · 3 fields
idstringThe credential id (base64url) of the passkey used.
userHandlestring | nullThe user.id (base64url) the relying party set at registration, for username-less sign-in; null when the authenticator does not return one.
responseunknownThe WebAuthn authentication response JSON. Post it to the relying party server to verify.
Errors
409Conflict

JSON property names are camelCase and enums travel as their names. A ? marks a property the payload may omit;| null one that may be null.

PasskeyStatusobject#
supportedbooleanThis platform and OS version can create and use passkeys.
relyingPartyIdsstring[]The relying party ids the app registered; options for any other id are refused.
PasskeyCreateRequestobject#
optionsunknownThe relying party server's PublicKeyCredentialCreationOptions JSON, passed through as it came.
preferImmediatelyAvailable?booleanStay on this device: only create the passkey if the local authenticator can, with no QR code or "use another device" step. Apple and Android; ignored on Windows.
PasskeyCreateResultobject#
idstringThe new passkey's credential id (base64url), the WebAuthn PublicKeyCredential.id.
responseunknownThe WebAuthn registration response JSON. Post it to the relying party server to verify and store.
PasskeyAssertRequestobject#
optionsunknownThe relying party server's PublicKeyCredentialRequestOptions JSON, passed through as it came.
preferImmediatelyAvailable?booleanOnly offer a passkey already on this device. Apple and Android; ignored on Windows.
PasskeyAssertResultobject#
idstringThe credential id (base64url) of the passkey used.
userHandlestring | nullThe user.id (base64url) the relying party set at registration, for username-less sign-in; null when the authenticator does not return one.
responseunknownThe WebAuthn authentication response JSON. Post it to the relying party server to verify.