Skip to content

Calls & End-to-End Encryption ​

ferrixd ships two opt-in vendor extensions for modern clients:

  • ferrix.chat/calls — signalling for 1:1 voice/video calls. The media itself flows peer-to-peer over WebRTC; the server only relays and polices the signalling and hands out STUN/TURN servers.
  • ferrix.chat/e2ee (experimental) — a key directory for Signal/OMEMO-style end-to-end encryption. The server brokers public prekey bundles and stores ciphertext it cannot read.

Both are off by default and do nothing for clients that do not request them.

Calls ​

toml
[calls]
enabled = true
stun_urls = ["stun:turn.example.org:3478"]
turn_urls = ["turn:turn.example.org:3478", "turns:turn.example.org:5349"]
turn_secret_env = "FERRIXD_TURN_SECRET"   # coturn static-auth-secret
turn_ttl_secs = 3600
require_account = true
offers_per_minute = 5
max_duration_secs = 14400

Signalling ​

Calls are TAGMSGs to a nick (never a channel) carrying client tags:

TagMeaning
+ferrix.chat/calloffer, ringing, answer, candidate, reject or hangup
+ferrix.chat/call-ida client-chosen id, 1–64 of [A-Za-z0-9_-], on every frame
any other client tagsSDP, ICE candidates, media kind … — relayed untouched
@+ferrix.chat/call=offer;+ferrix.chat/call-id=k3j9;+ferrix.chat/sdp=… TAGMSG bob
@+ferrix.chat/call=answer;+ferrix.chat/call-id=k3j9;+ferrix.chat/sdp=… TAGMSG alice
@+ferrix.chat/call=hangup;+ferrix.chat/call-id=k3j9 TAGMSG bob

The server refuses, with FAIL TAGMSG <code>:

CodeWhen
INVALID_CALLunknown frame kind or missing/malformed call-id
CALL_NOT_ALLOWEDthe target is a channel, or the call id belongs to a call between other users
ACCOUNT_REQUIREDrequire_account is on and the sender is not logged in
RATE_LIMITEDmore than offers_per_minute offers

A call still tracked after max_duration_secs (counted from the offer) is ended by the server with @+ferrix.chat/call=hangup;+ferrix.chat/call-id=…;+ferrix.chat/call-reason=timeout :<server> TAGMSG <nick> to both parties. Frames to users on linked servers are routed like any TAGMSG.

ICE servers — CALL ICE ​

CALL ICE
:irc.example.org CALL ICE :{"iceServers":[{"urls":["stun:…"]},{"urls":["turn:…"],"username":"1767225600:alice","credential":"…"}],"ttl":3600}

The JSON is shaped like WebRTC's RTCConfiguration. TURN credentials follow the coturn REST scheme: username = <expiry>:<account>, credential = base64(HMAC-SHA1(secret, username)). Configure coturn with use-auth-secret and the same static-auth-secret. They are only minted for logged-in users, and only when the secret environment variable is set.

End-to-end encryption key directory ​

toml
[e2ee]
enabled = true
max_devices = 10          # devices per account
max_prekeys = 100         # one-time prekeys per device
fetches_per_minute = 30   # bundle fetches per user

Each logged-in account publishes, per device, its public identity key, a signed prekey with its signature, and one-time prekeys. Keys are opaque base64/base64url strings (≤ 2048 characters) — the server never interprets them.

CommandReply
KEYS PUBLISH <device> :<json>KEYS PUBLISHED <device> <prekeys> — json: {"identity_key","signed_prekey","signature","prekeys":[…]}; replaces the device
KEYS PREKEYS <device> <key> [<key>…]KEYS PUBLISHED <device> <prekeys> — top up one-time prekeys
KEYS DEVICES <account>KEYS DEVICE <account> <device> <identity_key> <prekeys-left> each, then KEYS ENDDEVICES <account>
KEYS FETCH <account> <device>KEYS BUNDLE <account> <device> :<json> with at most one one-time prekey, which is consumed
KEYS REMOVE <device>KEYS REMOVED <device>

Errors are FAIL KEYS <code>: ACCOUNT_REQUIRED, INVALID_BUNDLE, TOO_MANY_DEVICES, TOO_MANY_PREKEYS, NO_SUCH_DEVICE, RATE_LIMITED, INVALID_PARAMS. Publishing, removing and listing need no channel membership; anyone may fetch a bundle (rate-limited), as in Signal.

Encrypted messages are ordinary PRIVMSGs whose text starts with ferrix-e2ee:. History keeps them for offline devices (still encrypted); the search index never returns them.

The directory is persisted with [persistence] and synced network-wide over S2S (SKEY, last writer wins). A removed device leaves a tombstone, so a stale copy from a server that missed the removal (e.g. across a netsplit) cannot bring it back. Dropping an account removes its devices.

Experimental

The ferrix.chat/e2ee wire format may change to follow the IRCv3 end-to-end encryption work once that stabilises. The server is a blind broker: key verification (safety numbers) and the ratchet are entirely the clients' job.

Dual-licensed under MIT or Apache-2.0.