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

# Verify message

Wander Injected API verifyMessage() function

This function allows verifying a cryptographic signature [created by ](/api/sign-message.md)Wander.

| Argument     | Type                                                 | Description                                                                                                       |
| ------------ | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `data`       | `ArrayBuffer`                                        | The data to verify the signature for                                                                              |
| `signature`  | `ArrayBuffer \| string`                              | The signature to validate                                                                                         |
| `publicKey?` | `string`                                             | Arweave wallet `JWK.n` field, transaction owner field or [public key from Wander](/api/get-active-public-key.md). |
| `options?`   | [`SignMessageOptions`](/api/sign-message.md#options) | Configuration for the signature                                                                                   |

{% hint style="info" %}
**Note:** This function requires the [`SIGNATURE`](/api/connect.md#permissions) permission.
{% endhint %}

{% hint style="info" %}
**Note:** The `publicKey` argument is optional, if it is not provided, the extension will use the currently selected wallet's public key. You might only need this if the message to be verified was not made by the connected user.
{% endhint %}

{% hint style="info" %}
**Note:** The `options` argument is optional, if it is not provided, the extension will use the default signature options (default hash algorithm) to sign the data.
{% endhint %}

## Example usage

```ts
// connect to the extension
await window.arweaveWallet.connect(["SIGNATURE"]);

// data to be signed
const data = new TextEncoder().encode("The hash of this msg will be signed.");

// create signature
const signature = await window.arweaveWallet.signMessage(data);

// verify signature
const isValidSignature = await window.arweaveWallet.verifyMessage(data, signature);

console.log(`The signature is ${isValidSignature ? "valid" : "invalid"}`);
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.arconnect.io/api/verify-message.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
