Add nostr nip-05 registration with lnd invoices #1
2 changed files with 6 additions and 6 deletions
|
@ -4,12 +4,12 @@ import (
|
|||
"github.com/davecgh/go-spew/spew"
|
||||
)
|
||||
|
||||
func Request(rKey string, request []byte) (string, int, error) {
|
||||
func Request(rKey string, request []byte) (string, error) {
|
||||
//redis, err := redis.New("localhost:6379", "", redis.LndDb)
|
||||
//if err != nil {
|
||||
// return "", 0, errors.New("Failed to connect to redis")
|
||||
//}
|
||||
spew.Dump(rKey)
|
||||
spew.Dump(request)
|
||||
return "x", 1, nil
|
||||
return "x", nil
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.minhas.io/asara/well-goknown/lnd"
|
||||
"git.minhas.io/asara/well-goknown/redis"
|
||||
|
@ -68,18 +69,17 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) {
|
|||
jsonUser, _ := json.Marshal(user)
|
||||
|
||||
// generate the payment request
|
||||
paymentReq, exp, err := lnd.Request(rKey, jsonUser)
|
||||
paymentReq, err := lnd.Request(rKey, jsonUser)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
requestKey := getRkey("requested", r.FormValue("Name"), getHostname(r.Host))
|
||||
err = redisCli.Client.Set(ctx, requestKey, jsonUser, redis.NostrDb).Err()
|
||||
err = redisCli.Client.Set(ctx, requestKey, jsonUser, 15*time.Minute).Err()
|
||||
if err != nil {
|
||||
fmt.Println("FAILED")
|
||||
}
|
||||
spew.Dump(paymentReq)
|
||||
spew.Dump(exp)
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ func AddNostrAddr(n NostrRequest) {
|
|||
fmt.Println("Failed to connect to redis")
|
||||
}
|
||||
nameKey := getRkey("verified", n.Name, n.Hostname)
|
||||
err = redisCli.Client.Set(ctx, nameKey, jsonUser, redis.NostrDb).Err()
|
||||
err = redisCli.Client.Set(ctx, nameKey, jsonUser, 0).Err()
|
||||
if err != nil {
|
||||
fmt.Println("FAILED")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue