Changelog - 2026-11-02
ECDH runs in a browser
New FeatureIn one line. Import ECDH from @venizia/ignis-helpers/core to run the ECDH key exchange and AES-GCM session encryption in a browser or a Worker, in the same wire format as the server.
What changed
ECDHandAbstractCryptoAlgorithmare on@venizia/ignis-helpers/core. The typesECDHAlgorithmType,IECDHEncryptedPayloadandIECDHExtraOptionscome with them. The/coreentry stays free ofnode:*.ECDHno longer usesBuffer. It turns base64 into bytes withbtoaandatob, with the same checks and the same[ECDH.fromBase64] Invalid base64 inputerror.- The wire format does not change. A server
ECDHand a browserECDHderive the same key and read each other's{ iv, ct }payloads, with or withoutadditionalData. Payloads written before this release decrypt as before. AbstractCryptoAlgorithmmoved to its own file. It still extendsBaseHelper, and it is still exported from the package root.AESandRSAstill extend it throughBaseCryptoAlgorithm.
Who is affected
- Browser and Worker apps that talk to a server
ECDHendpoint. You can drop your own WebCrypto copy and importECDHfrom@venizia/ignis-helpers/core. - Everyone else. No action.
ECDH.withAlgorithm(),new ECDH({ algorithm, hkdfInfo })and every method keep their signatures, and every current import path keeps working.
Details
typescript
import { ECDH } from '@venizia/ignis-helpers/core';
const ecdh = ECDH.withAlgorithm();
const { keyPair, publicKeyB64 } = await ecdh.generateKeyPair();
// publicKeyB64 goes to the server; the server's public key and the salt come back.
const peerPublicKey = await ecdh.importPublicKey({ rawKeyB64: serverPublicKeyB64 });
const { key } = await ecdh.deriveAESKey({
privateKey: keyPair.privateKey,
peerPublicKey,
salt: saltB64,
});
const payload = await ecdh.encrypt({ message: 'hello', secret: key });AES and RSA stay server-side: they are synchronous over node:crypto, and WebCrypto is asynchronous.