> For the complete documentation index, see [llms.txt](https://cifer.gitbook.io/cifer-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cifer.gitbook.io/cifer-docs/documentation/cifer-sdk/web3-integration/file-encryption.md).

# File encryption

File operations are asynchronous. The application uploads a file, receives a job identifier, polls job status, and downloads the completed result.

```mermaid
flowchart LR
    F[Input file] --> U[Upload]
    U --> J[Job ID]
    J --> P[Poll status]
    P -->|pending| P
    P -->|complete| D[Download result]
    P -->|failed| E[Handle typed error]
```

## Integration pattern

1. Validate the file type and size in the application.
2. Start the encrypt or decrypt upload with the target secret and signer.
3. Store the returned job identifier.
4. Poll with bounded backoff and an application timeout.
5. Download only after a completed status.
6. Verify the result belongs to the expected job, user, secret, and environment.
7. Remove temporary local files according to your retention policy.

{% hint style="warning" %}
A queued job may outlive a browser screen or HTTP request. Persist enough non-sensitive job state to resume safely, and never expose another user's job identifier.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cifer.gitbook.io/cifer-docs/documentation/cifer-sdk/web3-integration/file-encryption.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
