# WebAuthn.getCredential

Requests a WebAuthn credential and returns its credential-bound PRF output.

## Imports

:::code-group
```ts [Named]
import { WebAuthn } from 'ox'
```

```ts [Entrypoint]
import * as WebAuthn from 'ox/WebAuthn'
```
:::

## Examples

```ts twoslash
import { Secp256k1, WebAuthn } from 'ox'

const { prf } = await WebAuthn.getCredential({
  credentialId: 'oZ48...',
  prf: true
})
const privateKey = Secp256k1.fromPrf(prf)
```

`prf: true` uses the stable input `ox.webauthn.prf.v1`. Pass `{ input }` to use an application-owned input instead.

When more than one credential can be selected, check `result.id` before using the PRF output.

:::warning
PRF output is secret application-held key material. Native `response.raw.toJSON()` output includes extension results, so do not serialize or send the raw response.
:::

## Definition

```ts
function getCredential(
  options: getCredential.Options,
): Promise<getCredential.ReturnType>
```

**Source:** [src/core/WebAuthn.ts](https://github.com/wevm/ox/blob/main/src/core/WebAuthn.ts#L262)

## Parameters

### options

* **Type:** `getCredential.Options`

Credential request and PRF options.

#### options.challenge

* **Type:** `0x${string}`
* **Optional**

Challenge to sign. Defaults to a random 32-byte value.

Supply and verify a server-generated challenge when the assertion is
also used to authenticate a user to a server.

#### options.extensions

* **Type:** `Omit`
* **Optional**

Additional WebAuthn extensions. The `prf` extension is managed by this function.

#### options.getFn

* **Type:** `(options?: CredentialRequestOptions`
* **Optional**

Function that requests the WebAuthn credential.

#### options.prf

* **Type:** `Prf`

Credential-bound PRF configuration.

#### options.publicKey

* **Type:** `never`
* **Optional**

Raw credential options cannot be combined with managed PRF evaluation.

## Return Type

The requested credential and a copied 32-byte PRF output.

`Promise<getCredential.ReturnType>`
