---
title: How to Sign and Verify a Message
description: "Learn how to sign messages on Solana."
---

The primary function of a keypair is to sign messages, transactions and enable
verification of the signature. Verification of a signature allows the recipient
to be sure that the data was signed by the owner of a specific private key.

<CodeTabs storage="cookbook" flags="r">

```typescript !! title="Kit" file=packages/docs-examples/cookbook/wallets/sign-message/kit.ts#region=sign

```

```typescript !! title="Legacy" file=packages/docs-examples/cookbook/wallets/sign-message/legacy.ts#region=sign

```

```rust !! title="Rust" file=packages/docs-examples/cookbook/wallets/sign-message/rust/src/main.rs#region=sign

```

```py !! title="Python" file=packages/docs-examples/cookbook/wallets/sign-message/python.py#region=sign

```

</CodeTabs>
