fix: relay secret rotation on infra sync updates #26

Merged
hodlbod merged 1 commits from userAdityaa/caravel:relay-rotation into master 2026-04-18 13:24:09 +00:00
Contributor

Problem

When a relay undergoes routine infra sync (triggered by update_relay, activate_relay, deactivate_relay activities), the sync worker generates a new random secret and sends it to Zooid, causing the relay's public key to change. This makes the relay appear as a different relay to connected clients, even though only a non-identity field (like status) changed.

Solution

Generate the relay secret only during creation (is_new = true) and omit it for updates.
Use POST for creation (with secret) and PATCH for updates (without secret), aligning with partial update semantics.
Build the request body via a helper that includes the secret only when provided.

Behavior

  • Before: Update/activate/deactivate = new secret = relay pubkey changes
  • After: Update/activate/deactivate = same secret = relay pubkey stable

closes #25

### Problem When a relay undergoes routine infra sync (triggered by `update_relay`, `activate_relay`, `deactivate_relay` activities), the sync worker generates a new random secret and sends it to Zooid, causing the relay's public key to change. This makes the relay appear as a different relay to connected clients, even though only a non-identity field (like status) changed. ### Solution Generate the relay secret only during creation (`is_new = true`) and omit it for updates. Use `POST` for creation (with secret) and `PATCH` for updates (without secret), aligning with partial update semantics. Build the request body via a helper that includes the secret only when provided. ### Behavior * **Before:** Update/activate/deactivate = new secret = relay pubkey changes * **After:** Update/activate/deactivate = same secret = relay pubkey stable closes #25
hodlbod added 1 commit 2026-04-18 13:23:58 +00:00
hodlbod force-pushed relay-rotation from 9b44a8bcc4 to 364b8fd26c 2026-04-18 13:23:58 +00:00 Compare
hodlbod merged commit ca26d41eef into master 2026-04-18 13:24:09 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coracle/caravel#26