From dc21d3850de10fa419b6a48a54c6ec4578807eef Mon Sep 17 00:00:00 2001 From: Asara Date: Sat, 4 Feb 2023 22:24:30 -0500 Subject: [PATCH] Add expiry --- lnd/lnd.go | 4 ++-- nostr/nostr.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lnd/lnd.go b/lnd/lnd.go index 1870069..aaf73a7 100644 --- a/lnd/lnd.go +++ b/lnd/lnd.go @@ -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 } diff --git a/nostr/nostr.go b/nostr/nostr.go index 78667ca..f32df2b 100644 --- a/nostr/nostr.go +++ b/nostr/nostr.go @@ -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") }