We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de9f68a commit 20a3f49Copy full SHA for 20a3f49
packages/api/internal/auth/key.go
@@ -45,12 +45,11 @@ func GenerateKey(prefix string) (Key, error) {
45
}
46
47
func VerifyKey(prefix string, key string) (string, error) {
48
- parts := strings.Split(key, prefix)
49
- if len(parts) != 2 {
+ if !strings.HasPrefix(key, prefix) {
50
return "", fmt.Errorf("invalid key prefix")
51
52
53
- keyValue := parts[1]
+ keyValue := key[len(prefix):]
54
keyBytes, err := hex.DecodeString(keyValue)
55
if err != nil {
56
return "", fmt.Errorf("invalid key")
0 commit comments