# P256.recoverPublicKey

Recovers the signing public key from the signed payload and signature.

## Imports

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

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

## Examples

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

const signature = P256.sign({
  payload: '0xdeadbeef',
  privateKey: '0x...'
})

const publicKey = P256.recoverPublicKey({
  // [!code focus]
  payload: '0xdeadbeef', // [!code focus]
  signature // [!code focus]
}) // [!code focus]
```

## Definition

```ts
function recoverPublicKey<as>(
  options: recoverPublicKey.Options<as>,
): recoverPublicKey.ReturnType<as>
```

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

## Parameters

### options

* **Type:** `recoverPublicKey.Options<as>`

The recovery options.

#### options.as

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

Format of the returned public key.

#### options.payload

* **Type:** `0x${string} | Uint8Array`

Payload that was signed.

#### options.signature

* **Type:** `0x${string} | Uint8Array | { r: 0x${string}; s: 0x${string}; yParity: number; }`

Signature of the payload.

Accepts a structured [`Signature.Signature`](/api/Signature/types#signature), a serialized hex
string, or a `Uint8Array` (65-byte recovered).

## Return Type

The recovered public key.

`recoverPublicKey.ReturnType<as>`
