> 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/cifer-sdk.md).

# Cifer SDK

Cifer SDK is the TypeScript integration layer for **Cifer — Cryptographic Infrastructure for Encrypted Records**. It gives applications a common interface for creating secrets, encrypting and decrypting data, processing files, delegating access, and anchoring encrypted records on-chain.

{% hint style="warning" %}
**Beta software.** The SDK API may change. Pin the package version, test upgrades, and review the changelog before deploying an update.
{% endhint %}

## Choose an integration path

| Path     | Identity                                                    | Best for                                                              |
| -------- | ----------------------------------------------------------- | --------------------------------------------------------------------- |
| **Web3** | EIP-1193 wallet signatures                                  | dApps, wallets, protocols, and tokenized products                     |
| **Web2** | Email, password, Ed25519 identity key, and managed sessions | Consumer and enterprise applications that should not require a wallet |

Both paths use the same Cifer cryptographic infrastructure and Blackbox services.

## What the SDK provides

* ML-KEM-768 post-quantum key encapsulation with AES-256-GCM payload encryption
* Wallet-independent Web3 adapters and transaction intents
* Email-based Web2 authentication and managed sessions
* Text and file encryption
* Secret ownership, delegates, and permits
* On-chain commitments for encrypted records
* Auto-discovery of supported chains and controller addresses
* Typed errors, retry behavior, and TypeScript definitions
* High-level flows for multi-step operations

## Architecture at a glance

```mermaid
flowchart LR
    App[Application] --> SDK[Cifer SDK]
    SDK --> SC[SecretsController]
    SDK --> BB[Blackbox]
    SC --> Chain[Supported blockchain]
    BB --> IPFS[Public keys on IPFS]
    BB --> E[Enclave cluster]
    E --> S[Threshold key shards]
```

A Cifer secret is an ML-KEM-768 key pair. Its public key is available through IPFS. Its private key is split across the enclave cluster using threshold cryptography. The SecretsController records ownership and authorization; the Blackbox performs encryption, decryption, and asynchronous file jobs.

## Start building

```bash
npm install cifer-sdk
```

```typescript
import { createCiferSdk } from 'cifer-sdk';

const sdk = await createCiferSdk({
  blackboxUrl: 'https://blackbox.cifersecurity.com:3010',
});

console.log(sdk.getSupportedChainIds());
```

Use the Web3 quickstart for wallet-based applications or the Web2 quickstart for email-based applications.

## Canonical resources

* [SDK website](https://sdk.cifer-security.com/)
* [Generated TypeScript API](https://sdk.cifer-security.com/docs/api)
* [npm package](https://www.npmjs.com/package/cifer-sdk)
* [GitHub repository](https://github.com/cifer-security/cifer-sdk)
* [AI-readable SDK reference](https://sdk.cifer-security.com/llm.txt)

{% hint style="info" %}
The generated TypeScript reference remains the symbol-level source of truth. This GitBook space explains the integration model, recommended workflows, and security boundaries.
{% 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/cifer-sdk.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.
