feat(onwards)!: hold API keys by SHA-256 hash (DW-1008)

Merged
TO
16d ago
+881-488

onwards half of DW-1008 (part 2 of 7 for DW-1005), split out so only onwards takes the breaking version bump. Stacked on #2139; review that first.

What changes

Keys are held as KeyHash([u8; 32]), compared in constant time; KeySet, key_labels and the per-key limiters are keyed by it, and the bearer token is hashed once per request. dwctl's sync passes the stored hash straight through, so the routing cache holds no plaintext. The standalone binary's config format is unchanged: plaintext keys are hashed on load, and sha256:<hex> entries are accepted. A deployment whose granted keys all have malformed hashes keeps an empty key set and rejects every request; only a deployment with no grants has no key set. The library API change (ConstantTimeString → KeyHash) is marked breaking, so release-please will cut onwards 2.0.0.

Why a separate PR

The repo squash-merges with the PR title as the commit title, and release-please applies a breaking change to every component a commit touches. Keeping this change apart means onwards goes to 2.0.0 without also bumping dwctl's major version.

Testing

  • Standalone config: plaintext keys are hashed on load and sha256:<hex> entries round-trip; covered by a new onwards test and a docs note.
  • Real keys authenticate through onwards after their stored plaintext is swapped for a decoy, and the decoy is rejected.
  • cargo nextest run -p dwctl -p onwards (3652 passed) and just lint rust pass locally on this branch.