Cryptographic Engineering · Zero-Trust Web Messaging📍 Teghra, Bihar, India🗓️ 2024–2026● Live Web Demo & Open Source Protocol

SecureTalk

A zero-trust, zero-data end-to-end encrypted messaging system built on the native Web Crypto API, featuring client-side ECDH P-256 key exchange, AES-256-GCM authenticated cipher streams, and blind ephemeral relays.

SecureTalk end-to-end encrypted chat interface with cryptographic lock and verified fingerprint

SecureTalk live conversation view: Client-side AES-256-GCM encryption with volatile memory storage.

Symmetric CipherAES-256-GCM

Authenticated encryption with 12-byte unique IVs and 128-bit authentication tags per message.

Key ExchangeECDH P-256

Elliptic Curve Diffie-Hellman executed client-side via native browser Web Crypto API.

Server Storage0 Bytes Logged

Blind relays forward ciphertexts without writing messages, keys, or contact graphs to disk.

Account IdentityZero Phone / Email

Random 16-character alphanumeric session tokens generated in volatile browser RAM.

System Section 01Executive Summary

Executive Overview

What It Is

SecureTalk is a privacy-first web messaging application engineered around zero-trust cryptographic principles. It enables real-time peer-to-peer communication without phone numbers, email addresses, centralized user registries, or persistent server databases.

Why It Exists

Mainstream messaging platforms enforce phone number linkage, creating permanent digital trails connecting communication to personal KYC records. Furthermore, centralized servers log social graphs (metadata on who speaks to whom, at what time, from which IP) and backup chat databases that can be subpoenaed or breached.

Who It Serves

Journalists, security researchers, privacy advocates, and individuals needing a quick, untraceable communication channel that leaves zero forensic footprints on servers or devices.

The Engineering Core

Built directly on the native browser Web Crypto API (window.crypto.subtle). Elliptic Curve Diffie-Hellman (ECDH P-256) key generation and AES-256-GCM symmetric encryption run inside volatile browser memory. Private keys are marked unextractable and vanish completely upon tab closure.

✨ Key Architecture Takeaways:

  • ✓Eliminates all personal identifiers (no phone number, no email, no central identity directory).
  • ✓Cryptographic keys generated and stored strictly in browser RAM—never written to IndexedDB or localStorage.
  • ✓Blind relay servers operate without decryption keys, observing only ephemeral ciphertext and destination session IDs.
System Section 02Origin & Ground Reality

Problem & Ground Motivation

The Surveillance Flaws in "Encrypted" Commercial Messengers

Commercial messaging applications proudly market end-to-end encryption. However, end-to-end encryption alone does not guarantee privacy when the surrounding system architecture is fundamentally compromised.

First is the Identity Anchor: Almost every major platform mandates a valid mobile phone number linked to an official national SIM registry. By requiring a phone number, every encrypted conversation is inextricably tied to a verified legal identity, billing address, and government database.

Second is the Metadata Graph: Even when message plaintext is encrypted, centralized servers observe and store extensive communication metadata: which session IDs communicate, message timestamps, payload lengths, IP addresses, and device fingerprints. This social graph is frequently more revealing than the conversation itself.

Third is Local Forensic Residue: Mainstream apps persist encrypted SQLite databases, thumbnails, and key caches to permanent flash storage. Anyone seizing the physical device can extract chat logs. SecureTalk was conceived to solve these three structural vulnerabilities.

⚠️ Real-World Ground Constraints:

  • ▪Browser environment limitations: Browsers are notoriously vulnerable to XSS and memory extraction if third-party scripts are introduced.
  • ▪Zero-trust relay assumption: The intermediary relay server must be treated as actively curious or compromised.
  • ▪Usability vs Security trade-off: Key exchange must be fast and intuitive without requiring manual command-line PGP key generation.
📌Cryptographic Honesty Principle

SecureTalk makes no claims of being "100% untraceable" or "military grade." While client-side cryptography is rigorously implemented, browser-based messaging is always subject to underlying OS memory integrity and host server TLS delivery guarantees.

System Section 03Specifications

Goals & Engineering Constraints

🎯 Functional Goals

  • •Generate transient session identities and cryptographic keypairs in under 200ms upon page load.
  • •Support out-of-band key exchange via direct URL hash fragments or high-density in-person QR codes.
  • •Encrypt text, images, and ephemeral voice notes client-side before transmission.
  • •Purge all session keys and message buffers instantly upon closing the browser tab or clicking Wipe Session.

✨ UX & Ergonomics

  • •Modern, intuitive chat interface inspired by premium desktop messengers.
  • •Visual cryptographic indicators: lock badges, SHA-256 key fingerprints, and verification confirmation.
  • •Zero setup steps: no verification SMS, no email confirmation links, no passwords.

⚡ Performance Budgets

  • •Strictly utilize native window.crypto.subtle primitives without heavy, untrusted third-party crypto libraries.
  • •Unique 12-byte initialization vector (IV) generated for every single message packet.
  • •WebSocket relay communication without any persistent database read/write queries.

🛡️ Security & Hardware Guardrails

  • •Private keys marked { extractable: false } in Web Crypto API to minimize exfiltration risk.
  • •Zero storage of decrypted messages in IndexedDB, localStorage, or cookies.
  • •Plaintext never serialized to disk or temporary cache files.
System Section 04Topology & Pipeline

Architecture & System Design

SecureTalk decouples identity, key exchange, and transport. The client generates an ECDH P-256 keypair in RAM. The public key is exchanged out-of-band. Once a shared secret is derived via HKDF-SHA256, all messages are encrypted with AES-256-GCM. The server is a blind WebSocket forwarder.

Topology & Data Pipeline Schema
+----------------------------+                     +----------------------------+
|      ALICE (CLIENT A)      |                     |       BOB (CLIENT B)       |
|                            |                     |                            |
| 1. ECDH P-256 Keypair Gen  |                     | 1. ECDH P-256 Keypair Gen  |
|    (In-Memory RAM Only)    |                     |    (In-Memory RAM Only)    |
|                            |                     |                            |
| 2. Export Alice Public Key |--- QR Code / Link ->| 2. Import Alice Public Key |
| 3. Import Bob Public Key   |<-- QR Code / Link --| 3. Export Bob Public Key   |
|                            |                     |                            |
| 4. Derive Shared Secret    |                     | 4. Derive Shared Secret    |
|    via HKDF-SHA256         |                     |    via HKDF-SHA256         |
| 5. Derive AES-256 Key      |                     | 5. Derive AES-256 Key      |
+-------------+--------------+                     +-------------+--------------+
              |                                                  |
              | Plaintext + Random 96-bit IV                     |
              | -> AES-256-GCM Encryption                        |
              v                                                  v
+-------------+--------------------------------------------------+--------------+
|                         BLIND WEBSOCKET RELAY SERVER                          |
|                                                                               |
|   Payload: { recipientSessionId: "bob_9x", iv: "...", ciphertext: "..." }     |
|                                                                               |
|   - Sees ONLY Base64 Ciphertext & Ephemeral Session ID                        |
|   - Zero Private Keys · Zero Plaintext · Zero Disk Persistence Logs           |
+-------------------------------------------------------------------------------+

Subsystem Layer Breakdown

Key Agreement Layer

ECDH P-256

Role: ECDH NIST P-256

Generates ephemeral elliptic curve key pairs in browser memory. Computes raw Diffie-Hellman shared secret with peer public key.

Key Derivation Layer

HKDF-SHA256

Role: HKDF with SHA-256

Expands raw ECDH shared secret through HMAC-based Extract-and-Expand Key Derivation Function (RFC 5869) to produce a 256-bit symmetric key.

Authenticated Encryption

AES-256-GCM

Role: AES-256-GCM Cipher Engine

Encrypts payloads with fresh 12-byte (96-bit) cryptographically random nonces. Produces 128-bit authentication tags ensuring ciphertext integrity.

Blind Relay Transport

Zero-Storage Relay

Role: Ephemeral WebSocket Forwarder

Routes encrypted JSON packets based on temporary 16-character session tokens. Maintains no user registry, message history, or database tables.

Step-by-Step Execution Sequence

  1. 1User opens SecureTalk: Browser crypto engine generates ECDH keypair and 16-char random session ID.
  2. 2Out-of-band exchange: User shares link or displays in-person QR code containing exported public key (JWK).
  3. 3Peer scans QR code: Both clients execute crypto.subtle.deriveKey using HKDF to derive identical AES-256-GCM symmetric keys.
  4. 4Message sent: Client generates 12-byte random IV, encrypts text/audio, and forwards { sessionId, iv, ciphertext, tag } to relay.
  5. 5Relay forwards packet: Recipient receives packet, verifies authentication tag, decrypts with AES-256-GCM, and renders in DOM.
  6. 6Tab closed: JavaScript garbage collection purges private keys and message history from RAM instantly.
System Section 05Engineering Primitives

Technical Stack & Architectural Rationale

Every tool and library was chosen under strict engineering constraints of latency, memory limits, and physical execution reality.

Web Crypto API (window.crypto.subtle)

Security/Crypto

Role: Native Browser Cryptographic Engine

Why Chosen: Hardware-accelerated, battle-tested browser primitives that avoid vulnerabilities of third-party JavaScript crypto implementations.

ECDH P-256 (secp256r1)

Security/Crypto

Role: Asymmetric Key Agreement

Why Chosen: Provides strong forward secrecy and fast client-side key generation supported natively across modern browsers.

AES-256-GCM

Security/Crypto

Role: Authenticated Symmetric Cipher

Why Chosen: Guarantees both confidentiality and integrity with 128-bit authentication tags, preventing ciphertext bit-flipping attacks.

HKDF (RFC 5869)

Security/Crypto

Role: Key Derivation Function

Why Chosen: Securely extracts and expands shared Diffie-Hellman secrets into full 256-bit symmetric encryption keys.

WebSocket Relay

Backend

Role: Blind Message Dispatcher

Why Chosen: Lightweight in-memory TCP socket routing that stores zero packets to disk and operates without relational database overhead.

TypeScript

Frontend

Role: Type-Safe Protocol Definitions

Why Chosen: Guarantees strict verification of cryptographic payload interfaces, initialization vectors, and serialized JWK formats.

System Section 07Engineering Timeline

Chronological Development Journey

From initial field investigations in Teghra to bench prototypes, hardware revisions, and production releases.

Stage 1: Cryptographic Pipeline Architecture🗓️ 2024

Benchmarking Web Crypto API Primitives in Browser Memory

Javed designed the initial cryptographic state machine using native window.crypto.subtle. He tested keypair generation speed across desktop Chrome, Firefox, and mobile Safari, confirming that ECDH P-256 key generation takes under 15ms.

Stage 2: Out-of-Band Key Exchange Engineering🗓️ Late 2024

Implementing URL Fragment & In-Person QR Code Handshake

To avoid centralized key directory attacks, public keys were serialized into URL hash fragments (#pub=...) and compact QR codes. Because browsers do not transmit URL hash fragments to HTTP web servers, public keys remain strictly client-side during link sharing.

QR code key exchange scanner interface screenshot
QR Code Out-of-Band Handshake: Direct visual exchange of ECDH public keys without intermediary servers.
Stage 3: Ephemeral Audio & Blind Relay Deployment🗓️ 2025

Encrypting Voice Notes Client-Side in ArrayBuffers

Extended the cryptographic pipeline to handle binary voice notes. Audio recorded via MediaRecorder is captured as an ArrayBuffer, encrypted with AES-256-GCM, and streamed through the blind relay for in-memory playback.

Ephemeral voice player interface screenshot showing encrypted audio waveform
Ephemeral Voice Player: Audio recorded, encrypted client-side, and decoded in RAM without disk buffering.
Stage 4: Live Web Deployment & Security Hardening🗓️ 2025–2026

Production Deployment at securetalk.shapemysite.in

Deployed the complete frontend and blind relay server. Conducted security audits on Content Security Policy (CSP), subresource integrity, and localStorage leakage.

Conversations list interface showing active encrypted sessions
Active Sessions Matrix: Ephemeral rooms and peer fingerprints with one-tap session wipe capabilities.
System Section 06Debugging & Post-Mortems

Engineering Challenges & Technical Solutions

Real failure modes encountered on live devices, breadboards, and regional networks, complete with root-cause analysis and code-level resolutions.

Challenge #1: Preventing Nonce / IV Reuse in High-Frequency Messaging

● Resolved

The Problem Context

In Galois/Counter Mode (AES-GCM), reusing the same Initialization Vector (IV) with the same encryption key completely breaks confidentiality, enabling attackers to recover the plaintext XOR differences.

Investigation & Root Cause Analysis

Relying on a simple sequential integer counter could fail if a browser tab is duplicated or reloaded with cached state.

The Actual Engineering Resolution

Configured a mandatory fresh 12-byte (96-bit) cryptographically random IV generated via crypto.getRandomValues(new Uint8Array(12)) for every single outbound packet. The IV is prepended to the ciphertext. Even if Alice sends the exact same message ("Hello") 10 times, all 10 ciphertexts and tags are completely distinct.

src/crypto/aes-gcm.ts
// Encrypting payload with fresh 12-byte IV per packet
export async function encryptPacket(
  key: CryptoKey,
  plaintext: string
): Promise<{ iv: string; ciphertext: string }> {
  const enc = new TextEncoder();
  const data = enc.encode(plaintext);
  const iv = crypto.getRandomValues(new Uint8Array(12)); // 96-bit unique IV

  const cipherBuffer = await crypto.subtle.encrypt(
    { name: 'AES-GCM', iv },
    key,
    data
  );

  return {
    iv: bytesToBase64(iv),
    ciphertext: bytesToBase64(new Uint8Array(cipherBuffer)),
  };
}
💡 Key Takeaway:Cryptographic security in modern web applications requires strict protocol invariants at the encoding boundary.

Challenge #2: Local Forensic Storage Bleed Through Browser Caching

● Resolved

The Problem Context

Browsers instinctively cache network assets, form fields, and IndexedDB state, which could leave forensically recoverable plaintext fragments on a device flash drive.

Investigation & Root Cause Analysis

Inspecting browser Application storage tools revealed that default state stores frequently persist session blobs to disk.

The Actual Engineering Resolution

Enforced zero persistent browser storage: No localStorage, no sessionStorage, no IndexedDB, and no service worker caching for chat payloads. All decrypted message strings reside strictly in JavaScript heap variables. Added an explicit "Purge Session" trigger that zeros all Uint8Array buffers and triggers garbage collection before page reload.

💡 Key Takeaway:Volatile-only memory architecture is the only dependable defense against physical device forensics.
System Section 08Production Surface

Features & User Experience Walkthrough

A deep architectural inspection of shipped interfaces, physical control panels, and protocol telemetry.

Feature 01

AES-256-GCM End-to-End Encrypted Chat

● Implemented

Clean, distraction-free messaging interface displaying authenticated lock indicators, delivery receipts, and live ciphertext encryption toggles.

SecureTalk E2EE chat screen showing encrypted messages and lock badge
E2EE Conversation: Authenticated chat interface with green padlock badge and in-memory message history.

⚡ Engineering Highlights:

  • ✓Client-side AES-256-GCM authenticated encryption.
  • ✓Unique 96-bit IV generated for every individual message.
  • ✓Zero plaintext ever transmitted over the network or logged on relays.
Feature 02

Out-of-Band QR Code Key Exchange

● Implemented

Verify public keys face-to-face. Scan the peer QR code to directly import their ECDH public key, bypassing centralized directory lookups.

QR code key exchange interface with camera scanner overlay
QR Code Handshake: Direct optical exchange of public keys eliminates man-in-the-middle attacks.

⚡ Engineering Highlights:

  • ✓High-density QR code generation encoding standard JWK format.
  • ✓In-browser camera scanner powered by HTML5 video capture.
  • ✓Instant derivation of symmetric shared key upon optical scan.
Feature 03

Encrypted Ephemeral Voice Notes

● Implemented

Record voice notes directly in the browser. Audio is converted to an ArrayBuffer, encrypted with AES-256-GCM, and playable only in volatile RAM.

Ephemeral voice player interface showing audio waveform and playback controls
Encrypted Voice Player: Binary audio recorded and decoded entirely in browser RAM without disk saving.

⚡ Engineering Highlights:

  • ✓Client-side audio compression and encryption.
  • ✓Waveform visualizer rendered via Canvas API.
  • ✓Zero audio file caching on phone or computer storage.
Feature 04

Zero-Identifier User Credentials & SHA-256 Fingerprint

● Implemented

Inspect current session credentials, view the raw SHA-256 fingerprint of the active public key, and execute a cryptographic session wipe.

User profile interface showing session ID and cryptographic fingerprint
Identity Badge: Inspect 16-character session token, SHA-256 key fingerprint, and security status.

⚡ Engineering Highlights:

  • ✓Randomized 16-character alphanumeric session token.
  • ✓Visual fingerprint matching to verify peer authenticity.
  • ✓One-click Emergency Wipe button destroying private keys from RAM.
Feature 05

Nearby P2P Mesh Discovery (Simulation / Prototype)

● Planned / Simulation

Experimental testing interface for localized peer discovery, prototyping WebRTC DataChannels for serverless ad-hoc communication.

Nearby mesh simulation modal showing simulated peer discovery alert
Nearby Discovery (Simulation): Experimental module exploring local air-gapped WebRTC DataChannels.

⚡ Engineering Highlights:

  • ✓Explicitly labeled as simulation and experimental prototype in the UI.
  • ✓Tests local network peer discovery without Internet routing.
  • ✓Evaluates fallback to local WebRTC DataChannels when WAN relays are blocked.
System Section 09Verification & Metrics

Results & Honest Current Status

SecureTalk is fully functional as an open-source web application deployed at securetalk.shapemysite.in. The core cryptographic pipeline, out-of-band key exchanges, and blind relay routing are operational.

✅ Verified Implemented Functionality

  • •Browser-native Web Crypto API key generation (ECDH P-256).
  • •AES-256-GCM symmetric authenticated encryption with fresh 12-byte IVs per packet.
  • •HKDF SHA-256 key derivation from raw Diffie-Hellman secrets.
  • •Out-of-band public key exchange via URL hash fragments and QR codes.
  • •Client-side encrypted ephemeral voice note recording and playback.
  • •Blind WebSocket relay forwarding packets without database persistence.
  • •One-click session wipe purging all cryptographic keys and message history from RAM.

⚠️ Known Limitations & Ground Reality

  • •Browser memory is vulnerable to physical memory dumps if an attacker possesses root/administrator access to the operating system while the tab is open.
  • •Nearby P2P mesh discovery is currently an experimental UI simulation and requires further WebRTC signaling infrastructure before full offline production readiness.
  • •Group messaging currently requires N-to-N pairwise key derivations; tree-based ratcheting protocols (such as MLS) are not yet implemented.

➔ Immediate Engineering Next Steps:

  • ➔Implement Double Ratchet algorithm for post-compromise security within long-running sessions.
  • ➔Explore WebAssembly-compiled Signal Protocol / MLS for efficient multi-party group encryption.
  • ➔Conduct formal third-party cryptographic code audit.
System Section 10Reflective Analysis

Lessons Learned & Engineering Reflections

First-principles insights gathered while building, testing, and debugging directly in Indian field conditions.

01

The Web Crypto API provides exceptional performance and cryptographic safety, but protocol designers must strictly guard against IV reuse and accidental disk caching.

02

True privacy requires eliminating the concept of permanent user accounts; identity should be as transient as a conversation.

03

Honest technical documentation must clearly distinguish demonstrated cryptographic properties from experimental simulation prototypes.

System Section 11Horizon Planning

Future Roadmap

Clear distinction between verified accomplishments and prospective architectural exploration.

🟢 Completed
  • ✓ECDH P-256 key exchange implementation in Web Crypto API.
  • ✓AES-256-GCM authenticated cipher pipeline with 96-bit unique nonces.
  • ✓Out-of-band QR code and URL hash key exchange.
  • ✓Stateless blind WebSocket relay server.
  • ✓Live deployment at securetalk.shapemysite.in.
🟡 In Progress
  • •Pairwise ephemeral voice note streaming optimizations.
  • •Mobile web touch gestures and responsive viewport hardening.
🔵 Planned
  • ◦Double Ratchet forward and backward secrecy implementation.
  • ◦Decentralized relay nodes using Nostr or libp2p pub/sub channels.
🟣 Exploratory
  • ?Air-gapped audio-frequency acoustic key exchange (data-over-sound).
  • ?Post-quantum Kyber / ML-KEM hybrid key encapsulation integration.