# `usePasskeyPrfSupport`

Checks if the current device supports **passkey-based wallet recovery with the PRF extension**. Use this hook to conditionally show passkey options in your UI (e.g. only show "Use Passkey Recovery" when `isSupported` is true).

**Platform requirements:** Android 14+ (API 34) or iOS 18+. On older versions or other platforms, the hook returns `isSupported: false`.

:::info
Passkey support requires native builds (iOS/Android). It is not available in Expo Go. You must run `npx expo prebuild` and build natively.
:::

## Usage

```tsx
import { usePasskeyPrfSupport } from "@openfort/react-native"
import { ActivityIndicator, Button, View } from "react-native"

function RecoveryMethodPicker() {
  const { isSupported, isLoading } = usePasskeyPrfSupport()

  if (isLoading) {
    return <ActivityIndicator />
  }

  return (
    <View>
      <Button title="Use Automatic Recovery" onPress={handleAutomatic} />
      <Button title="Use Password Recovery" onPress={handlePassword} />
      {isSupported && (
        <Button title="Use Passkey Recovery" onPress={handlePasskey} />
      )}
    </View>
  )
}
```

## Return type

```ts
type UsePasskeyPrfSupportReturn = {
  isSupported: boolean  // Whether the device supports passkey PRF
  isLoading: boolean    // Whether the check is still in progress
}
```

| Property     | Description |
|-------------|-------------|
| `isSupported` | `true` when the device supports passkey with PRF extension (Android 14+, iOS 18+). |
| `isLoading`   | `true` while the support check is running. |

## How it works

The hook uses the native passkey API to check WebAuthn **PRF (Pseudo-Random Function) extension** support on the device:

* **iOS**: Requires iOS 18+ with Face ID or Touch ID
* **Android**: Requires Android 14+ (API 34) with a configured screen lock and Google Play Services

PRF support is required for Openfort passkey recovery on React Native. Basic WebAuthn may be available on older OS versions, but recovery uses the PRF extension.

## Requirements

For passkey PRF support to work, you need:

1. **Native build**: Cannot use Expo Go; run `npx expo prebuild` and build for iOS/Android.
2. **Associated domains (iOS)**: Configure `webcredentials:your-domain.com` in your app's entitlements.
3. **Digital Asset Links (Android)**: Host an `assetlinks.json` file at `/.well-known/assetlinks.json`.
4. **HTTPS domain**: Passkeys require a valid HTTPS domain as the Relying Party ID.

See the [Passkey Recovery Quickstart](/docs/products/embedded-wallet/react-native/quickstart/passkey) for complete setup instructions.

## Example with wallet creation

```tsx
import { usePasskeyPrfSupport, useEmbeddedEthereumWallet } from "@openfort/react-native"
import { Alert, Button, Text, View } from "react-native"

function CreateWalletScreen() {
  const { isSupported: passkeySupported } = usePasskeyPrfSupport()
  const { create, status } = useEmbeddedEthereumWallet()

  const handleCreateWithPasskey = async () => {
    if (!passkeySupported) {
      Alert.alert("Error", "Passkeys are not supported on this device")
      return
    }

    try {
      await create({
        recoveryMethod: "passkey",
        onSuccess: ({ account }) => {
          Alert.alert("Success", `Wallet created: ${account?.address}`)
        },
        onError: (error) => {
          Alert.alert("Error", error.message)
        },
      })
    } catch (error) {
      console.error("Failed to create wallet with passkey:", error)
    }
  }

  return (
    <View>
      <Button
        title={status === "creating" ? "Creating..." : "Create Wallet with Passkey"}
        onPress={handleCreateWithPasskey}
        disabled={status === "creating" || !passkeySupported}
      />
      {!passkeySupported && (
        <Text style={{ color: "gray" }}>
          Passkeys not available on this device (requires Android 14+ or iOS 18+)
        </Text>
      )}
    </View>
  )
}
```

## Standalone function: `isPasskeyPrfSupported`

For non-React contexts (e.g. imperative checks), use the async function directly:

```tsx
import { isPasskeyPrfSupported } from "@openfort/react-native"

const supported = await isPasskeyPrfSupported()
if (supported) {
  // Show passkey option
}
```

| Property | Description |
|----------|-------------|
| Return type | `Promise<boolean>` |
| Platform requirements | Android 14+ (API 34), iOS 18+ |

## Related

* [Passkey Recovery Quickstart](/docs/products/embedded-wallet/react-native/quickstart/passkey) — Complete passkey setup
* [Connect wallet](/docs/products/embedded-wallet/react-native/wallet/connect) — Creating a wallet with passkey recovery
