Skip to main content

Module wake

Module wake 

Source
Expand description

Wake payloads: fixed-size ciphertexts sealed to one device’s push key.

payload    = 0x01 ‖ E (32) ‖ ChaCha20-Poly1305(key, nonce 0, plaintext (47), aad) (63)   = 96 bytes
key        = HKDF-SHA256(ikm = X25519(e, D), salt = E ‖ D, info = "weirdnet-push/wake/v1")
aad        = "weirdnet-push/wake/v1" ‖ handle
plaintext  = reason (1) ‖ random (16) ‖ unix seconds (8, big-endian) ‖ zeros (22)

E is a fresh X25519 key per payload, so the key is never reused and a zero nonce is safe. The payload holds only a reason code, a random value and a time: no content, sender, peer id, address or site name. Everything a push provider, the push service or a relay sees is the handle (or device token), the time, and these 96 bytes.

Structs§

Payload96
A fixed-size wake payload.
PushKey
A device’s push key (X25519). Keep the secret on the device; give the public key to the home relay and trusted peers with the handle.
ReplayGuard
Refuses wakes seen before, older than window, or more than window ahead.
Wake
An opened wake.

Enums§

Reason
Why a device is woken.

Constants§

PAYLOAD_LEN
The payload size in bytes.

Functions§

seal
Seals a wake for the device whose push public key is device and whose handle is handle.
seal_at
seal with a given time (tests).