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
+3
View File
@@ -388,6 +388,9 @@
"failed_to_revoke_token": "Failed to revoke token",
"copied_to_clipboard": "Copied to clipboard",
"copied_api_token_to_clipboard": "Copied API token to clipboard",
"api_token_created_title": "Save your API token",
"api_token_created_description": "Copy this token now and store it somewhere safe. For your security, it won't be shown again.",
"api_token_hidden_hint": "Tokens can only be viewed when they are created.",
"copy_name_and_download_link": "Copy name and download link",
"copied_name_and_download_link_to_clipboard": "Copied name and download link to clipboard",
+3
View File
@@ -388,6 +388,9 @@
"failed_to_revoke_token": "撤销令牌失败",
"copied_to_clipboard": "已复制到剪贴板",
"copied_api_token_to_clipboard": "已将 API 令牌复制到剪贴板",
"api_token_created_title": "保存您的 API 令牌",
"api_token_created_description": "请立即复制此令牌并妥善保存。出于安全考虑,它将不会再次显示。",
"api_token_hidden_hint": "令牌仅在创建时可见。",
"copy_name_and_download_link": "复制名称和下载链接",
"copied_name_and_download_link_to_clipboard": "已复制名称和下载链接到剪贴板",