Zero-Knowledge Sharing / Architecture

How Encrypted Template Sharing Works

Share a working PDF template with teammates or clients via a temporary link—without our servers ever seeing your design, sample JSON data, or decryption password.

Cryptographic & Retention Specifications

  • AES-256-GCM — Double-Layer Encryption: CODEPDF1 format encryption plus a passcode-derived 256-bit key in Web Crypto
  • 600,000 — PBKDF2 Iterations: OWASP-recommended PBKDF2-HMAC-SHA256 key derivation with fresh 128-bit salts
  • 1–30 Days — Auto-Expiring Links: Links stop immediately at expiry and are permanently purged daily at 00:00 GMT
  • 900 KB — Template Size Cap: Built-in in-browser image optimizer, or export unlimited local .pdftemplate files

End-to-End Share Lifecycle

  1. 01. Prepare your template in the browser (Validate & Optimize Locally)

    Open the Share dialog in the Visual Editor (or share from an AI agent via MCP). CodePDF checks that your design has at least two content elements and stays under the 900 KB URL-sharing cap. If embedded images push it over the limit, you can compress images for the share copy in one click without modifying your local editor project.

  2. 02. Lock with a 12+ character password (Web Crypto Double Encryption)

    Pick an expiration window (1, 7, 14, or 30 days) and enter a password of at least 12 characters—or generate an unbiased CSPRNG passphrase (Craft-XXXXXXXX-XXXXXXXX, ~93.6 bits of entropy). Your browser wraps the JSON project in CodePDF's CODEPDF1 AES-GCM container (Layer 1), then encrypts those bytes again with AES-256-GCM using a key derived via 600,000-iteration PBKDF2-HMAC-SHA256 (Layer 2) with a fresh 16-byte salt and 12-byte IV.

  3. 03. Upload opaque ciphertext and get a clean link (Create-Only Edge Storage)

    Only the hex-encoded ciphertext, public salt/IV, salted PBKDF2 verifier digest, project title, element count, and expiration timestamp are sent to POST /api/share. The server assigns a cryptographically random 32-character (192-bit) ID, inserts the row create-only so existing links can never be overwritten, and returns /share/<id>. Your password is never sent to the server and never embedded in the URL or #hash.

  4. 04. Recipients decrypt and inspect in-browser (Client-Side Decryption & Live Preview)

    Send the share link and password through separate messages. When a recipient opens /share/<id>, any stray URL fragment is stripped immediately, and entering the password decrypts both AES-GCM layers locally in their browser. They see a split-screen view—Visual Design, editable Sample JSON, Data Model, Component Tree, and a live PDFium WebAssembly PDF preview—and can download a .pdftemplate backup, open the project in the Editor, or lock and clear memory with one click.

Zero-Knowledge Data Boundary

Here is the exact split between what touches the Cloudflare Worker edge database and what stays strictly inside your browser.

Comparison of data stored on the edge server versus data kept strictly in your browser
Data ComponentStored on Edge ServerStays in Your Browser
Template layout, fonts & sample dataOpaque double-encrypted AES-256-GCM ciphertext hex only (unreadable)Plaintext JSON project, components, bindings, and embedded assets
Decryption password (12+ chars)Never received; stores only a slow PBKDF2-derived salted verifier digestEntered manually by sender/recipient; never embedded in URL or #hash
Live PDF preview & JSON testingZero server-side PDF rendering or data processingRendered locally via PDFium WebAssembly with interactive Sample JSON edits
Share ID & retention metadataServer-assigned 32-char (192-bit) ID, title, element count, expiry timestampOptional local share history saved only in your browser storage
Expiration, immutability & cleanupCreate-only POST; returns 404 once expired and purged daily at 00:00 GMTInstant Lock button clears decrypted project and revokes PDF blob URLs

Security & Privacy Safeguards

No Passwords in URLs (#key= Disabled)

Share links never include decryption keys in query parameters or hash fragments. If a URL arrives with a stray #fragment, the share portal strips it with history.replaceState before reading—preventing leaks via chat link previews, logs, or screenshots.

Create-Only, Tamper-Resistant Records

POST /api/share always inserts a brand-new server-generated 192-bit ID. PUT, PATCH, and DELETE return 405 Method Not Allowed, so no third party can overwrite a shared template or delete someone else's link.

Brute-Force Lockout & Edge Rate Limits

Five failed decryption attempts trigger a 60-second client-side lockout persisted across reloads in sessionStorage, paired with Cloudflare Workers atomic rate limits (10 share creations/min and 120 reads/min per client).

Automatic Expiry & Daily Cron Purge

Expired links immediately stop serving payloads (404 Not Found) the second their TTL ends. Every day at 00:00 UTC (GMT), a scheduled Cloudflare Worker Cron job permanently deletes expired rows from Cloudflare D1.

Private Share Links Stay Out of Search

All /share/<id> viewer routes send X-Robots-Tag: noindex, nofollow headers at the edge and render noindex meta tags—while raw /api/share/ endpoints are disallowed in robots.txt—so shared drafts are never indexed by search engines.

Need Permanent or >900 KB Sharing?

For templates larger than 900 KB, permanent archival, or Git pull-request workflows, download an encrypted .pdftemplate file directly from the Editor and share it via Git, Slack, or email without touching any server.

Frequently Asked Questions About Sharing

Can CodePDF read my shared PDF template or recover a lost password?

No. Both encryption layers run entirely in your browser using the Web Crypto API before anything is uploaded. The server only receives opaque ciphertext and never sees your password, so lost passwords cannot be recovered—simply create a new share link from your local project.

Why isn't the password included in the share URL?

Embedding keys in URL fragments (#key=) leaks secrets into link unfurlers, browser history, analytics tools, and shared screenshots. Keeping the link and password separate guarantees that someone who intercepts only the URL still cannot decrypt your template.

Can I delete or edit a share link after creating it?

Share records are intentionally create-only and immutable—there are no user accounts, so HTTP DELETE and PUT are disabled (405 Method Not Allowed) to prevent unauthorized tampering. Links expire automatically after your chosen 1, 7, 14, or 30-day window and are permanently purged at the next 00:00 GMT sweep.

Why is URL sharing capped at 900 KB, and how do I share larger templates?

Encrypted ciphertext is hex-encoded inside Cloudflare D1 rows (2 MB row cap), so uncompressed templates are capped at 900 KB. Inside the Share dialog, you can click Compress Images to shrink embedded images for the share copy without altering your editor draft—or download a .pdftemplate file with no size limit.

What can a recipient do after unlocking a shared link?

Recipients get an interactive split-screen preview where they can inspect the visual canvas, edit Sample JSON to test dynamic reflow against a live PDFium WebAssembly PDF preview, inspect the Data Model and Component Tree, download a .pdftemplate backup, create their own share link, or open a copy directly in the Visual Editor to export code across 22 PDF libraries.

Design & Share a Template | Share via MCP Server | Privacy Policy