Push Notifications & PushRelay
Mobile operating systems require Apple APNs (.p8 signing keys bound to an Apple Developer Team ID) or Firebase Cloud Messaging (FCM) to wake suspended apps, ring incoming CallKit calls, and trigger Apple File Provider refreshes. Self-hosted FynnCloud servers cannot bundle official Apple/Google private keys directly—so FynnCloud solves this with a stateless, zero-knowledge PushRelay combined with end-to-end HPKE encryption.
Zero-Knowledge Privacy Architecture
Section titled “Zero-Knowledge Privacy Architecture”Every user alert, background dismiss, and VoIP call notification is encrypted on your self-hosted FynnCloud Server using HPKE (DHKEM(X25519, HKDF-SHA256) + HKDF-SHA256 + AES-256-GCM, info "fynncloud-push-v1") directly to each mobile device’s 32-byte X25519 public key before leaving your server:
- What PushRelay, Apple APNs, and Google FCM see: Only routing metadata (device token, app bundle/topic, urgency, TTL, hashed
collapseId,keyId, and opaque base64ciphertext). - What stays strictly invisible to relays and push providers: Sender names, message previews, room titles, deep-link routes, sound preferences, and metadata.
- On-device decryption: The native app decrypts the ciphertext locally (for example inside
TalkNotificationServiceExtensionon iOS/macOS) using the private key stored in its device Keychain. - File Provider wakeups (
apns-fileprovider): Carry no user content—onlycontainerIdentifier(NSFileProviderWorkingSetContainerItemIdentifier) and the account’s File Providerdomainconsumed directly by Apple’sfileproviderddaemon. - Zero disk persistence: The official
FynnCloudProject/PushRelayservice stores nothing on disk, emits no per-request route access logs, and hashes rate-limit IP/token keys in memory with SHA-256.
Default Behavior vs Server Overrides
Section titled “Default Behavior vs Server Overrides”Out of the box, official FynnCloud Apple clients (FynnCloud-Apple and FynnCloudTalk-Apple) use FynnCloud’s hosted stateless relay (https://push.fynncloud.ch/v1/push) with zero administrator setup required—your server only needs outbound HTTPS (443/tcp) access.
You can customize, restrict, or redirect push delivery using these fynncloud-server environment variables:
| Environment Variable | Default | Purpose |
|---|---|---|
PUSH_CORE_GATEWAYS |
https://push.fynncloud.ch/v1/push |
Comma-separated allowlisted relay URLs for official core clients (appID = "core"). |
PUSH_GATEWAY_OVERRIDES |
(empty) | Comma-separated appId=https://relay.example.com/v1/push pairs that override a specific app’s manifest push gateway (e.g. core=https://push.corp.example/v1/push,talk=https://push.corp.example/v1/push). |
PUSH_GATEWAY_SECRETS |
(empty) | Comma-separated https://relay.example.com/v1/push=<bearer-secret> pairs sent as Authorization: Bearer <secret> when authenticating to a private PushRelay. |
PUSH_ALLOW_UNIFIEDPUSH |
false |
Set true to allow Android/open-source clients to register arbitrary public https:// UnifiedPush distributor endpoints (dispatched directly from FynnCloud Server without touching PushRelay; SSRF-protected to public IPs over HTTPS only). |
PUSH_CORE_FILEPROVIDER_ENABLED |
true |
Enable debounced (1.5s) apns-fileprovider wakeup signals for macOS/iOS Finder/Files instant sync. Set false to disable. |
PUSH_CORE_VOIP_ENABLED |
false |
Allow apns-voip registrations under the core app ID. (Talk uses its own talk app ID, which unlocks VoIP via notifications:send + rtc:rooms.) |
Self-Hosting FynnCloud PushRelay
Section titled “Self-Hosting FynnCloud PushRelay”If you build and sign your own iOS/macOS or Android forks of FynnCloud / Talk with your own Apple Developer Team ID or Firebase project, run FynnCloudProject/PushRelay (fynncloud-push).
Container Deployment
Section titled “Container Deployment”services: push-relay: image: ghcr.io/fynncloudproject/pushrelay:latest restart: unless-stopped read_only: true security_opt: - no-new-privileges:true cap_drop: - ALL ports: - "127.0.0.1:8080:8080" env_file: - .env volumes: - ./AuthKey.p8:/run/secrets/apns_auth_key.p8:roPushRelay Environment Variables
Section titled “PushRelay Environment Variables”| Variable | Required | Default | Description |
|---|---|---|---|
APNS_TEAM_ID |
For APNs | — | 10-character Apple Developer Team ID |
APNS_KEY_ID |
For APNs | — | 10-character APNs .p8 Key ID |
APNS_PRIVATE_KEY_PATH |
1 of 3 for APNs | — | File path to .p8 key (alternatives: APNS_PRIVATE_KEY or APNS_PRIVATE_KEY_BASE64) |
APNS_ALLOWED_TOPICS |
≥ 1 APNs topic | — | Comma-separated bundle IDs for alert & background pushes |
APNS_ALLOWED_VOIP_TOPICS |
≥ 1 APNs topic | — | Comma-separated *.voip topics (e.g. ch.fynncloud.talk.voip) |
APNS_ALLOWED_FILEPROVIDER_TOPICS |
≥ 1 APNs topic | — | Comma-separated *.pushkit.fileprovider topics (e.g. ch.fynncloud.app.pushkit.fileprovider) |
APNS_ALLOW_SANDBOX |
No | true |
Allow environment: "sandbox" dispatches for Xcode debug builds |
FCM_SERVICE_ACCOUNT_PATH |
1 of 3 for FCM | — | Path to Firebase Service Account JSON (alternatives: FCM_SERVICE_ACCOUNT_JSON or FCM_SERVICE_ACCOUNT_BASE64) |
FCM_ALLOWED_TARGETS |
For FCM | — | Comma-separated Android package IDs (e.g. ch.fynncloud.talk) |
RELAY_SHARED_SECRET |
No | — | Require Authorization: Bearer <secret> on POST /v1/push and /v1/push/batch |
TRUST_PROXY_HEADERS |
No | false |
Honor X-Forwarded-For / X-Real-IP for per-IP rate limiting behind a reverse proxy |
RATE_LIMIT_IP_PER_MINUTE |
No | 600 |
Max requests per minute per hashed IP (0 disables) |
RATE_LIMIT_TOKEN_PER_MINUTE |
No | 120 |
Max dispatches per minute per hashed device token (0 disables) |
RELAY_MAX_BATCH_SIZE |
No | 100 |
Max items accepted by POST /v1/push/batch (1–500) |
METRICS_BEARER_TOKEN |
No | — | Bearer token enabling Prometheus exposition at GET /metrics |
ADMIN_PASSWORD |
No | — | Enables the in-memory metrics UI at GET /admin (min 12 characters); also authorizes /metrics |
ADMIN_COOKIE_SECURE |
No | true |
Set false only for local HTTP development |
PushRelay HTTP Endpoints & Monitoring
Section titled “PushRelay HTTP Endpoints & Monitoring”| Method & Path | Auth | Purpose |
|---|---|---|
GET /health |
None | Returns enabled transports (apns, fcm) and PushRelay version |
GET /v1/info |
None | Protocol version, batch size limit, and byte limits |
POST /v1/push |
Optional RELAY_SHARED_SECRET |
Dispatch a single push (apns, apns-voip, apns-fileprovider, fcm) |
POST /v1/push/batch |
Optional RELAY_SHARED_SECRET |
Batch dispatch ({"messages": [...]}) |
GET /metrics |
METRICS_BEARER_TOKEN or ADMIN_PASSWORD |
Prometheus text exposition (404 when neither is configured) |
GET /admin, /admin/metrics, /admin/metrics.json |
ADMIN_PASSWORD / session cookie |
In-memory metrics dashboard & JSON snapshot (404 unless ADMIN_PASSWORD is set) |
When Apple/FCM rejects a dead token (Unregistered, BadDeviceToken, DeviceTokenNotForTopic, ExpiredToken), PushRelay responds with HTTP 410 ("unregistered": true), and FynnCloud Server automatically prunes that device row from push_devices.