# Secp256k1.fromPrf

Derives a valid secp256k1 private key from a 32-byte WebAuthn PRF output.

The permanent derivation contract uses the PRF output as the HMAC-SHA256 key. Its message is the UTF-8 bytes of `ox.secp256k1.fromPrf.v1` followed by a 32-bit big-endian counter starting at zero. Invalid scalars are skipped.

## Imports

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

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

## Examples

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

const privateKey = Secp256k1.fromPrf(
  '0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f'
)
```

## Definition

```ts
function fromPrf<as>(
  value: Hex.Hex | Bytes.Bytes,
  options?: fromPrf.Options<as>,
): fromPrf.ReturnType<as>
```

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

## Parameters

### value

* **Type:** `Hex.Hex | Bytes.Bytes`

A 32-byte WebAuthn PRF output.

### options

* **Type:** `fromPrf.Options<as>`
* **Optional**

Options.

#### options.as

* **Type:** `"Bytes" | "Hex" | as`
* **Optional**

Format of the returned private key.

## Return Type

A valid secp256k1 private key.

`fromPrf.ReturnType<as>`
