Skip to content

Operations

Keys live only in memory, the library writes them nowhere. They rotate after KeyTTL, one hour by default, even without traffic. The predecessor stays valid for one more period and is then dropped. Old recordings can no longer be opened after two periods at the latest, as far as the platform allows: Go does not overwrite freed memory. Until it is reused, a key can remain in memory, swap, a core dump, a hibernation image or a VM snapshot. Measured, keys survived garbage collection in the process.

After a restart all keys are new. The client keeps the server key for ten minutes at most. After that, and through withFreshKey, it fetches it again. A KeyTTL below ten minutes requires withFreshKey. The browser’s key always uses the one-hour default.

Close stops the rotation timer and drops the keys.

Every process has its own keys. Behind a load balancer the same browser must reach the same node (session affinity at the proxy). A shared key store is deliberately not offered, it would contradict the short-lived keys.

Both sides remember per key what they opened and refuse a second delivery. The list is limited to 262,144 entries per key, about 9 MiB. When it is full, the key rotates early.

Anyone can make valid messages with the public key, so a flood can use keys up early. That costs senders with withFreshKey one retry, without it they fail for up to ten minutes. Put a rate limit in front of routes that call Open.

The WebAssembly module carries the cryptography of the Go version that built it and lies ready-made in the repository. Updating the Go compiler of your application does not change it. Keep pq-seal current, a Go security release leads to a new release here.

The module can be rebuilt bit for bit:

Terminal window
make wasm-check

cmd/selftest checks a browser by hand. Its test routes have no login, so it listens on loopback only. For other devices in a trusted network, never on the internet:

Terminal window
go run gitlab.techeve.de/techeve/pq-seal/cmd/selftest@latest --addr :8443 --http :8080

The results of all browsers are at /api/reports.