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

# signMessageWithIdentityKey

> Sign a message with the wallet's identity key.

Signs a message with the wallet's identity key.

## Method Signature

```typescript theme={null}
async signMessageWithIdentityKey(
  message: string,
  compact?: boolean
): Promise<string>
```

## Parameters

<ResponseField name="message" type="string" required>
  The message to sign
</ResponseField>

<ResponseField name="compact" type="boolean">
  Whether to use compact encoding. If `false`, uses DER encoding.
</ResponseField>

## Returns

<ResponseField name="signature" type="string" required>
  The signature as a hex string
</ResponseField>

## Example

```typescript theme={null}
const signature = await wallet.signMessageWithIdentityKey("Hello, Spark!");
console.log("Signature:", signature);

// Compact encoding
const compactSig = await wallet.signMessageWithIdentityKey("Hello", true);
```
