Add nostr nip-05 registration with lnd invoices #1

Merged
Asara merged 33 commits from nostr_lnd into main 2023-05-30 00:10:37 +00:00
3 changed files with 12 additions and 5 deletions
Showing only changes of commit ebbe258b0a - Show all commits

View file

@ -1,8 +1,15 @@
package lnd
import "github.com/davecgh/go-spew/spew"
import (
"github.com/davecgh/go-spew/spew"
)
func Request(request []byte) (string, int, error) {
func Request(rKey string, request []byte) (string, int, 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
}

View file

@ -28,7 +28,7 @@ type NostrRequest struct {
func RequestNostrAddr(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
http.ServeFile(w, r, "nostr/form.html")
http.ServeFile(w, r, "html/nostr_form.html")
case "POST":
r.ParseForm()
rKey := getRkey(r.FormValue("Name"), getHostname(r.Host))
@ -66,7 +66,7 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) {
jsonUser, _ := json.Marshal(user)
// generate the payment request
paymentReq, exp, err := lnd.Request(jsonUser)
paymentReq, exp, err := lnd.Request(rKey, jsonUser)
if err != nil {
w.WriteHeader(http.StatusServiceUnavailable)
return
@ -122,7 +122,7 @@ func AddNostrAddr(n NostrRequest) {
r, err := redis.New("localhost:6379", "", redis.NostrDb)
if err != nil {
fmt.Println("FAILED")
fmt.Println("Failed to connect to redis")
}
nameKey := getRkey(n.Name, n.Hostname)
err = r.Client.Set(nameKey, jsonUser, redis.NostrDb).Err()