mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 19:04:23 +00:00
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:
+2
-1
@@ -18,7 +18,8 @@ Before using the CLI, you must set the following environment variables to authen
|
||||
# The endpoint of your Shumai API server (e.g. http://localhost:3000)
|
||||
export SHUMAI_API_SERVER="http://localhost:3000"
|
||||
|
||||
# Your personal API Token (Generate this in the WebUI via Settings -> Developer tab)
|
||||
# Your personal API Token (Generate this in the WebUI via Settings -> API Tokens tab).
|
||||
# The token is shown only once when it is created, so copy it right away.
|
||||
export SHUMAI_API_KEY="your-developer-api-token"
|
||||
|
||||
# Optional: Enable asset deletion capability (disabled by default for safety)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user