Protocol and cryptography spec

How WhispShare devices agree on keys and move a file between them, written for security reviewers.

Every planLast updated December 4, 2026

Scope and status

This page describes how WhispShare devices agree on keys and move a file, as the code does it today (suite wd1). It is written for security reviewers. The implementation has been reviewed in-house; an external audit is planned. The library behind the classical half of the key exchange (X25519) has been independently audited; the library behind the post-quantum half (ML-KEM-768) has no independent audit yet, only its authors' own review and the standard test vectors. Because the two halves are combined, the exchange is as strong as the stronger half.

The suite wd1

Every object that leaves a device carries its suite id: the signalling envelope, the pairing fragment, the sealed box, the hello, the stored key record. Suite 1 is wd1. A device refuses a suite it does not list, and a peer that shares no suite with this device is closed with unsupported_suite. A second suite, wd2, is reserved and not shipped.

  1. Key agreement: hybrid X25519 and ML-KEM-768, one fresh exchange for every peer connection.
  2. Key derivation: HKDF with SHA-256, a different info string for every purpose.
  3. Encryption: AES-256-GCM for every file frame, every control message and every sealed box.
  4. Hashes and message authentication: SHA-256 and HMAC-SHA-256.
  5. Signatures: ECDSA P-256 with SHA-256, for device lists, business keys and similar identities. These are not post-quantum yet.

The hybrid key exchange

A device makes one X25519 key pair and one ML-KEM-768 key pair on first run. Its public bundle is the suite byte, the 32-byte X25519 public key and the 1,184-byte ML-KEM encapsulation key. To seal to a bundle, the sender makes a fresh X25519 key pair, computes the X25519 shared secret with the receiver's public key, encapsulates a second secret with ML-KEM-768, and hashes everything together. The combiner is SHA-256 over the text whispshare/v1/kem, the suite byte, both shared secrets, the sender's ephemeral X25519 public key, the ML-KEM ciphertext, the receiver's X25519 public key and the SHA-256 of the receiver's ML-KEM key. Hashing both secrets together with both ciphertexts and both public keys means neither half can be dropped or swapped. The ciphertext sent is the ephemeral public key followed by the ML-KEM ciphertext, 1,120 bytes in all. An X25519 result of all zeros, which a low-order public key would give, is refused. The ephemeral secrets are wiped after use, as far as a JavaScript runtime allows.

The pairing secret

Two devices that pair share a 256-bit secret from the operating system's random generator. It travels only in the part of the link after the #, or inside the QR code, in the form v=1, s=suite, h=pair id, k=secret and a few more fields. Browsers do not send the fragment to a server, and our code never sends it to a server or logs it; on the device it is kept encrypted. The server only ever sees the pair id as a hash (the first 22 characters of the base64url SHA-256). A link without a suite is refused. Public business links carry no secret at all: a visitor's first message is sealed to the business's inbox key instead, and the pair secret travels inside that sealed message.

Key schedule and domain separation

For each peer connection the host sends a hello with the suites it accepts and an ephemeral hybrid public key. The guest answers with the chosen suite, the ciphertext and a confirmation. Both sides then derive a root key with HKDF-Extract, using the SHA-256 of both hellos as salt and the pairing secret followed by the hybrid shared secret as input. Every key below is an HKDF-Expand of that root with its own info string, so a key made for one purpose can never be used for another. The first two keys protect the control channel, one per direction.

  1. Control channel, host to guest and guest to host: info whispshare/v1/ctl, environment, suite and direction.
  2. Confirmation: info whispshare/v1/conf; the guest sends HMAC-SHA-256 of the transcript, and the host checks it before anything else, so a modified hello is detected before any content moves.
  3. Each transfer and direction: info whispshare/v1/xfer, environment, suite, transfer id and direction, with a fresh salt from the offer.
  4. Each call: info whispshare/v1/call, with its own call id.
  5. Sealed boxes to a stored key: info whispshare/v1/sealed, with the environment, suite, purpose, context, a hash of the ciphertext and the recipient, and the fixed salt whispshare/v1/sealed-salt.
  6. Keys are destroyed when the transfer, the call or the connection ends. Because the hybrid secret is new for every connection, a recording of a session cannot be opened later even by someone who learns the pairing secret.

The file frame

Files travel over the WebRTC data channel, encrypted again at the application layer under keys the DTLS handshake never sees. A frame is a 36-byte header followed by the ciphertext and a 16-byte AES-GCM tag. The header is authenticated as associated data.

  1. Header, big-endian: version (2), kind (data or segment end), flags (sealed, always set), transfer number, file index, attempt, byte offset in the file, plaintext length, 12-byte nonce.
  2. The nonce is the attempt counter followed by a frame counter that restarts at zero on every re-offer. A resumed transfer therefore never repeats a nonce under the same key, and the receiver refuses a nonce that does not strictly increase.
  3. Files are cut into 1 MiB segments. Each segment is hashed (SHA-256, over the plaintext) and acknowledged; the receiver verifies the hash before writing and acknowledges only after the write. A dropped transfer resumes from the first missing segment.
  4. A frame that does not decode, or that fails authentication, is refused.

The one sealed text

One exception to live-only transfer exists. When the receiver is offline, one short text per sender and receiver pair, up to 280 characters, may wait on our servers for up to 7 days and is deleted when the receiver picks it up. It is sealed on the sender's device to the receiver's key with the hybrid exchange above before it leaves, in a single blob of at most 3 KiB, bound to its use by a context string. Our servers hold ciphertext only and cannot read it. Nothing else, no file, photo, voice message or call, is ever stored.

What the server sees

The server runs the meeting place. It sees account e-mail and sign-in events, public keys and profiles, link and policy settings, hashed pair ids, short-lived session metadata, usage counters for relayed minutes and bytes, live connection records for two hours (with a keyed hash of the IP address, not the address), and the sealed short text above. When two devices cannot connect directly, a relay forwards encrypted bytes and keeps nothing. It never sees pairing secrets, file contents, message bodies or private keys. The full table, with retention times, is on the security page.

How to check it yourself in the browser

You do not have to take this page on trust. Open your browser's developer tools on whispshare.com, either with F12 or from the browser menu, and look at what the page sends.

  1. Open the Network tab, start a pairing and read the requests: the part of the address after the # is never in a request line, and neither the secret nor any file appears in a message to our servers.
  2. Filter the Network tab by WS to see the signalling connection: the messages are authenticated and encrypted envelopes, not readable content.
  3. Send a file and watch the requests to our API: none of them carries file bytes. The bytes go over the peer connection between the two devices (or through a relay as encrypted frames), not through an API request.
  4. Read the Application tab: what the app keeps on the device is encrypted under a key made on the device. The security model page lists the few exceptions, such as files you saved to a folder yourself.
  5. The packaged desktop receiver turns developer tools off, so use the web app in a browser for this check.

Honest limits

This protects content against a later break of X25519 alone, and links against guessing. It cannot protect a lost or compromised device, a screenshot or a saved copy on the other side, or the metadata our servers must see. Signatures are classical for now. The ML-KEM-768 implementation is not independently audited. We review the cryptography every year, the first time in October 2027. Reviewed in-house; an external audit is planned.

Ready when you are

Open the app, scan, done.

Open the app