Files
Prism/internal/auth/apikey_test.go
T
renjue 2780eaf30c
CI / test (push) Successful in 1m55s
CI / docker (push) Failing after 24s
feat: Prism HTTP/SOCKS5 代理网关及管理台
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 15:11:50 +08:00

20 lines
343 B
Go

package auth
import "testing"
func TestGenerateAndHashAPIKey(t *testing.T) {
key, err := GenerateAPIKey()
if err != nil {
t.Fatal(err)
}
if err := ValidateAPIKeyFormat(key); err != nil {
t.Fatal(err)
}
if HashAPIKey(key) == "" {
t.Fatal("empty hash")
}
if HashAPIKey(key) != HashAPIKey(key) {
t.Fatal("hash not stable")
}
}