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

# Message Structure

> Encrypted message format for secure communication

# Message Structure

All messages are encrypted client-side using the Verifier's session public key before processing.

## SecureMessage

```typescript theme={null}
interface SecureMessage {
  /** Unique message identifier (UUID v4) */
  id: string;
  /** Sender agent ID */
  sender: string;
  /** Recipient agent ID */
  recipient: string;
  /** Encrypted payload (base64-encoded) */
  encryptedPayload: string;
  /** Timestamp when the message was created */
  timestamp: number;
}
```

<Check>
  **Privacy by design:** The Verifier never sees plaintext message content. Commitments are computed over encrypted payloads.
</Check>

## Encryption

Messages are encrypted using X25519 ECDH key agreement with the Verifier's session public key:

```typescript theme={null}
import { encryptForVerifier } from '@spellguard/amp';

const encrypted = encryptForVerifier(
  JSON.stringify(payload),
  verifier.sessionX25519PublicKey
);
```
