feat(api-token): store API tokens as SHA-256 hashes (#492)

New tokens are 32 random bytes with a shumai_ prefix and are returned
only once at creation. The list endpoint returns a 4-character hint
instead of the plaintext. A migration hashes existing tokens in place so
they keep authenticating.
This commit is contained in:
Yiling-J
2026-10-26 11:08:46 +08:00
committed by GitHub
parent c2af7494ec
commit 22486b893b
19 changed files with 413 additions and 113 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ export function getClient() {
if (!apiKey) {
console.error(
'Error: SHUMAI_API_KEY environment variable is not set. Please generate a token in the Settings -> Developer tab.',
'Error: SHUMAI_API_KEY environment variable is not set. Please generate a token in the Settings -> API Tokens tab.',
)
process.exit(1)
}