> For the complete documentation index, see [llms.txt](https://docs.fuelet.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fuelet.app/wallet-api/signing-messages.md).

# Signing messages

You can request a user to sign a message with a private key of his connected account. This can be achieved in two ways.

You can call the `signMessage` on the `fuel` object providing the account address (in [Bech32 format](https://fuellabs.github.io/fuels-ts/guide/types/bech32.html)) you want to sign message with, and the message itself:

{% tabs %}
{% tab title="TypeScript" %}

```javascript
const signature = await fuel.signMessage('fuel1j0nym7r7twmy8cs6gx2yhd042n38znkeghyjw3dtp0g6tkju34zq2fwltf', 'Message to sign');
console.log("Sign message response", signature);
```

{% endtab %}
{% endtabs %}

Or you can get an instance of the wallet first and then call the `signMessage` method on it:

{% tabs %}
{% tab title="TypeScript" %}

```javascript
const wallet = await fuel.getWallet('fuel1j0nym7r7twmy8cs6gx2yhd042n38znkeghyjw3dtp0g6tkju34zq2fwltf');
const signature = await wallet.signMessage('Message to sign');
console.log("Sign message response", signature);
```

{% endtab %}
{% endtabs %}

After calling any of the methods, the app will prompt the user to authorize the request. The following screen will appear:

<figure><img src="/files/xtItWIjvPOlWOQ1L32Ub" alt="" width="183"><figcaption></figcaption></figure>

Once the user approves the request, the promise is finalized with a string - the signature. If anything goes wrong, e.g. the user cancels the request, the method call will result in an exception.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fuelet.app/wallet-api/signing-messages.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
