feat(database): dashboard_api_keys table

Hashed API keys with scope, restrictions, limits, expiry and batched
usage counters, for MySQL and SQLite, with test stubs and parity tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-27 08:43:12 -05:00
parent 0794cf48dd
commit 8001070501
12 changed files with 345 additions and 1 deletions

View File

@@ -219,6 +219,16 @@ public:
void InsertTrafficMinutes(const std::vector<TrafficMinute>& minutes) override;
std::vector<TrafficMinute> GetTrafficMinutes(int64_t from, int64_t to, int64_t bucketSeconds) override;
uint32_t PruneTrafficMinutes(int64_t beforeTime) override;
// IApiKeys
uint64_t InsertApiKey(const ApiKey& key) override;
std::optional<ApiKey> GetApiKey(uint64_t id) override;
std::optional<ApiKey> GetApiKeyByHash(const std::string& keyHash) override;
std::vector<ApiKey> GetApiKeys(uint32_t accountId) override;
void RevokeApiKey(uint64_t id, const std::string& revokedBy, int64_t time) override;
uint32_t RevokeAccountApiKeys(uint32_t accountId, const std::string& revokedBy, int64_t time) override;
void RotateApiKey(uint64_t id, const std::string& keyHash, const std::string& keyPrefix, int64_t issuedAt) override;
void RecordApiKeyUsage(const std::vector<ApiKeyUsage>& usage) override;
// IBbbAutosave
std::optional<IBbbAutosave::Info> GetBbbAutosave(const LWOOBJID characterId) override;
void SetBbbAutosave(const LWOOBJID characterId, const IBbbAutosave::Info& info) override;