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 live conversation view: Client-side AES-256-GCM encryption with volatile memory storage.
Authenticated encryption with 12-byte unique IVs and 128-bit authentication tags per message.
Elliptic Curve Diffie-Hellman executed client-side via native browser Web Crypto API.
Blind relays forward ciphertexts without writing messages, keys, or contact graphs to disk.
Random 16-character alphanumeric session tokens generated in volatile browser RAM.
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.
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.
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.
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.
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.
+----------------------------+ +----------------------------+
| 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-256Role: 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-SHA256Role: 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-GCMRole: 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 RelayRole: 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
- 1User opens SecureTalk: Browser crypto engine generates ECDH keypair and 16-char random session ID.
- 2Out-of-band exchange: User shares link or displays in-person QR code containing exported public key (JWK).
- 3Peer scans QR code: Both clients execute crypto.subtle.deriveKey using HKDF to derive identical AES-256-GCM symmetric keys.
- 4Message sent: Client generates 12-byte random IV, encrypts text/audio, and forwards { sessionId, iv, ciphertext, tag } to relay.
- 5Relay forwards packet: Recipient receives packet, verifies authentication tag, decrypts with AES-256-GCM, and renders in DOM.
- 6Tab closed: JavaScript garbage collection purges private keys and message history from RAM instantly.
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/CryptoRole: 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/CryptoRole: Asymmetric Key Agreement
Why Chosen: Provides strong forward secrecy and fast client-side key generation supported natively across modern browsers.
AES-256-GCM
Security/CryptoRole: Authenticated Symmetric Cipher
Why Chosen: Guarantees both confidentiality and integrity with 128-bit authentication tags, preventing ciphertext bit-flipping attacks.
HKDF (RFC 5869)
Security/CryptoRole: Key Derivation Function
Why Chosen: Securely extracts and expands shared Diffie-Hellman secrets into full 256-bit symmetric encryption keys.
WebSocket Relay
BackendRole: Blind Message Dispatcher
Why Chosen: Lightweight in-memory TCP socket routing that stores zero packets to disk and operates without relational database overhead.
TypeScript
FrontendRole: Type-Safe Protocol Definitions
Why Chosen: Guarantees strict verification of cryptographic payload interfaces, initialization vectors, and serialized JWK formats.
Chronological Development Journey
From initial field investigations in Teghra to bench prototypes, hardware revisions, and production releases.
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.
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.

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.

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.

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
● ResolvedThe 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.
// 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)),
};
}Challenge #2: Local Forensic Storage Bleed Through Browser Caching
● ResolvedThe 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.
Features & User Experience Walkthrough
A deep architectural inspection of shipped interfaces, physical control panels, and protocol telemetry.
AES-256-GCM End-to-End Encrypted Chat
Clean, distraction-free messaging interface displaying authenticated lock indicators, delivery receipts, and live ciphertext encryption toggles.

⚡ 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.
Out-of-Band QR Code Key Exchange
Verify public keys face-to-face. Scan the peer QR code to directly import their ECDH public key, bypassing centralized directory lookups.

⚡ 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.
Encrypted Ephemeral Voice Notes
Record voice notes directly in the browser. Audio is converted to an ArrayBuffer, encrypted with AES-256-GCM, and playable only in volatile RAM.

⚡ Engineering Highlights:
- ✓Client-side audio compression and encryption.
- ✓Waveform visualizer rendered via Canvas API.
- ✓Zero audio file caching on phone or computer storage.
Zero-Identifier User Credentials & SHA-256 Fingerprint
Inspect current session credentials, view the raw SHA-256 fingerprint of the active public key, and execute a cryptographic session wipe.

⚡ 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.
Nearby P2P Mesh Discovery (Simulation / Prototype)
Experimental testing interface for localized peer discovery, prototyping WebRTC DataChannels for serverless ad-hoc communication.

⚡ 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.
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.
Lessons Learned & Engineering Reflections
First-principles insights gathered while building, testing, and debugging directly in Indian field conditions.
The Web Crypto API provides exceptional performance and cryptographic safety, but protocol designers must strictly guard against IV reuse and accidental disk caching.
True privacy requires eliminating the concept of permanent user accounts; identity should be as transient as a conversation.
Honest technical documentation must clearly distinguish demonstrated cryptographic properties from experimental simulation prototypes.
Future Roadmap
Clear distinction between verified accomplishments and prospective architectural exploration.
- ✓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.
- •Pairwise ephemeral voice note streaming optimizations.
- •Mobile web touch gestures and responsive viewport hardening.
- ◦Double Ratchet forward and backward secrecy implementation.
- ◦Decentralized relay nodes using Nostr or libp2p pub/sub channels.
- ?Air-gapped audio-frequency acoustic key exchange (data-over-sound).
- ?Post-quantum Kyber / ML-KEM hybrid key encapsulation integration.