diff --git a/db.go b/db.go index 133cf01..211dd46 100644 --- a/db.go +++ b/db.go @@ -21,10 +21,10 @@ type Params struct { } func SaveName(name string, params *Params, providedPin string) (pin string, err error) { - key := []byte(name + "@" + s.Domain) + key := []byte(name) mac := hmac.New(sha256.New, []byte(s.Secret)) - mac.Write(key) + mac.Write([]byte(name + "@" + s.Domain)) pin = hex.EncodeToString(mac.Sum(nil)) if _, closer, err := db.Get(key); err == nil { diff --git a/makeinvoice.go b/makeinvoice.go index 14d3f77..6801f1b 100644 --- a/makeinvoice.go +++ b/makeinvoice.go @@ -2,6 +2,7 @@ package main import ( "crypto/sha256" + "encoding/hex" "strconv" "time" @@ -50,6 +51,11 @@ func makeInvoice(params *Params, msat int) (bolt11 string, err error) { } } + log.Debug().Int("msatoshi", msat). + Interface("backend", backend). + Str("description_hash", hex.EncodeToString(h[:])). + Msg("generating invoice") + // actually generate the invoice return makeinvoice.MakeInvoice(makeinvoice.Params{ Msatoshi: int64(msat),