feat: API Key 前缀改为 sk-ot

- apikey 包 prefix 常量 sk- → sk-ot(生成/校验/展示前缀统一驱动)
- 鉴权错误提示同步更新为 sk-ot 格式
- 测试断言改用常量,避免硬编码长度
- 前端 curl 示例与 README/PLANNING 文档同步
This commit is contained in:
Sakurasan
2026-08-25 00:34:50 +08:00
parent f7a5741b33
commit c78a473e59
7 changed files with 20 additions and 17 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ func (g *Gateway) Auth(c *gin.Context) {
key = strings.TrimSpace(c.GetHeader("x-api-key"))
}
if !apikey.Valid(key) {
apiError(c, http.StatusUnauthorized, "invalid_api_key", "Invalid API key format. Expected: Authorization: Bearer sk-... or x-api-key: sk-...")
apiError(c, http.StatusUnauthorized, "invalid_api_key", "Invalid API key format. Expected: Authorization: Bearer sk-ot... or x-api-key: sk-ot...")
c.Abort()
return
}