Talk and calls
Talk is Hearth's chat. Messages are encrypted on people's devices, and the server stores only sealed bytes. Voice and video calls in Talk run through a LiveKit server of your own, with media encrypted end to end under a key kept in the chat.
Talk's encryption has not been reviewed by an outside party yet.
Turning Talk on
Talk is off until you set:
TALK: "true"
TALK_SEALED_COPY_DEFAULT: "true"
TALK_SEALED_COPY_DEFAULT must be given with TALK=true; Hearth does not
start without it. It decides whether new Talk accounts keep Hearth's
sealed copy of their key:
true: any sign-in opens a person's earlier messages, on any new device and after an administrator resets their password, with no recovery phrase. Each use of the copy is recorded in the audit log.false: messages can be opened only on devices that already hold the key or get it from another of the person's devices.
true suits most organisations: people never lose their messages. Pick
false only if you want the server to be unable to open anyone's
messages under any circumstances, and accept that people who lose all
their devices lose their history.
In Administration, Talk you can turn on GIFs and stickers from GIPHY and
upload sticker packs (Sticker packs, New pack, Add). The GIPHY switch
stays off until GIPHY_API_KEY is set to a key from GIPHY's developer
site. The browser then searches GIPHY directly, as GIPHY requires, so
the key is given to signed-in browsers and the page allows GIPHY's
addresses.
Calls
Calls need a LiveKit server. Without the four CALLS_LIVEKIT_*
settings Talk works, but has no call button.
The LiveKit container
LiveKit handles media directly over UDP, so run it on the host's network:
hearth-livekit:
image: livekit/livekit-server:v1.13.7
restart: unless-stopped
network_mode: host
command: ["--config", "/etc/livekit.yaml"]
environment:
LIVEKIT_KEYS: "hearth-calls: ${CALLS_LIVEKIT_SECRET}"
volumes:
- ./livekit/livekit.yaml:/etc/livekit.yaml:ro
- ./data/livekit-turn:/etc/livekit-turn:ro
mem_limit: 1g
Use the version deploy/livekit/Dockerfile names for your Hearth
version. A livekit.yaml to start from:
port: 7895
bind_addresses:
- 127.0.0.1
rtc:
tcp_port: 7896
port_range_start: 50700
port_range_end: 50800
use_external_ip: false
node_ip: 203.0.113.10
turn:
enabled: true
domain: calls-turn.example.org
tls_port: 5360
cert_file: /etc/livekit-turn/crt.pem
key_file: /etc/livekit-turn/key.pem
relay_range_start: 50801
relay_range_end: 51000
webhook:
api_key: hearth-calls
urls:
- http://127.0.0.1:8080/api/v1/talk/calls/hook
room:
empty_timeout: 30
departure_timeout: 20
portis signalling, on 127.0.0.1 behind your proxy.node_ipis the server's public address.- The webhook goes to Hearth's own port on the host. Hearth checks each webhook's signature with the secret.
Hearth's settings
CALLS_LIVEKIT_URL: wss://calls.example.org
CALLS_LIVEKIT_API_URL: https://calls.example.org
CALLS_LIVEKIT_KEY: hearth-calls
CALLS_LIVEKIT_SECRET: ${CALLS_LIVEKIT_SECRET}
Set all four or none.
| Setting | Meaning |
|---|---|
CALLS_LIVEKIT_URL |
where browsers reach LiveKit, a wss:// address |
CALLS_LIVEKIT_API_URL |
where Hearth reaches LiveKit's API, to take someone out of a call |
CALLS_LIVEKIT_KEY |
the name of the API key LiveKit runs with (the name in LIVEKIT_KEYS) |
CALLS_LIVEKIT_SECRET |
that key's secret, at least 32 characters (openssl rand -hex 32) |
Hearth adds the LiveKit address to the page's allowed connections and allows the camera, microphone and screen sharing on its pages only when calls are set up.
The proxy
Give LiveKit its signalling address through the same proxy as Hearth, with WebSockets passed through:
calls.example.org {
reverse_proxy 127.0.0.1:7895
}
TURN for strict networks
Some office and hotel networks allow nothing but HTTPS on port 443.
LiveKit's TURN server can carry the media over TLS on 443 for them. It
needs its own name (calls-turn.example.org) and a certificate for it in
data/livekit-turn (crt.pem and key.pem). Either give LiveKit port
443 on a second address, or let your proxy pass TLS for that name through
untouched to LiveKit's tls_port. With Caddy this needs the layer 4
module; with nginx, the stream module with ssl_preread. If the proxy
sends the PROXY protocol header to LiveKit, add proxy_protocol: true
under turn, so LiveKit sees the real client addresses.
The firewall
Open these to the internet:
| Port | Protocol | For |
|---|---|---|
| 443 | TCP | Hearth, signalling, and TURN over TLS |
| 7896 | TCP | media over TCP when UDP is blocked |
| 50700-50800 | UDP | media |
| 50801-51000 | UDP | TURN relays |
Use the ranges from your livekit.yaml if you changed them.
Checking calls
Start a call between two accounts on two networks, for example a computer
on your office network and a phone on mobile data. If the call connects
on the same network but not across networks, the UDP ports or node_ip
are wrong. If it fails only on strict networks, TURN is not reachable.
Restarting LiveKit ends the calls under way. It keeps no state.