feat: nostr transport layer for HTTP-free API access #3

Open
padreug wants to merge 2 commits from nostr-native-transport-forgejo into dev

2 commits

Author SHA1 Message Date
Patrick Mulligan
bae881587c fix: adapt nostr transport to forgejo fork's secp256k1 library
Some checks failed
codeql / analyze (pull_request) Has been cancelled
LNbits CI / test-unit (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.10) (pull_request) Has been cancelled
LNbits CI / regtest (CoreLightningRestWallet, 3.10) (pull_request) Has been cancelled
LNbits CI / test-unit (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.11) (pull_request) Has been cancelled
LNbits CI / test-unit (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.12) (pull_request) Has been cancelled
LNbits CI / migration (3.10) (pull_request) Has been cancelled
LNbits CI / migration (3.11) (pull_request) Has been cancelled
LNbits CI / migration (3.12) (pull_request) Has been cancelled
LNbits CI / openapi (pull_request) Has been cancelled
LNbits CI / test-api (, 3.10) (pull_request) Has been cancelled
LNbits CI / test-api (, 3.11) (pull_request) Has been cancelled
LNbits CI / test-api (, 3.12) (pull_request) Has been cancelled
LNbits CI / test-api (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.10) (pull_request) Has been cancelled
LNbits CI / test-api (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.11) (pull_request) Has been cancelled
LNbits CI / test-api (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.12) (pull_request) Has been cancelled
LNbits CI / test-wallets (, 3.10) (pull_request) Has been cancelled
LNbits CI / test-wallets (, 3.11) (pull_request) Has been cancelled
LNbits CI / test-wallets (, 3.12) (pull_request) Has been cancelled
LNbits CI / test-wallets (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.10) (pull_request) Has been cancelled
LNbits CI / test-wallets (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.11) (pull_request) Has been cancelled
LNbits CI / test-wallets (postgres://lnbits:lnbits@0.0.0.0:5432/lnbits, 3.12) (pull_request) Has been cancelled
LNbits CI / test-unit (, 3.10) (pull_request) Has been cancelled
LNbits CI / test-unit (, 3.11) (pull_request) Has been cancelled
LNbits CI / test-unit (, 3.12) (pull_request) Has been cancelled
LNbits CI / regtest (CoreLightningWallet, 3.10) (pull_request) Has been cancelled
LNbits CI / regtest (EclairWallet, 3.10) (pull_request) Has been cancelled
LNbits CI / regtest (LNbitsWallet, 3.10) (pull_request) Has been cancelled
LNbits CI / regtest (LndRestWallet, 3.10) (pull_request) Has been cancelled
LNbits CI / regtest (LndWallet, 3.10) (pull_request) Has been cancelled
LNbits CI / jmeter (3.10) (pull_request) Has been cancelled
The aiolabs/lnbits fork uses python-secp256k1 instead of coincurve
for elliptic curve operations. Update crypto.py, relay_pool.py, and
__init__.py to use the secp256k1 API (tweak_mul, schnorr_sign).

Also comment out account.activated check since this field doesn't
exist in the current fork (present in upstream dev).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 05:49:25 -04:00
Patrick Mulligan
5443cb75bf feat: add nostr transport layer for HTTP-free API access
Enable LNbits API access over nostr relays using NIP-44 v2 encrypted
kind-21000 events, modeled after Lightning.pub's architecture. This
eliminates the need for port forwarding, DNS, or SSL -- the instance
connects outbound to commodity relays and clients communicate via
encrypted nostr events.

New module: lnbits/core/services/nostr_transport/
- crypto.py: NIP-44 v2 (ECDH + HKDF + ChaCha20 + HMAC-SHA256)
- relay_pool.py: multi-relay WebSocket pool with auto-reconnect
- dispatcher.py: RPC registry with 7 core wallet endpoints
- auth.py: nostr pubkey -> LNbits account/wallet resolution
- models.py: request/response pydantic models

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 05:44:56 -04:00