> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# WebAuthn.getCredential

:::info
`WebAuthn.getCredential` is a re-export of ox's [`WebAuthn.getCredential`](https://oxlib.sh/api/WebAuthn/getCredential). Refer to the ox documentation for the full reference.
:::

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

## Imports

```ts
import { WebAuthn } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { Secp256k1, WebAuthn } from 'viem/utils'

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>
```

## 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>`
