> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rhinestone.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Message signing

> Create ERC-1271 signatures for messages and EIP-712 typed data.

Smart accounts validate off-chain signatures through ERC-1271. The SDK returns the validator and account envelopes expected by the configured account implementation.

Signatures are chain-specific. Always pass the chain on which the verifier will call the smart account.

## Sign an EIP-191 message

```ts theme={null}
const signature = await rhinestoneAccount.signMessage(
  "Hello, world!",
  base,
  undefined,
);
```

Pass raw bytes when the application already has a hex payload:

```ts theme={null}
const signature = await rhinestoneAccount.signMessage(
  { raw: "0x1234" },
  base,
  undefined,
);
```

## Sign EIP-712 typed data

```ts theme={null}
const signature = await rhinestoneAccount.signTypedData(
  {
    domain: {
      name: "Ether Mail",
      version: "1",
      chainId: base.id,
      verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
    },
    types: {
      Person: [
        { name: "name", type: "string" },
        { name: "wallet", type: "address" },
      ],
      Mail: [
        { name: "from", type: "Person" },
        { name: "to", type: "Person" },
        { name: "contents", type: "string" },
      ],
    },
    primaryType: "Mail",
    message: {
      from: {
        name: "Cow",
        wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
      },
      to: {
        name: "Bob",
        wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB",
      },
      contents: "Hello, Bob!",
    },
  },
  base,
  undefined,
);
```

Keep the typed-data domain's `chainId` consistent with the application protocol. The separate `chain` argument selects the account and validator context used to package the signature.

## Choose a signer set

Pass `undefined` to use the account's configured owners. To sign with an enabled session key, pass that session explicitly:

```ts theme={null}
const signature = await rhinestoneAccount.signTypedData(typedData, base, {
  type: "session",
  session,
});
```

The session's [signing mode](/wallets/session-keys/custom-setup/session-signing) must allow the payload. Disabled sessions reject both methods. Scoped typed-data signing is configured on-chain but direct scoped signature emission is not available in SDK 2.16.1.

## Deployed and undeployed accounts

For an undeployed smart account, the SDK wraps the result with ERC-6492 deployment data. The verifying application must support ERC-6492 to validate that signature. Deployed accounts return the normal ERC-1271-compatible envelope.

<Note>
  EOA account mode does not produce packed smart-account signatures through
  these methods. Call the EOA's viem signing method directly when the verifier
  expects an EOA signature.
</Note>
