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
Showing only changes of commit 4747b15d62 - Show all commits

View file

@ -6,28 +6,13 @@ import (
"net/http" "net/http"
"git.minhas.io/asara/well-goknown/config" "git.minhas.io/asara/well-goknown/config"
"git.minhas.io/asara/well-goknown/logger"
) )
type matrixServerWellKnown struct { type matrixServerWellKnown struct {
WellKnownAddress string `json:"m.server"` WellKnownAddress string `json:"m.server"`
} }
func MatrixServer(w http.ResponseWriter, req *http.Request) {
// uses an environment variable for now
wellKnownAddr := config.GetConfig().MatrixWellKnownAddress
if wellKnownAddr == "" {
w.WriteHeader(http.StatusNotFound)
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
wellKnown := &matrixServerWellKnown{
WellKnownAddress: wellKnownAddr,
}
json.NewEncoder(w).Encode(wellKnown)
}
type matrixBaseUrl struct { type matrixBaseUrl struct {
BaseUrl string `json:"base_url"` BaseUrl string `json:"base_url"`
} }
@ -41,11 +26,31 @@ type matrixClientWellKnown struct {
IdentityServer *matrixIdentityServer `json:"m.identity_server,omitempty"` IdentityServer *matrixIdentityServer `json:"m.identity_server,omitempty"`
} }
func MatrixClient(w http.ResponseWriter, req *http.Request) { func MatrixServer(w http.ResponseWriter, req *http.Request) {
l := logger.Get()
// uses an environment variable for now // uses an environment variable for now
wellKnownAddr := config.GetConfig().MatrixWellKnownAddress wellKnownAddr := config.GetConfig().MatrixWellKnownAddress
if wellKnownAddr == "" { if wellKnownAddr == "" {
w.WriteHeader(http.StatusNotFound) w.WriteHeader(http.StatusNotFound)
l.Debug().Str("path", "matrix/server").Msg("matrix well known address unset")
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
wellKnown := &matrixServerWellKnown{
WellKnownAddress: wellKnownAddr,
}
json.NewEncoder(w).Encode(wellKnown)
}
func MatrixClient(w http.ResponseWriter, req *http.Request) {
l := logger.Get()
// uses an environment variable for now
wellKnownAddr := config.GetConfig().MatrixWellKnownAddress
if wellKnownAddr == "" {
w.WriteHeader(http.StatusNotFound)
l.Debug().Str("path", "matrix/client").Msg("matrix well known address unset")
return return
} }