Establishes a session with a peer.
This device's key-agreement secret.
The peer's 32-byte public key, already authenticated by pinning or by a signature.
A fresh per-session salt both sides share, exchanged in the clear. Reusing one with the same pair of keys reuses the session key, so it must change each session.
Whether this device opens the session or answers.
Opens a message from the peer.
The ciphertext with the counter and tag that arrived with it.
Optionalaad: Buffer<ArrayBufferLike>
The same associated data the sender authenticated.
The plaintext.
Seals a message for the peer.
The message to protect.
Optionalaad: Buffer<ArrayBufferLike>
Data authenticated but not encrypted, so it stays readable on the wire yet cannot be altered: a device identifier or a routing header belongs here.
The ciphertext, with the counter and tag to send beside it.
A confidential, tamper-evident, replay-protected channel with one peer.