Summary
- Extract routes::token module — single source of truth for token generation + SHA-256 hashing (was copy-pasted 10+ times)
- Centralize is_unique_violation() / unique_violation_column() in db module (was 4 divergent implementations)
- Extract routes::uniqueness module for email/handle pre-flight queries (was duplicated across 2 handlers)
- Replace string-based is_valid_platform() with a serde-deserializable Platform enum
- Extract base32_lowercase() helper in crypto crate
- Break up 270-line create_did_handler into 45-line orchestrator + 6 focused helpers
- Remove AC-prefixed test comments per project convention
Test plan
- cargo test — all 328 tests pass (including 7 new token module tests)
- cargo clippy --workspace -- -D warnings — clean
- cargo fmt --all --check — clean
- No behavior changes — all existing API contracts preserved
- Invalid platform now returns 422 (serde rejection) instead of 400 (application validation) — more semantically correct