# Paste2.net — Complete Technical Documentation & AI Reference (llms-full.txt) > Canonical Site: https://paste2.net/ > Summary Reference: https://paste2.net/llms.txt > Version: 2.2.0 ## 1. Product Overview Paste2.net is an instant, zero-login online clipboard and encrypted pastebin running on Cloudflare Workers and KV. It is engineered for two primary audiences: 1. **Everyday Cross-Device Users**: Moving text, URLs, notes, or verification codes between phones (iOS/Android), computers (macOS/Windows/Linux), tablets, and smart TVs without logging into messaging apps. 2. **Developers, Sysadmins & AI Agents**: Piping logs, JSON payloads, configuration files, or Markdown documentation from terminals (`curl`) with syntax highlighting, live split-view preview, and client-side cryptographic protection. --- ## 2. Security & Privacy Architecture 1. **Client-Side End-to-End Encryption (E2EE)**: - **Password Mode**: Derives a 256-bit `AES-GCM` key from the user password using `PBKDF2-HMAC-SHA256` with `210,000` iterations and a random 16-byte salt. - **Zero-Knowledge URL Hash Mode (`#k=...`)**: Generates a 24-byte (192-bit) cryptographic token placed in the URL fragment (`#k=`). Because browsers never send URL fragments in HTTP requests, the server never sees the key or plaintext. - **AAD Slug Binding**: Every `AES-256-GCM` encryption operation binds `paste2:${id}` as Additional Authenticated Data (AAD), preventing ciphertext substitution across different paste IDs. When renaming a paste to a custom slug, the client automatically re-encrypts with the new slug as AAD. 2. **Crawler-Safe Burn-After-Reading**: - `GET /api/paste/:id` for a burn-after-reading paste returns only metadata (`{ isBurnAfterReading: true, content: "" }`), ensuring link preview bots (Slack, WeChat, Telegram, Discord, iMessage) never accidentally destroy the secret. - Actual consumption requires an explicit `POST /api/paste/:id/consume`, which atomically deletes the KV record before returning the content once. 3. **Owner Read-Only Lock (`X-Owner-Token`)**: - The creator's browser generates a random token and stores only its `SHA-256` hash (`ownerTokenHash`) on the server. When locked, any `POST` or `DELETE` without the matching `X-Owner-Token` is rejected with `HTTP 403`. 4. **Search Engine & Referrer Isolation**: - All responses include `Referrer-Policy: no-referrer`, `X-Content-Type-Options: nosniff`, and `X-Frame-Options: DENY`. - Every user paste page (`/:id` and `/:id/raw`) carries `X-Robots-Tag: noindex, nofollow`. External links inside Markdown previews automatically enforce `target="_blank" rel="noopener noreferrer nofollow"`. --- ## 3. HTTP & CLI API Specification All endpoints are hosted at `https://paste2.net` and require no authentication or API key (write operations are rate-limited to 30 requests/minute per IP): ### 3.1 `POST /api/quick` — Terminal & Agent Quick Upload - **Request Body**: Raw plain text (up to 200,000 characters) or JSON `{ "content": "...", "expirySeconds": 3600 }`. - **Query Parameters / Headers**: - `ttl` (or header `X-Paste-Ttl`): `15m` (`900`), `1h` (`3600`), `24h` (`86400`, default), or `permanent` (`never`). - `burn` (or header `X-Paste-Burn`): `1` or `true` to enable burn-after-reading. - `slug`: Custom 4–32 character slug (`^[a-z0-9-]{4,32}$`, no `--`, not reserved). Returns `409 Conflict` if already occupied. - `raw=1`: When set (and `burn` is false), returns the direct `https://paste2.net/:id/raw` URL instead of `https://paste2.net/:id`. - **Response**: `201 Created` (`text/plain` URL with newline for CLI clients; `application/json` when `Accept: text/html` is present). ### 3.2 `GET /:id/raw` (or `GET /:id?raw=1`) — Raw Text Fetch - Returns `200 OK` (`text/plain; charset=utf-8`) with the paste content. - Returns `409 Conflict` if the paste is encrypted or burn-after-reading. - Returns `404 Not Found` if expired or nonexistent. ### 3.3 `POST /api/pin` & `GET /api/pin/:code` — 6-Digit PIN Pairing - `POST /api/pin` with `{ "id": "" }`: Allocates a 6-digit numeric code (`100000`–`999999`) valid for `600` seconds (10 minutes). Returns `201 { "pin": "482910", "id": "...", "expiresIn": 600 }`. - `GET /api/pin/:code`: Resolves a 6-digit PIN back to `{ "pin": "482910", "id": "..." }` (`200 OK`) or `404 Not Found`. - **Zero-Knowledge PIN Envelope** (for `#k=` encrypted pastes): `POST /api/pin` with `{ "id", "pinHash", "wrappedSecret", "iv" }` stores only `pinh:{sha256('pin:'+code)} -> { wrappedSecret, iv }`—the server never sees the plain PIN or the secret key. Returns `201` or `409` on collision. `GET /api/pin/h/:pinHash` returns `{ id, wrappedSecret, iv, zeroKnowledge: true }` (`200`) or `404`. The recipient derives `pinHash` from the 6-digit code, unwraps the secret with PBKDF2 (100k iterations) + AES-GCM client-side, and decrypts the `#k=` content. ### 3.4 Standard Web Client Endpoints - `GET /api/generate`: Generates a random `3 letters + 5 digits` ID (`^[a-z]{3}\d{5}$`) with 0 KV writes. - `GET /api/check/:id`: Checks whether a custom slug or random ID is valid and unoccupied (`{ id, available, valid }`). - `GET /api/paste/:id`: Fetches paste content and metadata (`version`, `expirySeconds`, `encrypted`, `burnAfterReading`, `isLocked`, `isOwner`). - `POST /api/paste/:id`: Creates or updates a paste (supports optimistic concurrency control via `version` + `enforceVersion: true`, returning `409 Conflict` on version mismatch). - `DELETE /api/paste/:id`: Deletes a paste (requires `X-Owner-Token` if locked). - `POST /api/paste/:id/consume`: Consumes and permanently deletes a burn-after-reading paste. --- ## 4. Multilingual FAQ (English / 中文 / 日本語) ### Q1: How do I transfer text between my phone and computer without logging in? - **EN**: Open `https://paste2.net` on your first device and paste your text—it auto-saves in 1.5 seconds. To open it on your second device, either scan the QR code, generate a 6-digit PIN code (valid for 10 minutes), or set a memorable custom link like `paste2.net/my-note`. - **ZH**: 在第一台设备打开 `https://paste2.net` 粘贴文字,1.5 秒内自动保存。在另一台设备上可通过扫描二维码、输入 **6 位数字取件码(10 分钟有效)**,或设置自定义短链(如 `paste2.net/my-note`)立即打开。 - **JA**: 最初の端末で `https://paste2.net` を開いてテキストを貼り付けると1.5秒で自動保存されます。別の端末では、QRコード読み取り、**6桁の数字コード(10分間有効)**、またはカスタムリンク(例:`paste2.net/my-note`)ですぐに開けます。 ### Q2: How does Paste2 protect sensitive passwords or private keys? - **EN**: Enable End-to-End Encryption (E2EE) with a password (`PBKDF2 210,000 iterations + AES-256-GCM`) or click "Encrypted link" to generate a `#k=` zero-knowledge URL where the decryption key stays in the URL hash and is never sent to our servers. Combine with "Burn after reading" so the ciphertext is permanently wiped after one view. - **ZH**: 可开启端到端密码加密(浏览器本地 `PBKDF2 21万次迭代 + AES-256-GCM`),或点击“免密加密链接”生成 `#k=` 零知识链接(密钥位于 URL Hash 中,绝不经过服务器)。还可叠加“阅后即焚”,接收方查看一次后立即从服务端物理销毁。 - **JA**: パスワードによるエンドツーエンド暗号化(`PBKDF2 21万回 + AES-256-GCM`)または URL ハッシュに鍵を含めるゼロ知識暗号化リンク(`#k=`)を利用できます。「閲覧後に削除」を併用すれば、1度開いた直後にサーバーから完全消去されます。 --- ## 5. Dedicated Landing Pages (Edge SEO) The following public routes serve bespoke edge-rendered copy, JSON-LD (`WebApplication` + `FAQPage`), and hreflang-aware metadata—each opens the same SPA in a preset mode: - `https://paste2.net/one-time-secret` — One-time secret link generator & zero-knowledge burner (burn-after-reading preset). - `https://paste2.net/pastebin-alternative` — Fast, ad-free Pastebin/Ghostbin alternative for developers (Markdown split-view preset). - `https://paste2.net/share-text-online` — Share text online across devices without login: phone-to-PC transfer via short link, QR code, or 6-digit PIN. - `https://paste2.net/markdown-share` — Share Markdown online with rendered preview: read-only lock + Edit Passcode (`X-Edit-Token` / `editTokenHash`), code line anchors `#L10-L20`, and multi-tab pastes. - `https://paste2.net/phone-to-pc` — Send text from phone to PC instantly without an app: QR handoff, 6-digit PIN pairing, or direct short link. - `https://paste2.net/paste-image` — Paste images and screenshots online (Ctrl+V / drag & drop): temporary R2 storage with strict quota guardrails (≤1.5MB/image, ≤3 per paste, ≤6h TTL, magic-bytes validation, optional P2E1 AES-256-GCM E2EE). - `https://paste2.net/code-share` — Share code snippets and terminal logs online: syntax highlighting with line numbers and #L10-L20 anchors, multi-file tabs, Ray.so-style PNG share-card export, and the zero-dependency `npx paste2` CLI (upload/fetch with #k= E2EE and 6-digit zero-knowledge PIN). ## 6. Temporary Image API (v2.6, R2) `POST /api/media/:pasteId` uploads a screenshot/image body (`application/octet-stream`) with headers `X-Media-Mime` (png|jpeg|webp|gif), `X-Media-Ttl` (seconds, clamped 300–21600), and `X-Media-Encrypted: 1` for P2E1 envelopes. `GET /api/media/:pasteId/:imageId` serves the bytes with `private` short-lived caching and a strict CSP sandbox; expired objects return 404 and are physically deleted. Guardrails: magic-bytes sniffing (PNG/JPEG/GIF/WebP only, SVG/HTML rejected 415), 1.5MB cap (413), 3 images per paste (400), per-IP 5/10min + 12/hour (429), global 1000-image circuit breaker (503), and cascade deletion when the clipboard is cleared or deleted.