# dStorage SDK > Privacy-first data layer for dApps dStorage is a TypeScript SDK for dApps that need to keep user data private. It encrypts data on the user's device (XChaCha20-Poly1305, with keys from a password, mnemonic, keypair or passkey), stores the ciphertext on Arweave, and writes an owner-only reference to the Midnight blockchain through a pre-compiled DataRegistry contract. Use it for health, identity, finance or enterprise data that the app operator must never see in plaintext. The optional dStorage Pro service pays Arweave storage and Midnight DUST fees on users' behalf. - Install: `npm install @dstorage-tech/dstorage-sdk` (https://www.npmjs.com/package/@dstorage-tech/dstorage-sdk) - Source: https://github.com/dStorageTech/dstorage-sdk - Starter app: https://github.com/dStorageTech/dstorage-starter-template - When to use it, and when not to: https://dstorage.pro/docs/faq/when-to-use.md The SDK is pre-1.0 and its API changes between minor versions. Don't rely on prior knowledge of it: check the version installed in package.json and follow these docs. New to the SDK? Start with the Mock Adapters guide. ## Table of Contents ### Guide - [Guide](https://dstorage.pro/docs/guide.md): The order to read the dStorage guides in, from in-memory mock adapters to a live Midnight network with passkey encryption and managed payments. - [Build with AI](https://dstorage.pro/docs/guide/build-with-ai.md): Use these docs with Claude Code, Cursor, Codex or any other AI coding agent — llms.txt, project instructions, and a ready-made prompt for every guide. - [Mock Adapters](https://dstorage.pro/docs/guide/mock-adapters.md): Your first encrypted upload and retrieval with dStorage in a few minutes, using in-memory mock adapters: no wallet, no Docker, no external services. - [Core Concepts](https://dstorage.pro/docs/guide/core-concepts.md): How dStorage encrypts data (per-upload DEK wrapped by a KEK), the difference between storageId and refId, and how storage, chain and encryption adapters fit together. - [Local & Simulator Adapters](https://dstorage.pro/docs/guide/local-simulator-adapters.md): Run dStorage against a local Arweave node (arlocal) and the in-process Midnight simulator, with real DataRegistry circuits and no wallet or proof server. - [Managed Payments Service](https://dstorage.pro/docs/guide/managed-payments-service.md): Route Arweave storage and Midnight chain payments through dStorage Pro's TEST sandbox, so users never need a funded wallet, while still running against arlocal and the simulator. - [Midnight Network Adapter](https://dstorage.pro/docs/guide/midnight-network-adapter.md): Connect a browser dApp to a real Midnight network with MidnightChainAdapter, a wallet extension (1AM or Lace) and a local proof server. - [Passkey Encryption (WebAuthn PRF)](https://dstorage.pro/docs/guide/passkey-encryption.md): Encrypt uploads with a platform passkey instead of a password, using WebAuthnPrfEncryptionAdapter and the WebAuthn PRF extension. - [Managed Payments on Midnight](https://dstorage.pro/docs/guide/managed-payments-midnight.md): Use dStorage on a real Midnight network with DUST fees sponsored by dStorage Pro, so neither you nor your users need a wallet funded with DUST or NIGHT. ### FAQ - [FAQ](https://dstorage.pro/docs/faq.md): Frequently asked questions about dStorage: concepts, developer usage, encryption and security, deployment, adapters, managed payments and troubleshooting. - [When to Use dStorage](https://dstorage.pro/docs/faq/when-to-use.md): When dStorage is the right tool, and when it isn't: storing private user data in a dApp, encrypting files before Arweave, off-chain data for Midnight contracts, passkey encryption, and sponsoring storage and chain fees. - [Concepts & Features](https://dstorage.pro/docs/faq/concepts.md): What dStorage is, who it's for, what it stores on-chain vs off-chain, and how the DataRegistry contract and on-chain references work. - [Developers](https://dstorage.pro/docs/faq/developers.md): Practical dStorage SDK usage: minimal setup, init() and destroy(), metadata, cost estimates, updating, listing and removing references, key rotation and browser support. - [Encryption & Security](https://dstorage.pro/docs/faq/encryption-security.md): dStorage's encryption design (XChaCha20-Poly1305, DEK/KEK), the encryption adapters available, which secrets the SDK holds, and its security guarantees. - [Deployment & Configuration](https://dstorage.pro/docs/faq/deployment-configuration.md): Prerequisites and configuration for running dStorage: proof server, arlocal, supported Midnight networks, browser vs Node.js setup, reusing a contract and serving ZK artifacts. - [Adapters](https://dstorage.pro/docs/faq/adapters.md): What storage, chain and encryption adapters are, which ones dStorage ships, and how multiple adapters and fallback work. - [Managed Payments & dStorage Pro](https://dstorage.pro/docs/faq/managed-payments.md): What dStorage Pro is, what the managed payment service can see, how to configure it, ds_* API tokens vs browser-safe JWT tokens, and testing without spending real funds. - [Troubleshooting](https://dstorage.pro/docs/faq/troubleshooting.md): Fixes for common dStorage errors: duplicate bn.js copies, wallet extension not detected, invalid prover config, and proof server or wallet proving failures. ### Other - [Features](https://dstorage.pro/docs/features.md): Everything dStorage offers: developer features of the SDK, privacy guarantees for end users, and what the dStorage Pro managed payments service adds. - [Reference](https://dstorage.pro/docs/reference.md): dStorage SDK API reference (coming soon); until then, the guides cover the full init(), store() and retrieveByRefId() call pattern.