# Authentication.serializeResponse

Serializes an authentication response into a JSON-serializable format, converting `BufferSource` fields to base64url strings and the signature to a hex string.

## Imports

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

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

## Examples

```ts twoslash
import { Authentication } from 'ox/webauthn'

const response = await Authentication.sign({
  challenge: '0xdeadbeef'
})

const serialized =
  Authentication.serializeResponse(response) // [!code focus]

// `serialized` is JSON-serializable — send it to a server, store it, etc.
const json = JSON.stringify(serialized)
```

## Definition

```ts
function serializeResponse(
  response: Response,
): Response<true>
```

**Source:** [src/webauthn/Authentication.ts](https://github.com/wevm/ox/blob/main/src/webauthn/Authentication.ts#L427)

## Parameters

### response

* **Type:** `Response`

The authentication response to serialize.

#### response.id

* **Type:** `string`

#### response.metadata

* **Type:** `{ authenticatorData: 0x${string}; challengeIndex?: number; clientDataJSON: string; typeIndex?: number; userVerificationRequired?: boolean; }`

#### response.raw

* **Type:** `PublicKeyCredential`

#### response.signature

* **Type:** `serialized extends true ? 0x${string} : { r: 0x${string}; s: 0x${string}; yParity?: number; }`

## Return Type

The serialized authentication response.

`Response<true>`
