Skip to content

Browser Support

What each feature needs from a browser, how to ask a browser what it has, and the answer for one without the newer curves. Support is by feature, not by browser version.

Support is by feature, not by browser version. The plain exchange needs only fetch. The secure levels need WebCrypto and two newer curves, which some browsers still in use do not have. Ask the browser what it has, and offer what it can run.

FeatureNeedsWithout it
The plain exchange: httpCarrier(url, { secure: false }), level nonefetch. No WebCrypto, so it also works on a page opened over plain HTTP, such as http://192.168.1.20 on a LAN
A socket at level noneWebSocket
authenticatedWebCrypto, which a browser gives only to a secure context (HTTPS, or localhost), and Ed25519crypto_unavailable, with reason saying which
encryptedWhat authenticated needs, and X25519crypto_unavailable, with algorithm: "X25519"
A realmA socket at authenticated or above. A realm never runs at noneWhat its level gives
The devtools windowNothing from a user’s browser. Its handles are inert in a production build

The packages are published as modern JavaScript. If your app targets older browsers, your build lowers their syntax as it lowers your own code.

probeWebCryptoSupport() answers for the runtime it is called in, without connecting:

import { probeWebCryptoSupport } from "@nice-code/wire";
const { ed25519, x25519 } = await probeWebCryptoSupport();
// ed25519 alone: `authenticated` works and `encrypted` does not.
// Neither: only the plain exchange and a plain socket.

A secure carrier finds out for itself as well. On a browser without a curve it rejects with crypto_unavailable, reason: "algorithm_unsupported", and does not redial. A plain carrier listed after it is used instead:

connectChannel(runtime, appChannel, {
peer: serverCoord,
storage,
securityLevel: ESecurityLevel.authenticated,
carriers: [
httpCarrier(url), // secure, tried first
httpCarrier(url, { secure: false }), // used where the browser lacks the curve
],
});

An app that must never drop to plain lists no plain carrier. The full error is on Identity & Trust.

The supported answer is the plain exchange, inside TLS, behind your own sign-in. TLS protects the bytes, your session says who the user is, and the library checks the door: the origin, the content type and the size. A Plain Endpoint Behind Your Own Session is the full setup.

No JavaScript fallback for Ed25519 or X25519 is built, on purpose:

  • A second implementation of the same crypto, to test against the first on every release.
  • Signing code that is not constant-time. JavaScript gives no guarantee about how long an operation takes, and a signature that leaks timing can leak its key.
  • Weight in every client, including the ones that never need it.

A fallback would be reconsidered if an app needs device identity on browsers without the curves and cannot use its own sign-in.