# ZoneRpcAuthentication.serialize

Serializes a Zone RPC authentication token to hex.

The serialized format is `<signature><29-byte fields>`.

## Imports

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

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

## Examples

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

const authentication = ZoneRpcAuthentication.from({
  chainId: 4217000026,
  expiresAt: 1711235160,
  issuedAt: 1711234560,
  zoneId: 26
})

const signature = Secp256k1.sign({
  payload:
    ZoneRpcAuthentication.getSignPayload(authentication),
  privateKey: '0x...'
})

const serialized = ZoneRpcAuthentication.serialize(
  authentication,
  {
    signature
  }
)
```

## Definition

```ts
function serialize(
  authentication: PartialBy<ZoneRpcAuthentication, 'version'>,
  options?: serialize.Options,
): Serialized
```

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

## Parameters

### authentication

* **Type:** `PartialBy<ZoneRpcAuthentication, 'version'>`

The Zone RPC authentication token.

### options

* **Type:** `serialize.Options`
* **Optional**

Serialization options.

#### options.signature

* **Type:** `Value`
* **Optional**

Signature to attach to the serialized authentication token.

## Return Type

The serialized authentication token.

`Serialized`
