Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user