From e2945ff375743ccf93429f69158e11335ecb099b Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 21 Aug 2021 13:52:21 -0300 Subject: [PATCH] enforce lowercase. --- db.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db.go b/db.go index 211dd46..7b39a7a 100644 --- a/db.go +++ b/db.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "strings" "github.com/cockroachdb/pebble" ) @@ -21,6 +22,7 @@ type Params struct { } func SaveName(name string, params *Params, providedPin string) (pin string, err error) { + name = strings.ToLower(name) key := []byte(name) mac := hmac.New(sha256.New, []byte(s.Secret)) @@ -49,6 +51,8 @@ func SaveName(name string, params *Params, providedPin string) (pin string, err } func GetName(name string) (*Params, error) { + name = strings.ToLower(name) + val, closer, err := db.Get([]byte(name)) if err != nil { return nil, err