---
title: Message handlers
category: reference
---

# Message handlers

The message handlers let a Live App ask the user to sign an arbitrary message (for example an [EIP-191](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-191.md) personal sign or an [EIP-712](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md) typed-data message) using one of the wallet's accounts.

To sign a transaction instead, use the [transaction handlers](./transaction).

## Method IDs

| Method ID      | Direction         | Wallet handler required? | Purpose                                         |
| -------------- | ----------------- | :----------------------: | ----------------------------------------------- |
| `message.sign` | Live App → Wallet |            yes           | Sign a message with the selected account's key. |

## `message.sign`

The Live App passes the message as a hex string. The server decodes it to a `Buffer` before forwarding to the wallet's `message.sign` handler. The result is encoded back to hex on the wire.

### Parameters

| Parameter    | Type     | Required | Notes                                                                                                                                        |
| ------------ | -------- | :------: | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `accountId`  | `string` |    yes   | ID of the account whose key signs the message.                                                                                               |
| `hexMessage` | `string` |    yes   | Hex-encoded message to sign.                                                                                                                 |
| `options`    | `object` |    no    | Wallet-specific options. Currently: `hwAppId?: string`, `dependencies?: string[]`.                                                           |
| `meta`       | `object` |    no    | Free-form metadata, typed as `Record<string, unknown>`. Forwarded as-is to the wallet handler; useful for context such as the dApp identity. |

### Result

```ts
{
  hexSignedMessage: string
}
```

The signed message is hex-encoded.

### Errors

| Condition                                         | Error                                                                |
| ------------------------------------------------- | -------------------------------------------------------------------- |
| `accountId` or `hexMessage` missing or wrong type | `RpcError` with code `INVALID_PARAMS` (`-32602`).                    |
| Wallet does not implement `message.sign`          | `RpcError` with code `SERVER_ERROR` (`-32000`).                      |
| The user rejects the request on-device            | The error thrown by the wallet handler is forwarded to the Live App. |

## See also

- [Transaction handlers](./transaction): for signing transactions instead of arbitrary messages.
- [Message module (client)](../../core/modules/message): the client-side counterpart.
- [`message.sign` source](https://github.com/LedgerHQ/wallet-api/blob/main/packages/server/src/internalHandlers/message.ts) and [`MessageSign` schema](https://github.com/LedgerHQ/wallet-api/blob/main/packages/core/src/spec/types/MessageSign.ts).
