SECURITY

Cryptographically Enforced at the Edge

Triple-Layer Encryption

Layer 1: Client-Side Encryption (AES-GCM-256)

Your content is encrypted in your browser BEFORE sending to the server using split-key architecture.

  • Key A: Stored in URL hash (never sent to server)
  • Key B: Sent to server (encrypted before storage)
  • Master Key: Derived from Key A + Key B using HKDF
  • Result: AES-GCM-256 encrypted ciphertext

Layer 2: Server-Side Key Encryption

Key B is encrypted with MASTER_ENCRYPTION_KEY before database storage.

  • Master key stored as environment secret (not in database)
  • Uses HKDF key derivation with seal ID as salt
  • Even database breach cannot decrypt Key B

Layer 3: Encrypted Database Storage

All seals stored encrypted in Cloudflare D1 database:

  • ✅ Encrypted blob (AES-GCM-256 ciphertext as base64)
  • ✅ Encrypted Key B (AES-GCM-256 with master key)
  • ✅ IV (public, needed for decryption)
  • ✅ Metadata (unlock time, timestamps)
  • ❌ NO plaintext content EVER stored

🛡️ What an Attacker with Database Access CANNOT Do:

  • Decrypt content (needs Key A from URL hash)
  • Decrypt Key B (needs master encryption key)
  • Modify unlock time (cryptographically signed)
  • Access content early (server enforces time-lock)

Infrastructure Security

Cloudflare D1 Database Storage

All seals stored encrypted in Cloudflare D1 (SQLite at the edge) with triple-layer encryption. Encrypted blobs stored as base64 TEXT. Maximum 560KB per seal (due to D1 column limits).

Edge Runtime

All API routes run on Cloudflare Workers at the edge, providing low latency and DDoS protection.

Immutable Audit Logs

Every access attempt is logged with timestamps, IP addresses, and outcomes. Logs cannot be modified or deleted.

Security Features (v0.9.1)

Encrypted Local Storage

Browser-based encrypted vault for saving seals. AES-GCM-256 encryption with unique key per browser. No server-side storage of user's vault links. Privacy-first design.

Simplified Security Model

Removed seed phrase complexity. Always uses cryptographically random keys. No recovery mechanism (by design). Users control what's stored via COPY | DOWNLOAD | SAVE buttons.

Security Features (v0.6.2)

Replay Attack Prevention

Nonce-first validation prevents concurrent token reuse. Database-backed nonce storage ensures replay detection across all worker instances.

Atomic Database Updates

All-or-nothing pulse updates prevent inconsistent state. Single SQL operation ensures both timestamp and unlock time update together.

Strict Token Validation

Format validation rejects malformed pulse tokens before processing. Seal ID, timestamp, nonce, and signature all validated with regex.

Safe Deletion Order

Database-first deletion prevents data loss. If blob deletion fails, seal record is already gone (acceptable orphan).

Collision-Resistant Fingerprinting

SHA-256 hashed fingerprints for rate limiting. Combines IP + User-Agent + Accept-Language without truncation.

Memory Leak Protection

Automatic cleanup of concurrent request tracker at 10K entries. Zero-count entries removed first.

Accurate Access Metrics

Only counts successful unlocks, not locked checks. Provides accurate usage analytics.

File Size Enforcement

560KB limit (before encryption) enforced at all layers: UI validation, API validation, and database storage.

Defense Layers

Layer 1: Cryptographic Defenses

  • AES-GCM-256 encryption (client + server)
  • Split-key architecture (Key A never leaves browser)
  • HMAC-signed pulse tokens with nonce replay protection
  • Master key encryption for Key B storage
  • SHA-256 blob hashing for integrity verification

Layer 2: Time-Lock Enforcement

  • Server-side time validation (client clock irrelevant)
  • Cloudflare NTP-synchronized timestamps
  • Atomic database operations prevent race conditions
  • Random jitter (0-100ms) prevents timing attacks

Layer 3: Access Control

  • Rate limiting with SHA-256 fingerprinting
  • Database-backed nonce storage (replay detection)
  • Cloudflare Turnstile bot protection
  • Concurrent request limiting (5 per IP)
  • Strict input validation and sanitization

Layer 4: Operational Security

  • Immutable audit logging (all access tracked)
  • Transaction rollback on failures
  • Circuit breakers with retry logic
  • Error sanitization (no internal state leakage)
  • Warrant canary for transparency

Security Guarantees

Zero-Knowledge Architecture

No user accounts, no passwords, no authentication. Security is enforced through cryptography alone. This eliminates credential theft, phishing, and password database breaches.

Time-Lock Enforcement

The server will not release Key B before the unlock time. Server-side validation using Date.now() prevents client-side time manipulation.

Rate Limiting with Fingerprinting

API endpoints use browser fingerprinting (IP + User-Agent + Language) with D1 database persistence. Rate limits survive across all worker instances. 10-20 requests per minute per fingerprint.

No Single Point of Failure

Split-key architecture means neither the server alone nor the client alone can decrypt content.

Triple-Layer Encrypted Storage

All seals encrypted with AES-GCM-256 client-side, Key B encrypted with master key server-side, and database encryption at rest. Zero plaintext storage.

Client-Side Decryption

Decryption happens in your browser. The server never sees the decrypted content.

CAPTCHA Protection

Turnstile CAPTCHA on seal creation prevents automated abuse and bot attacks.

Threat Model

Protected Against:

  • Unauthorized early access (time-lock enforced server-side)
  • Client-side time manipulation (server validates with Date.now())
  • Server compromise (split-key architecture)
  • Data tampering (AEAD encryption + database integrity)
  • Brute force attacks (256-bit keys + fingerprinted rate limiting)
  • IP rotation bypass (browser fingerprinting)
  • Timing attacks (response jitter)
  • Serverless state bypass (D1-backed rate limits and nonces)
  • Automated abuse (Turnstile CAPTCHA)
  • Replay attacks (nonce validation in D1 database)

Not Protected Against:

  • Loss of vault link (Key A is in URL hash - treat like a password)
  • Browser history/bookmark exposure (inherent to client-side crypto)
  • Compromised recipient device after unlock
  • Cloudflare infrastructure failure
  • Quantum computing attacks (future threat)

Open Source

TimeSeal is open source under the Business Source License. The code is available for inspection and audit on GitHub.

VIEW SOURCE CODE