mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-17 18:22:50 +00:00
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:
28
migrations/dlu/sqlite/66_dashboard_api_keys.sql
Normal file
28
migrations/dlu/sqlite/66_dashboard_api_keys.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
/* Dashboard API keys. See the MySQL migration. */
|
||||
CREATE TABLE IF NOT EXISTS dashboard_api_keys (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
account_id INTEGER NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
note TEXT NOT NULL DEFAULT '',
|
||||
key_hash TEXT NOT NULL,
|
||||
key_prefix TEXT NOT NULL,
|
||||
permissions TEXT NOT NULL DEFAULT '',
|
||||
read_only INTEGER NOT NULL DEFAULT 0,
|
||||
allowed_ips TEXT NOT NULL DEFAULT '',
|
||||
allowed_paths TEXT NOT NULL DEFAULT '',
|
||||
rate_limit INTEGER NOT NULL DEFAULT 0,
|
||||
daily_quota INTEGER NOT NULL DEFAULT 0,
|
||||
created_at BIGINT NOT NULL,
|
||||
created_by TEXT NOT NULL DEFAULT '',
|
||||
issued_at BIGINT NOT NULL,
|
||||
expires_at BIGINT NOT NULL DEFAULT 0,
|
||||
revoked_at BIGINT NOT NULL DEFAULT 0,
|
||||
revoked_by TEXT NOT NULL DEFAULT '',
|
||||
last_used_at BIGINT NOT NULL DEFAULT 0,
|
||||
last_ip TEXT NOT NULL DEFAULT '',
|
||||
request_count BIGINT NOT NULL DEFAULT 0,
|
||||
quota_day INTEGER NOT NULL DEFAULT 0,
|
||||
day_count INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS dashboard_api_keys_hash ON dashboard_api_keys (key_hash);
|
||||
CREATE INDEX IF NOT EXISTS dashboard_api_keys_account ON dashboard_api_keys (account_id);
|
||||
Reference in New Issue
Block a user