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

# Decryption mechanisms

Inco provides three types of decryption mechanisms:

* Attested Decrypt for obtaining cryptographic proofs of decryption that can be submitted on-chain
* Attested Compute for performing computations on encrypted data off-chain with attestation
* Attested Reveal for decrypting data that has been made publicly accessible

## Attested Decrypt

Used when an authorized user needs a cryptographic proof of decryption that can be selectively revealed on-chain:

1. User requests decryption attestation offchain (via wallet signature or session key)
2. Client sends request with proof of authorization to decryption network
3. The decryption network verifies ACL permissions
4. Each decryption network node decrypts the value and creates a signed attestation
5. User receives the decryption attestation containing the plaintext and signatures
6. User can submit the attestation to a smart contract for on-chain verification and use

```mermaid theme={null}
sequenceDiagram
    participant User
    participant ACL Contract
    participant Inco Network
    participant Contract

    User->>User: Sign authorization (wallet/voucher)
    User->>Inco Network: Request decryption attestation
    Inco Network->>ACL Contract: Query ACL
    ACL Contract->>Inco Network: Return permissions
    Inco Network->>Inco Network: If allowed:
    Inco Network->>Inco Network: - Decrypt data
    Inco Network->>Inco Network: - Create signed attestation
    Inco Network->>User: Return decryption attestation
    User->>Contract: Submit attestation for verification
    Contract->>Contract: Verify signatures
    Contract->>Contract: Use decrypted value
```

## Attested Compute

Used when you need to perform computations on encrypted data completely off-chain and get a decryption attestation:

1. User requests computation attestation offchain (via wallet signature or session key)
2. Client sends request with proof of authorization and computation operation to decryption network
3. The decryption network verifies ACL permissions
4. Each decryption network node performs the computation on the encrypted data and creates a signed attestation
5. User receives the computation attestation containing the result and signatures
6. User can submit the attestation to a smart contract for on-chain verification and use

```mermaid theme={null}
sequenceDiagram
    participant User
    participant ACL Contract
    participant Inco Network
    participant Contract

    User->>User: Sign authorization (wallet/voucher)
    User->>Inco Network: Request computation attestation
    Inco Network->>ACL Contract: Query ACL
    ACL Contract->>Inco Network: Return permissions
    Inco Network->>Inco Network: If allowed:
    Inco Network->>Inco Network: - Perform computation on encrypted data
    Inco Network->>Inco Network: - Create signed attestation
    Inco Network->>User: Return computation attestation
    User->>Contract: Submit attestation for verification
    Contract->>Contract: Verify signatures
    Contract->>Contract: Use computation result
```

## Attested Reveal

Used when data has been made publicly accessible and anyone can request decryption attestation:

1. Data is made public using e.reveal() on-chain
2. Anyone can request decryption attestation offchain
3. The decryption network verifies the data has been revealed
4. Each decryption network node decrypts the value and creates a signed attestation
5. Requester receives the decryption attestation containing the plaintext and signatures
6. Anyone can submit the attestation to a smart contract for on-chain verification and use

```mermaid theme={null}
sequenceDiagram
    participant User
    participant Contract
    participant Inco Network

    Contract->>Contract: e.reveal(handle)
    User->>Inco Network: Request decryption attestation
    Inco Network->>Contract: Verify data is revealed
    Contract->>Inco Network: Confirm revelation
    Inco Network->>Inco Network: - Decrypt data
    Inco Network->>Inco Network: - Create signed attestation
    Inco Network->>User: Return decryption attestation
    User->>Contract: Submit attestation for verification
    Contract->>Contract: Verify signatures
    Contract->>Contract: Use decrypted value
```
