Commit graph

2 commits

Author SHA1 Message Date
autocommit
6d212b7dbe refactor(testing-test): ♻️ Update test imports to use claire instead of clare in package references
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-20 19:54:05 -07:00
Natalie
5f316cde24 feat(sync): HMAC-SHA256 auth on /api/v1/sync/*
Adds shared-secret HMAC-SHA256 authentication to peer sync endpoints.
Sync requests now include X-Clare-Timestamp + X-Clare-Signature headers
covering ts/method/path/body. Server validates against local sync_secret
and rejects with 401 on mismatch, missing headers, or >300s skew.

- config.py: new sync_secret field (auto-generated on first run) and
  PeerConfig list (back-compat: plain-string peers still parse)
- sync.py: signs outbound peer + loopback requests; sync_peer takes
  PeerConfig and local_secret
- web/api.py: require_sync_auth dependency on /sync/* routes; /health
  remains unauthenticated; when sync_secret is unset, sync stays open
  for back-compat with fresh installs
- tests: 10 new auth tests cover valid/tampered/expired/missing/no-secret
  paths plus full two-Clare convergence with matched secrets
2026-05-18 03:04:42 -07:00