# WebAuthnP256.createCredential

Creates a new WebAuthn P256 Credential, which can be stored and later used for signing.

## Imports

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

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

## Examples

```ts twoslash
import { WebAuthnP256 } from 'ox'

const credential = await WebAuthnP256.createCredential({
  name: 'Example'
}) // [!code focus]
// @log: {
// @log:   id: 'oZ48...',
// @log:   publicKey: { x: 51421...5123n, y: 12345...6789n },
// @log:   raw: PublicKeyCredential {},
// @log: }

const { metadata, signature } = await WebAuthnP256.sign({
  credentialId: credential.id,
  challenge: '0xdeadbeef'
})
```

## Definition

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

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

## Parameters

### options

* **Type:** `createCredential.Options`

Credential creation options.

## Return Type

A WebAuthn P256 credential.

`Promise<P256Credential>`
