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

# Encrypted Messaging

> End-to-end encrypted messages powered by FHE

## Overview

Every message on blockmsg is encrypted using **Fully Homomorphic Encryption (FHE)** before being stored on the blockchain.

<Info>
  FHE is the gold standard for encryption - even quantum computers cannot break it.
</Info>

## How Message Encryption Works

<Steps>
  <Step title="You Type a Message">
    You compose your message in the blockmsg interface
  </Step>

  <Step title="Client-Side Encryption">
    Your browser encrypts the message using FHE before it leaves your device
  </Step>

  <Step title="On-Chain Storage">
    The encrypted message is stored on the blockchain as a transaction
  </Step>

  <Step title="Recipient Decrypts">
    Only the recipient with their wallet private key can decrypt and read the message
  </Step>
</Steps>

## Technical Details

### Encryption Process

```javascript theme={null}
// Message is chunked into 32-bit segments
const chunks = chunkMessage(message, 4); // 4 bytes per chunk

// Each chunk is encrypted using TFHE
const encryptedHandles = chunks.map(chunk => 
  fhevmInstance.encrypt32(chunk)
);

// Encrypted handles are sent to the smart contract
await contract.sendDirectMessage(recipient, encryptedHandles);
```

### Decryption Process

1. User requests decryption by clicking "Reveal Message"
2. A cryptographic signature is generated using the wallet
3. The fhEVM re-encrypts the data for the requesting user
4. Client-side decryption reveals the plaintext message

<Warning>
  Decryption requires an active wallet connection. Without your wallet, messages cannot be decrypted.
</Warning>

## Privacy Guarantees

| Feature           | Guarantee                               |
| ----------------- | --------------------------------------- |
| Message Content   | Fully encrypted, unreadable without key |
| Sender Address    | Visible on-chain (public blockchain)    |
| Recipient Address | Visible on-chain (public blockchain)    |
| Timestamp         | Visible on-chain                        |
| Message Length    | Partially hidden (chunked)              |

<Note>
  While message content is fully private, sender and recipient addresses are visible on the public blockchain.
</Note>
