Commit graph

32 commits

Author SHA1 Message Date
77e5772afd feat(extensions): add extension loader infrastructure (#3)
Some checks are pending
Docker Compose Actions Workflow / test (push) Waiting to run
## Summary

- Adds a modular extension system for Lightning.Pub enabling third-party plugins
- Provides isolated SQLite databases per extension for data safety
- Implements ExtensionContext API for accessing Lightning.Pub services (payments, Nostr, storage)
- Supports RPC method registration with automatic namespacing
- Includes HTTP route handling for protocols like LNURL
- Event routing for payment receipts and Nostr events
- Comprehensive documentation with architecture overview and working examples

## Key Components

- `src/extensions/types.ts` - Core extension interfaces
- `src/extensions/loader.ts` - Extension discovery, loading, and lifecycle management
- `src/extensions/context.ts` - Bridge between extensions and Lightning.Pub services
- `src/extensions/database.ts` - SQLite isolation with WAL mode
- `src/extensions/README.md` - Full documentation with examples

## ExtensionContext API

| Method | Description |
|--------|-------------|
| `getApplication()` | Get application info |
| `createInvoice()` | Create Lightning invoice |
| `payInvoice()` | Pay Lightning invoice |
| `getLnurlPayInfo()` | Get LNURL-pay info for a user (enables Lightning Address/zaps) |
| `sendEncryptedDM()` | Send Nostr DM (NIP-44) |
| `publishNostrEvent()` | Publish Nostr event |
| `registerMethod()` | Register RPC method |
| `onPaymentReceived()` | Subscribe to payment callbacks |
| `onNostrEvent()` | Subscribe to Nostr events |

## Test plan

- [x] Review extension loader code for correctness
- [x] Verify TypeScript compilation succeeds
- [x] Test extension discovery from `src/extensions/` directory
- [x] Test RPC method registration and routing
- [x] Test database isolation between extensions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: boufni95 <boufni95@gmail.com>
Co-authored-by: Patrick Mulligan <patjmulligan@protonmail.com>
Reviewed-on: #3
2026-04-02 18:47:55 +00:00
boufni95
f8fe946b40
tx swaps polish 2026-02-24 18:36:03 +00:00
Mothana
c146d46c59 notification types and topic id 2026-02-20 17:08:38 +04:00
shocknet-justin
a10cf126b3
comment 2026-02-17 13:53:02 -05:00
boufni95
edbbbd4aec add time info to swaps 2026-02-17 18:12:33 +00:00
boufni95
3255730ae2 swap refunds 2026-01-30 20:37:44 +00:00
boufni95
d120ad7f99 admin swaps 2026-01-27 16:08:52 +00:00
boufni95
f6e425aed5 N swap services support 2026-01-14 19:39:27 +00:00
boufni95
5dd03063ff list swaps 2025-12-03 17:05:42 +00:00
boufni95
f20d40e44f swaps wired 2025-11-11 19:51:07 +00:00
boufni95
dd69d7d0cc dynamic settings 2025-10-28 20:36:10 +00:00
boufni95
541b19272c users cleanup 2025-10-02 20:12:36 +00:00
shocknet-justin
b211bdfae0 better sqlite binary 2025-08-26 12:43:58 -04:00
Mothana
c04442a008 Merge remote-tracking branch 'origin/master' into notifications 2025-07-25 19:31:19 +04:00
boufni95
c18f71c548 store and use notifications token 2025-07-23 15:45:42 +00:00
Mothana
44870aa667 user_receiving_invoice multi column index, and timestamp + serial_id cursor 2025-07-22 17:58:31 +04:00
Mothana
5d0b5a1c7b remove old "something" field from user_transaction_payment 2025-07-21 18:07:38 +04:00
Mothana
8005b2a3ff rfc 6570 callback templates and callback bearer tokens 2025-07-13 21:17:21 +04:00
boufni95
df088bf0fe manage authorization 2025-07-08 15:41:41 +00:00
boufni95
136a9ad231 fixies 2025-06-30 18:22:57 +00:00
boufni95
ae38963b7a fix db date + fix zombie sub process 2025-04-23 17:14:50 +00:00
boufni95
fa92c325dd db migrations 2024-12-06 16:33:28 +00:00
boufni95
61da2eea77 default cb url for user 2024-09-23 17:27:10 +00:00
boufni95
19ee91cd5f fix rules wiring 2024-09-23 15:48:09 +00:00
boufni95
49b8dd693c authorization hook, and spec changes 2024-09-18 18:49:29 +00:00
boufni95
6df5752d46 db + auth routes 2024-09-16 15:15:52 +00:00
boufni95
ebca846740 fix metrics data 2024-08-21 21:28:35 +02:00
Mothana
e2c20eb9ac one time invites and GuestWithPub Auth 2024-07-23 21:55:50 +04:00
boufni95
3a8fdf89f5 logging, drain logic, watchdog, rugpull 2024-07-12 22:31:58 +02:00
boufni95
2648f55df0 unlock flow 2024-07-05 16:19:43 +02:00
boufni95
4325cdd07d event log v3 2024-06-25 19:32:17 +02:00
boufni95
e7f767f650 db migrations 2023-12-21 16:01:41 +01:00