@corbado/passkey-utils
v1.0.0
Published
Framework-agnostic, dependency-free browser helpers for passkeys.
Keywords
Readme
@corbado/passkey-utils
Framework-agnostic, dependency-free browser helpers for passkeys.
This package collects small, client-side utilities related to passkeys that are not tied to any specific Corbado SDK (Observe, Complete, Connect). Today it helps you decide whether to show a passkey entry point in the current browser/device.
Installation
npm install @corbado/passkey-utils
# or
pnpm add @corbado/passkey-utils
# or
yarn add @corbado/passkey-utilsUsage
showPasskeyButton()
Determines whether a passkey login entry point should be shown in the current
browser. It combines PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable(),
PublicKeyCredential.getClientCapabilities(), and Bluetooth availability (for
cross-device / hybrid flows), and includes a workaround for the iOS 26.2
non-Safari isUVPAA bug.
import { showPasskeyButton } from "@corbado/passkey-utils";
const { show, reason } = await showPasskeyButton();
if (show) {
// Render your "Sign in with a passkey" button.
} else {
// Hide the passkey entry point. `reason` explains why.
console.debug(reason);
}Return value
showPasskeyButton() resolves to a ShowPasskeyButtonResult:
| Field | Type | Description |
| -------- | --------- | ------------------------------------------------------- |
| show | boolean | Whether a passkey entry point should be shown. |
| reason | string | Human-readable explanation of the decision (for debug). |
Browser support
The helper degrades gracefully: if WebAuthn or a given capability API is unavailable, it falls back to the next best signal and never throws.
License
MIT
