# SignaturePreAuthorized

Pre-authorized access key signature utilities (TIP-1165).

A pre-authorized signature bundles an access key's V2 keychain signature with
the root key's signed key authorization, followed by a 32-byte magic suffix.
Offchain verifiers use it to accept signatures from an access key that is
authorized but not yet registered onchain.

[TIP-1165](https://tips.sh/1165)

## Examples

```ts twoslash
// @noErrors
import { SignaturePreAuthorized } from 'ox/tempo'

const wrapped = SignaturePreAuthorized.wrap({
  keyAuthorization,
  signature
})
const { keyAuthorization, signature } =
  SignaturePreAuthorized.unwrap(wrapped)
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`SignaturePreAuthorized.assert`](/tempo/reference/SignaturePreAuthorized/assert) | Asserts that a value is a valid pre-authorized signature. |
| [`SignaturePreAuthorized.from`](/tempo/reference/SignaturePreAuthorized/from) | Instantiates a [TIP-1165](https://tips.sh/1165) pre-authorized signature from its wrapped or unwrapped form. |
| [`SignaturePreAuthorized.unwrap`](/tempo/reference/SignaturePreAuthorized/unwrap) | Parses a [TIP-1165](https://tips.sh/1165) pre-authorized signature into its keychain signature and signed key authorization. |
| [`SignaturePreAuthorized.validate`](/tempo/reference/SignaturePreAuthorized/validate) | Validates a wrapped pre-authorized signature. Returns `true` if it decodes strictly, `false` otherwise. |
| [`SignaturePreAuthorized.wrap`](/tempo/reference/SignaturePreAuthorized/wrap) | Serializes a [TIP-1165](https://tips.sh/1165) pre-authorized signature: `rlp([keychain_signature, signed_key_authorization]) ‖ magic`. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`SignaturePreAuthorized.InvalidUnwrappedSignatureError`](/tempo/reference/SignaturePreAuthorized/errors#signaturepreauthorizedinvalidunwrappedsignatureerror) | Thrown when an unwrapped pre-authorized signature is malformed. |
| [`SignaturePreAuthorized.InvalidWrappedSignatureError`](/tempo/reference/SignaturePreAuthorized/errors#signaturepreauthorizedinvalidwrappedsignatureerror) | Thrown when a wrapped pre-authorized signature is invalid. |

## Types

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`SignaturePreAuthorized.Unwrapped`](/tempo/reference/SignaturePreAuthorized/types#signaturepreauthorizedunwrapped) | Unwrapped [TIP-1165](https://tips.sh/1165) pre-authorized signature. |
| [`SignaturePreAuthorized.Wrapped`](/tempo/reference/SignaturePreAuthorized/types#signaturepreauthorizedwrapped) | Wrapped [TIP-1165](https://tips.sh/1165) pre-authorized signature. |
