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
2 changed files with 9 additions and 3 deletions
Showing only changes of commit 7ad1325c7a - Show all commits

View file

@ -26,6 +26,7 @@ func AddNostrAddr(n NostrRequest) {
relays := make(map[string][]string)
user := nostrWellKnown{}
names := map[string]string{n.Name: n.Key}
if n.Relays != nil {
relays = map[string][]string{n.Key: n.Relays}
user = nostrWellKnown{Names: names, Relays: relays}
@ -34,12 +35,12 @@ func AddNostrAddr(n NostrRequest) {
}
jsonUser, _ := json.Marshal(user)
r, err := redis.New("localhost:6379", "", 0)
r, err := redis.New("localhost:6379", "", redis.NostrDb)
if err != nil {
fmt.Println("FAILED")
}
nameKey := fmt.Sprintf("%s@%s", n.Name, n.Hostname)
err = r.Client.Set(nameKey, jsonUser, 0).Err()
err = r.Client.Set(nameKey, jsonUser, redis.NostrDb).Err()
if err != nil {
fmt.Println("FAILED")
}
@ -53,7 +54,7 @@ func GetNostrAddr(w http.ResponseWriter, req *http.Request) {
req.ParseForm()
// connect to redis
r, err := redis.New("localhost:6379", "", 0)
r, err := redis.New("localhost:6379", "", redis.NostrDb)
if err != nil {
w.WriteHeader(http.StatusNotFound)
return

View file

@ -2,6 +2,11 @@ package redis
import "github.com/go-redis/redis"
const (
NostrDb = iota
LndDb = iota
)
type Redis struct {
Client *redis.Client
}