Skip to content

forgesworn/aperture-phoenixd

Repository files navigation

aperture-phoenixd

Nostr: npub1mgvlrnf5hm9yf0n5mf9nqmvarhvxkc6remu5ec3vf8r0txqkuk7su0e7q2

MIT licence Go GitHub Sponsors

Use Phoenixd as the Lightning backend for Aperture — no LND required.

Implements Aperture's mint.Challenger and auth.InvoiceChecker interfaces against Phoenixd's REST API. Drop-in replacement for LND with strictVerify=false (Aperture's default).

Quick start

go get github.com/forgesworn/aperture-phoenixd
import "github.com/forgesworn/aperture-phoenixd"

challenger := phoenixd.NewChallenger("http://localhost:9740", "your-phoenixd-password")

// challenger.NewChallenge(priceSats) — creates a Lightning invoice via Phoenixd
// challenger.VerifyInvoiceStatus(...) — no-op for strictVerify=false
// challenger.Stop() — no-op (stateless HTTP client)

Integrating with Aperture

See testdata/aperture-patch.diff for the ~20-line diff to wire this into Aperture's aperture.go. Adds PhoenixdURL and PhoenixdPassword config fields alongside the existing LndHost and Passphrase options.

Demo

The included echo server provides a minimal API to proxy through Aperture:

go run ./cmd/echo-server
# Listens on :8080, returns request body at /v1/echo

How it works

  1. Aperture receives an HTTP request and needs to create an L402 challenge
  2. PhoenixdChallenger.NewChallenge(price) calls Phoenixd's POST /createinvoice
  3. Phoenixd creates a Lightning invoice and returns the BOLT11 string + payment hash
  4. Aperture wraps this in a macaroon and returns it as the L402 challenge
  5. The client pays the invoice and presents the macaroon + preimage
  6. Aperture verifies the preimage against the payment hash — access granted

Limitations

  • strictVerify=true is not supported. Phoenixd's WebSocket does not emit invoice cancellation events required for full invoice status tracking. With strictVerify=false (the default), macaroon + preimage verification is the security model.

Ecosystem

Project Role
aperture L402 reverse proxy (what this adapter plugs into)
aperture-announce Announces Aperture services on Nostr for discovery
402-mcp MCP client that discovers and pays for L402 APIs

Licence

MIT

About

Use Phoenixd as the Lightning backend for Aperture — no LND required

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors