# FrameSignature.from

Coerces a value into a [`FrameSignature.FrameSignature`](/api/FrameSignature/types#framesignature).

Accepts arbitrary signature bytes or a structured signature entry. Omitted `scheme` and `payload` default to `'arbitrary'` and `'0x'`, respectively. An empty payload selects the canonical transaction signing hash; an explicit payload must be a nonzero 32-byte digest.

## Imports

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

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

## Examples

### From Hex

Wrap arbitrary witness bytes for contract-defined verification.

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

const entry = FrameSignature.from('0xaabb')
// @log: { payload: '0x', scheme: 'arbitrary', signature: '0xaabb' }
```

### Secp256k1

Wrap a signature over an explicit digest, retaining the same payload in the entry.

```ts twoslash
import { FrameSignature, Hash, Secp256k1 } from 'ox'

const payload = Hash.keccak256('0xdeadbeef')
const privateKey = Secp256k1.randomPrivateKey()
const signature = Secp256k1.sign({ payload, privateKey })

const entry = FrameSignature.from({
  payload,
  scheme: 'secp256k1',
  signature
})
```

### P256

Include the public key with a P-256 signature over an explicit digest.

```ts twoslash
import { FrameSignature, Hash, P256 } from 'ox'

const { privateKey, publicKey } = P256.createKeyPair()
const payload = Hash.keccak256('0xdeadbeef')
const signature = P256.sign({ payload, privateKey })

const entry = FrameSignature.from({
  payload,
  publicKey,
  scheme: 'p256',
  signature
})
```

### Unsigned Entries

Omit the signature to prepare a protocol entry before signing the transaction.

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

const entry = FrameSignature.from({ scheme: 'secp256k1' })
// @log: { payload: '0x', scheme: 'secp256k1' }
```

## Definition

```ts
function from<entry>(
  entry: entry | from.Input,
): from.ReturnType<entry>
```

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

## Parameters

### entry

* **Type:** `entry | from.Input`

Arbitrary signature bytes or a structured signature entry.

## Return Type

The validated entry, preserving supplied signature and scheme types.

`from.ReturnType<entry>`
