verifyAPIKey compares a plaintext key with a bcrypt hash.
(hashedKey, plainKey string)
| 30 | |
| 31 | // verifyAPIKey compares a plaintext key with a bcrypt hash. |
| 32 | func verifyAPIKey(hashedKey, plainKey string) bool { |
| 33 | err := bcrypt.CompareHashAndPassword([]byte(hashedKey), []byte(plainKey)) |
| 34 | return err == nil |
| 35 | } |
| 36 | |
| 37 | // getKeyPrefix extracts the first 16 characters of the key for efficient lookup. |
| 38 | func getKeyPrefix(key string) string { |