mirror of
https://github.com/nbd-wtf/satdress.git
synced 2024-11-14 09:50:19 +00:00
enforce lowercase.
This commit is contained in:
parent
d79d5351ff
commit
e2945ff375
4
db.go
4
db.go
|
@ -7,6 +7,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/cockroachdb/pebble"
|
"github.com/cockroachdb/pebble"
|
||||||
)
|
)
|
||||||
|
@ -21,6 +22,7 @@ type Params struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SaveName(name string, params *Params, providedPin string) (pin string, err error) {
|
func SaveName(name string, params *Params, providedPin string) (pin string, err error) {
|
||||||
|
name = strings.ToLower(name)
|
||||||
key := []byte(name)
|
key := []byte(name)
|
||||||
|
|
||||||
mac := hmac.New(sha256.New, []byte(s.Secret))
|
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) {
|
func GetName(name string) (*Params, error) {
|
||||||
|
name = strings.ToLower(name)
|
||||||
|
|
||||||
val, closer, err := db.Get([]byte(name))
|
val, closer, err := db.Get([]byte(name))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue
Block a user