# SignatureEnvelope.extractPublicKey

Extracts the public key of the signer from a [`SignatureEnvelope.SignatureEnvelope`](/tempo/reference/SignatureEnvelope/types#signatureenvelope).

* **secp256k1**: Recovers the public key from the payload via `ecrecover`. - **p256** / **webAuthn**: Returns the embedded public key. - **keychain**: Extracts from the inner signature.

## Imports

:::code-group
```ts [Named]
import { SignatureEnvelope } from 'ox/tempo'
```

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

## Examples

```ts twoslash
import { Secp256k1 } from 'ox'
import { SignatureEnvelope } from 'ox/tempo'

const payload = '0xdeadbeef'
const signature = Secp256k1.sign({
  payload,
  privateKey: '0x...'
})
const envelope = SignatureEnvelope.from(signature)

const publicKey = SignatureEnvelope.extractPublicKey({
  // [!code focus]
  payload, // [!code focus]
  signature: envelope // [!code focus]
}) // [!code focus]
```

## Definition

```ts
function extractPublicKey(
  options: extractPublicKey.Options,
): extractPublicKey.ReturnType
```

**Source:** [src/tempo/SignatureEnvelope.ts](https://github.com/wevm/ox/blob/main/src/tempo/SignatureEnvelope.ts#L1794)

## Parameters

### options

* **Type:** `extractPublicKey.Options`

The extraction options.

#### options.payload

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

The sign payload that was signed (only required for secp256k1 signatures).

#### options.signature

* **Type:** `SignatureEnvelope`

The signature envelope.

## Return Type

The signer's public key.

`extractPublicKey.ReturnType`
