What it brings
Wake a suspended phone when a peer or its home relay has sealed messages for it, without Apple, Google or the push service learning anything about the message, the sender or the network. It is the payload format, the client, a self-hostable server, and the relay wake path for phones without Google services.
What it is
A suspended phone can’t keep a connection, so a peer or its home relay asks a push service to wake it. This crate is that service, its client and the payload format, built so that Apple, Google and the push service see only ciphertext.
How it works
- Wake payloads (
wake): exactly 96 bytes, sealed to the device'sPushKey(X25519, HKDF-SHA256, ChaCha20-Poly1305, a fresh key per payload) and bound to its handle. Inside are only a reason code (MessageWaiting,ConnectionRequested), a random value and a time.ReplayGuardrefuses repeats and stale wakes. - Wake handles (
handle): 32 random bytes. The device shares aWakeCard(handle and push public key) only with its home relay and trusted peers, sealed. ItsControlSecretrotates the handle (the old one stops at once) or revokes it. - Client (
PushClient): register, rotate, unregister, wake, and follow relay announcements. - Server (the
weirdnet-pushbinary): APNs with token auth (an alert withmutable-contentand a fixed placeholder text the device replaces after decrypting), FCM HTTP v1 high-priority data messages, and the relay path. A token the provider rejects revokes its handle. It stores only SHA-256 hashes of handles and control secrets and logs no handles or tokens. Put TLS in front. - Relay wake path (
relaywake,/weirdnet/wake/1): a device that opted in keeps a stream to its home relay and subscribes its handles; trusted peers deliver payloads to the relay, which also passes on the push service's announcements. weirdnet-relay serves it.
| Party | Sees |
|---|---|
| Apple / Google | the device token, the time and 96 bytes of ciphertext |
| The push service | the handle's hash and the device token (stored); the handle and time (per wake) |
| Relays | the handle, the time and the ciphertext (the home relay also sees which peer subscribed) |
| Senders | the handle and push public key they were given |
Nobody but the device sees the reason. Abuse control in this phase is handle revocation and rotation; there are no rate limits yet, and UnifiedPush is a later phase.
Key types and modules
wake:PushKey,Payload96,Reason,seal,ReplayGuard.handle:WakeHandle,WakeCard,ControlSecret(rotate and revoke).PushClient: register, rotate, unregister, wake, follow announcements.relaywake: the/weirdnet/wake/1relay wake path.serverand theweirdnet-pushbinary: APNs, FCM HTTP v1 and relay delivery.
Feature flags
client(default): the HTTP client for devices and senders.relay-wake(default): the relay wake path’s wire protocol.server: the push server library and theweirdnet-pushbinary.
Usage
Install:
cargo install weirdnet-push --features server
weirdnet-push relay-token # for each relay that follows
weirdnet-push check -c /etc/weirdnet-push/config.toml
weirdnet-push serve -c /etc/weirdnet-push/config.tomlIn Cargo.toml:
[dependencies]
weirdnet-push = "0.1.1"Then (built and run against the published crate when this page was made):
// A sender seals a 96-byte wake for a device; only the device can open it, once.
use std::time::Duration;
use weirdnet_push::{PushKey, Reason, ReplayGuard, WakeHandle, wake};
fn main() -> weirdnet_push::Result<()> {
let key = PushKey::generate(); // stays on the device
let handle = WakeHandle::generate(); // shared, sealed, with the home relay and trusted peers
let payload = wake::seal(&key.public(), &handle, Reason::MessageWaiting)?; // a sender
let w = key.open(&handle, &payload)?; // the device
let mut guard = ReplayGuard::new(Duration::from_secs(300), 1024);
guard.check_now(&w)?;
assert!(guard.check_now(&w).is_err()); // the same wake again is refused
Ok(())
}
Where it fits
- Builds on weirdnet-keys.
- Used by weirdnet-relay.
- License: BSD-3-Clause.