fix: relay secret rotation on infra sync updates #26
Reference in New Issue
Block a user
Delete Branch "userAdityaa/caravel:relay-rotation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When a relay undergoes routine infra sync (triggered by
update_relay,activate_relay,deactivate_relayactivities), 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
POSTfor creation (with secret) andPATCHfor updates (without secret), aligning with partial update semantics.Build the request body via a helper that includes the secret only when provided.
Behavior
closes #25
9b44a8bcc4to364b8fd26c