Release
v7.4.0 — post-quantum hardening
Agent messages are encrypted by default (AgentChannel, SwarmTransportClient). seal() encrypts to the recipient (X25519 + ML-KEM-768, AES-256-GCM) unless the caller passes encrypt: false, and a recipient without a key-exc
Read the release here or open the original release on GitHub.
Changed
- Agent messages are encrypted by default (
AgentChannel,SwarmTransportClient).seal()encrypts to the recipient (X25519 + ML-KEM-768, AES-256-GCM) unless the caller passesencrypt: false, and a recipient without a key-exchange key is refused instead of being sent plaintext.SwarmTransportClientwith achannelencrypts unlessencrypt: false. Received plaintext is still accepted, so 7.3 senders keep working during an upgrade, and is reported through the newonEventcallback;requireEncryptionorASI_STRICT_MODE=enforcerefuses it (enforce also ignoresencrypt: false). The message format is unchanged and 7.3 recipients open 7.4 messages. - Legacy Ed25519-only keys are warned about and audited, and refused under enforce. When
NETWORK_AI_PQ_LEGACY=allow(orsetPostQuantumPolicy) lets a legacy key through, the process emits oneNAI_PQ_LEGACYwarning and reports each use to ASI strict mode (would-denyin audit mode).ASI_STRICT_MODE=enforcerefuses legacy keys whatever the setting, andlegacyEd25519Allowed()returnsfalsethere.
Added
- Forward secrecy for agent messages —
AgentChannel.rotatePrekey()/currentPrekey()create short-lived key-exchange keys (default 1 h,prekeyTtlMs5 min – 24 h) signed by the agent's own key and publish them to its directory;AgentDirectory.publishPrekey()verifies them against the agent's card, andlookup()returns the current prekey (kemKeyId). Senders encrypt to it, the prekey id is bound into the message key, and each prekey's secret is erased shortly after it expires (by an unref'd timer, so idle agents erase on time too;close()erases everything at shutdown), so stealing an agent's keys later does not decrypt recorded messages. Messages to the long-term card key (older senders) still open unlessrequireForwardSecrecyis set.SwarmTransportexchanges prekeys automatically: clients fetch the server's (nai.prekey) and send their own, servers return theirs when a caller is out of date, and a client whose server restarted drops the lost prekey and recovers on its next call (calls are never retried automatically). EgressProxy({ requirePqTls: true })— every upstream connection must negotiate hybrid post-quantum key exchange (TLS 1.3 +X25519MLKEM768); a classical-only upstream is refused (502, audited) rather than downgraded. The proxy refuses to start on a Node.js build without ML-KEM (OpenSSL 3.5+, e.g. Node 22.20+ / 24) or with anhttp://route.pqTlsCaadds private CAs. Credential injection, scrubbing, spend limits, tripwires, redirects (not followed), timeouts, and the response size limit behave as before; gzip, deflate, and br responses are decoded before scrubbing. Without the option the proxy is unchanged.AgentChannelEvent(plaintext-sent,plaintext-received,prekey-rotated), theforward-secrecy-requiredrefusal code, theasioption onAgentChannel, and thecryptoASI event kind.
Upgrade notes
- Code that read
body.payloadfrom sealed messages, or relied on plaintext by default, must passencrypt: false. Cards issued without a key-exchange key (only possible from plain JavaScript) now makeseal()throw; reissue them withgenerateAgentKeys()keys or send withencrypt: false. - Encrypted messages are about a third larger than plaintext (base64) plus about 1.5 KB of key-exchange data, so payloads near the 1 MiB
maxMessageBytesdefault may need a higher limit. - Use one
AgentChannelper agent identity when using prekeys: prekey secrets live only in that channel's memory and are not persisted, so after a restart an agent publishes a new prekey and messages sealed to the old one fail (decrypt-failed) and must be resent.
Full Changelog: https://github.com/Jovancoding/Network-AI/compare/v7.3.1...v7.4.0