> **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.createCredential

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

Creates a WebAuthn credential and optionally returns its credential-bound PRF output.

## Imports

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

## Examples

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

const credential = await WebAuthn.createCredential({
  name: 'Example',
  prf: true
})
const privateKey = Secp256k1.fromPrf(credential.prf)
```

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

When credential creation enables PRF but does not return an output, this function performs a follow-up assertion. The user may be prompted twice.

If PRF evaluation fails after registration, the thrown error retains the created credential on its `credential` property.

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

PRF-derived keys are software keys. Code on any origin allowed to use the same RP ID can request the same output after user verification.
:::

## Definition

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

## Parameters

### options

* **Type:** `options`

Credential creation and PRF options.

## Return Type

The credential, with a copied PRF output when requested.

`Promise<createCredential.ReturnType<options>>`
