> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# Sign message

Sign arbitrary messages using your Openfort Solana embedded wallet. Openfort uses Ed25519 for Solana wallets, which signs raw message bytes directly. Signing happens off-chain — it costs no SOL and broadcasts nothing to the cluster.

## Parameters

| Parameter | Type | Description |
| :--- | :--- | :--- |
| `message` | `string` | The message to sign. Ed25519 signs the raw bytes, so there is no hashing option to configure. |

## Return value

`Promise<string>` — the signature, base58 encoded. The key that produced it is `solana.provider.publicKey`, which is the active wallet's address.

## Usage

`provider` is only defined while `status` is `'connected'`, so gate on the status before signing.

```tsx [SignSolanaMessage.tsx]
import { Button } from 'react-native'
import { useEmbeddedSolanaWallet } from '@openfort/react-native'

function SignSolanaMessage() {
  const solana = useEmbeddedSolanaWallet()

  const handleSignMessage = async () => {
    if (solana.status !== 'connected') return

    const signature = await solana.provider.signMessage('Hello from Openfort!')
    console.log('Signature:', signature)   // base58 string
    console.log('Signed by:', solana.provider.publicKey)
  }

  return (
    <Button
      title="Sign Message"
      onPress={handleSignMessage}
      disabled={solana.status !== 'connected'}
    />
  )
}
```

The provider also exposes an EIP-1193-style `request` method for the same operation, which resolves to an object instead of a bare string:

```tsx
const { signature } = await solana.provider.request({
  method: 'signMessage',
  params: { message: 'Hello from Openfort!' },
})
```

## Errors

`signMessage` rejects on failure — there is no `{ error }` result object to inspect. Catch the rejection and read `message` for text you can show a user, or `error` for a stable code to branch on.

```tsx
import { OpenfortError } from '@openfort/react-native'

try {
  const signature = await solana.provider.signMessage('Hello from Openfort!')
} catch (e) {
  if (e instanceof OpenfortError) {
    console.error(e.error, e.message)
  }
}
```

:::warning
While a wallet is still being recovered, `status` is `'needs-recovery'` and `provider` is undefined. Run `setActive` with the wallet's recovery parameters before offering a sign button.
:::

## Related

* [Send transaction (Solana)](https://www.openfort.io/docs/products/embedded-wallet/react-native/wallet/actions/send-transaction/solana) — for transaction message bytes, use `provider.signTransaction` instead of `signMessage`.
* [useEmbeddedSolanaWallet](https://www.openfort.io/docs/products/embedded-wallet/react-native/hooks/useEmbeddedSolanaWallet) — the hook that exposes `status`, `activeWallet`, and `provider`.
* [Sign message (Ethereum)](https://www.openfort.io/docs/products/embedded-wallet/react-native/wallet/actions/sign-message) — `personal_sign` and EIP-712 typed data on the Ethereum provider.
