lightning-pub/package.json
padreug 77e5772afd
Some checks are pending
Docker Compose Actions Workflow / test (push) Waiting to run
feat(extensions): add extension loader infrastructure (#3)
## 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

97 lines
3.4 KiB
JSON

{
"name": "lnpub",
"version": "1.0.0",
"description": "A Nostr based account system and management platform for nodes on Bitcoin's Lightning Network",
"main": "index.js",
"scripts": {
"clean": "rimraf build",
"test": "npm run clean && tsc && export NODE_TLS_REJECT_UNAUTHORIZED='0' && node build/src/tests/testRunner.js",
"start": "npm run clean && tsc && node build/src/index.js",
"start:ci": "git reset --hard && git pull && npm run start",
"gen": "cd proto && rimraf autogenerated && export PATH=$PATH:~/Lightning.Pub/proto && protoc -I ./service --pub_out=. service/*",
"build_autogenerated": "cd proto && rimraf autogenerated && protoc -I ./service --pub_out=. service/*",
"build_lnd_client_1": "cd proto && protoc -I ./others --plugin=.\\node_modules\\.bin\\protoc-gen-ts_proto.cmd --ts_proto_out=./lnd --ts_proto_opt=esModuleInterop=true others/* ",
"build_lnd_client": "cd proto && rimraf lnd/* && npx protoc --ts_out ./lnd --ts_opt long_type_string --proto_path others others/* ",
"typeorm": "typeorm-ts-node-commonjs",
"test_relay": "npm run clean && tsc && node build/src/tests/testRelay.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/shocknet/Lightning.Pub.git"
},
"author": "",
"type": "module",
"license": "Affero GPLv3",
"bugs": {
"url": "https://github.com/shocknet/Lightning.Pub/issues"
},
"homepage": "https://github.com/shocknet/Lightning.Pub#readme",
"dependencies": {
"@grpc/grpc-js": "^1.11.2",
"@protobuf-ts/grpc-transport": "^2.9.4",
"@protobuf-ts/plugin": "^2.5.0",
"@protobuf-ts/runtime": "^2.5.0",
"@shocknet/clink-sdk": "^1.4.0",
"@stablelib/xchacha20": "^1.0.1",
"@types/express": "^4.17.21",
"@types/node": "^17.0.31",
"@types/secp256k1": "^4.0.3",
"@vulpemventures/secp256k1-zkp": "^3.2.1",
"axios": "^1.9.0",
"bech32": "^2.0.0",
"better-sqlite3": "^12.2.0",
"bitcoin-core": "^4.2.0",
"bitcoinjs-lib": "^6.1.7",
"boltz-core": "^3.0.0",
"chai": "^4.3.7",
"chai-string": "^1.5.0",
"copyfiles": "^2.4.1",
"cors": "^2.8.5",
"csv": "^6.3.8",
"dotenv": "^16.4.5",
"eccrypto": "^1.1.6",
"ecpair": "^3.0.0",
"express": "^4.21.2",
"globby": "^13.1.2",
"grpc-tools": "^1.12.4",
"jsonwebtoken": "^9.0.2",
"light-bolt11-decoder": "^3.2.0",
"lodash": "^4.17.21",
"nostr-tools": "^2.13.0",
"pg": "^8.4.0",
"qrcode-terminal": "^0.12.0",
"reflect-metadata": "^0.2.2",
"rimraf": "^3.0.2",
"rxjs": "^7.5.5",
"secp256k1": "^5.0.1",
"tiny-secp256k1": "^2.2.4",
"ts-node": "^10.7.0",
"ts-proto": "^1.131.2",
"typeorm": "^0.3.26",
"typescript": "^5.5.4",
"uri-template": "^2.0.0",
"uuid": "^8.3.2",
"why-is-node-running": "^3.2.0",
"wrtc": "^0.4.7",
"ws": "^8.18.0",
"zip-a-folder": "^3.1.9"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.13",
"@types/chai": "^4.3.4",
"@types/chai-string": "^1.4.5",
"@types/cors": "^2.8.17",
"@types/eccrypto": "^1.1.6",
"@types/jsonwebtoken": "^9.0.9",
"@types/lodash": "^4.14.182",
"@types/node": "^16.11.10",
"@types/node-fetch": "^2.6.3",
"@types/uuid": "^8.3.4",
"@types/websocket": "^1.0.10",
"@types/ws": "^8.5.12",
"nodemon": "^2.0.20",
"ts-node": "10.7.0",
"typescript": "5.5.4"
},
"overrides": {}
}