Last AUTH fix I hope
This commit is contained in:
parent
2851d8bfe6
commit
cdad91c110
@ -86,8 +86,8 @@ func (s *Service) Login(pubkey, signature, eventJSON string) (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Compare with the provided pubkey
|
||||
if allowedHexPubkey != pubkey {
|
||||
// Compare with the provided pubkey (case-insensitive comparison)
|
||||
if strings.ToLower(allowedHexPubkey) != strings.ToLower(pubkey) {
|
||||
s.logger.Warn("Login attempt from non-whitelisted pubkey",
|
||||
zap.String("attempt_pubkey", pubkey),
|
||||
zap.String("allowed_pubkey", allowedHexPubkey),
|
||||
@ -166,8 +166,8 @@ func (s *Service) VerifyToken(tokenStr string) (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Compare with the token's pubkey
|
||||
if allowedHexPubkey != token.Pubkey {
|
||||
// Compare with the token's pubkey (case-insensitive comparison)
|
||||
if strings.ToLower(allowedHexPubkey) != strings.ToLower(token.Pubkey) {
|
||||
s.logger.Warn("Token verification from non-whitelisted pubkey",
|
||||
zap.String("token_pubkey", token.Pubkey),
|
||||
zap.String("allowed_pubkey", allowedHexPubkey))
|
||||
|
@ -2,6 +2,8 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/nbd-wtf/go-nostr/nip19"
|
||||
)
|
||||
|
||||
@ -40,6 +42,6 @@ func DecodeNpub(npub string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Return the hex pubkey
|
||||
return data.(string), nil
|
||||
// Return the hex pubkey (ensure lowercase for consistent comparisons)
|
||||
return strings.ToLower(data.(string)), nil
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user