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
180 lines
8.3 KiB
TypeScript
180 lines
8.3 KiB
TypeScript
// @generated by protobuf-ts 2.11.1
|
|
// @generated from protobuf file "walletunlocker.proto" (package "lnrpc", syntax proto3)
|
|
// tslint:disable
|
|
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
|
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
|
import { WalletUnlocker } from "./walletunlocker.js";
|
|
import type { ChangePasswordResponse } from "./walletunlocker.js";
|
|
import type { ChangePasswordRequest } from "./walletunlocker.js";
|
|
import type { UnlockWalletResponse } from "./walletunlocker.js";
|
|
import type { UnlockWalletRequest } from "./walletunlocker.js";
|
|
import type { InitWalletResponse } from "./walletunlocker.js";
|
|
import type { InitWalletRequest } from "./walletunlocker.js";
|
|
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
|
import type { GenSeedResponse } from "./walletunlocker.js";
|
|
import type { GenSeedRequest } from "./walletunlocker.js";
|
|
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
|
|
//
|
|
// Comments in this file will be directly parsed into the API
|
|
// Documentation as descriptions of the associated method, message, or field.
|
|
// These descriptions should go right above the definition of the object, and
|
|
// can be in either block or // comment format.
|
|
//
|
|
// An RPC method can be matched to an lncli command by placing a line in the
|
|
// beginning of the description in exactly the following format:
|
|
// lncli: `methodname`
|
|
//
|
|
// Failure to specify the exact name of the command will cause documentation
|
|
// generation to fail.
|
|
//
|
|
// More information on how exactly the gRPC documentation is generated from
|
|
// this proto file can be found here:
|
|
// https://github.com/lightninglabs/lightning-api
|
|
|
|
/**
|
|
* WalletUnlocker is a service that is used to set up a wallet password for
|
|
* lnd at first startup, and unlock a previously set up wallet.
|
|
*
|
|
* @generated from protobuf service lnrpc.WalletUnlocker
|
|
*/
|
|
export interface IWalletUnlockerClient {
|
|
/**
|
|
*
|
|
* GenSeed is the first method that should be used to instantiate a new lnd
|
|
* instance. This method allows a caller to generate a new aezeed cipher seed
|
|
* given an optional passphrase. If provided, the passphrase will be necessary
|
|
* to decrypt the cipherseed to expose the internal wallet seed.
|
|
*
|
|
* Once the cipherseed is obtained and verified by the user, the InitWallet
|
|
* method should be used to commit the newly generated seed, and create the
|
|
* wallet.
|
|
*
|
|
* @generated from protobuf rpc: GenSeed
|
|
*/
|
|
genSeed(input: GenSeedRequest, options?: RpcOptions): UnaryCall<GenSeedRequest, GenSeedResponse>;
|
|
/**
|
|
*
|
|
* InitWallet is used when lnd is starting up for the first time to fully
|
|
* initialize the daemon and its internal wallet. At the very least a wallet
|
|
* password must be provided. This will be used to encrypt sensitive material
|
|
* on disk.
|
|
*
|
|
* In the case of a recovery scenario, the user can also specify their aezeed
|
|
* mnemonic and passphrase. If set, then the daemon will use this prior state
|
|
* to initialize its internal wallet.
|
|
*
|
|
* Alternatively, this can be used along with the GenSeed RPC to obtain a
|
|
* seed, then present it to the user. Once it has been verified by the user,
|
|
* the seed can be fed into this RPC in order to commit the new wallet.
|
|
*
|
|
* @generated from protobuf rpc: InitWallet
|
|
*/
|
|
initWallet(input: InitWalletRequest, options?: RpcOptions): UnaryCall<InitWalletRequest, InitWalletResponse>;
|
|
/**
|
|
* lncli: `unlock`
|
|
* UnlockWallet is used at startup of lnd to provide a password to unlock
|
|
* the wallet database.
|
|
*
|
|
* @generated from protobuf rpc: UnlockWallet
|
|
*/
|
|
unlockWallet(input: UnlockWalletRequest, options?: RpcOptions): UnaryCall<UnlockWalletRequest, UnlockWalletResponse>;
|
|
/**
|
|
* lncli: `changepassword`
|
|
* ChangePassword changes the password of the encrypted wallet. This will
|
|
* automatically unlock the wallet database if successful.
|
|
*
|
|
* @generated from protobuf rpc: ChangePassword
|
|
*/
|
|
changePassword(input: ChangePasswordRequest, options?: RpcOptions): UnaryCall<ChangePasswordRequest, ChangePasswordResponse>;
|
|
}
|
|
//
|
|
// Comments in this file will be directly parsed into the API
|
|
// Documentation as descriptions of the associated method, message, or field.
|
|
// These descriptions should go right above the definition of the object, and
|
|
// can be in either block or // comment format.
|
|
//
|
|
// An RPC method can be matched to an lncli command by placing a line in the
|
|
// beginning of the description in exactly the following format:
|
|
// lncli: `methodname`
|
|
//
|
|
// Failure to specify the exact name of the command will cause documentation
|
|
// generation to fail.
|
|
//
|
|
// More information on how exactly the gRPC documentation is generated from
|
|
// this proto file can be found here:
|
|
// https://github.com/lightninglabs/lightning-api
|
|
|
|
/**
|
|
* WalletUnlocker is a service that is used to set up a wallet password for
|
|
* lnd at first startup, and unlock a previously set up wallet.
|
|
*
|
|
* @generated from protobuf service lnrpc.WalletUnlocker
|
|
*/
|
|
export class WalletUnlockerClient implements IWalletUnlockerClient, ServiceInfo {
|
|
typeName = WalletUnlocker.typeName;
|
|
methods = WalletUnlocker.methods;
|
|
options = WalletUnlocker.options;
|
|
constructor(private readonly _transport: RpcTransport) {
|
|
}
|
|
/**
|
|
*
|
|
* GenSeed is the first method that should be used to instantiate a new lnd
|
|
* instance. This method allows a caller to generate a new aezeed cipher seed
|
|
* given an optional passphrase. If provided, the passphrase will be necessary
|
|
* to decrypt the cipherseed to expose the internal wallet seed.
|
|
*
|
|
* Once the cipherseed is obtained and verified by the user, the InitWallet
|
|
* method should be used to commit the newly generated seed, and create the
|
|
* wallet.
|
|
*
|
|
* @generated from protobuf rpc: GenSeed
|
|
*/
|
|
genSeed(input: GenSeedRequest, options?: RpcOptions): UnaryCall<GenSeedRequest, GenSeedResponse> {
|
|
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
|
return stackIntercept<GenSeedRequest, GenSeedResponse>("unary", this._transport, method, opt, input);
|
|
}
|
|
/**
|
|
*
|
|
* InitWallet is used when lnd is starting up for the first time to fully
|
|
* initialize the daemon and its internal wallet. At the very least a wallet
|
|
* password must be provided. This will be used to encrypt sensitive material
|
|
* on disk.
|
|
*
|
|
* In the case of a recovery scenario, the user can also specify their aezeed
|
|
* mnemonic and passphrase. If set, then the daemon will use this prior state
|
|
* to initialize its internal wallet.
|
|
*
|
|
* Alternatively, this can be used along with the GenSeed RPC to obtain a
|
|
* seed, then present it to the user. Once it has been verified by the user,
|
|
* the seed can be fed into this RPC in order to commit the new wallet.
|
|
*
|
|
* @generated from protobuf rpc: InitWallet
|
|
*/
|
|
initWallet(input: InitWalletRequest, options?: RpcOptions): UnaryCall<InitWalletRequest, InitWalletResponse> {
|
|
const method = this.methods[1], opt = this._transport.mergeOptions(options);
|
|
return stackIntercept<InitWalletRequest, InitWalletResponse>("unary", this._transport, method, opt, input);
|
|
}
|
|
/**
|
|
* lncli: `unlock`
|
|
* UnlockWallet is used at startup of lnd to provide a password to unlock
|
|
* the wallet database.
|
|
*
|
|
* @generated from protobuf rpc: UnlockWallet
|
|
*/
|
|
unlockWallet(input: UnlockWalletRequest, options?: RpcOptions): UnaryCall<UnlockWalletRequest, UnlockWalletResponse> {
|
|
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
|
return stackIntercept<UnlockWalletRequest, UnlockWalletResponse>("unary", this._transport, method, opt, input);
|
|
}
|
|
/**
|
|
* lncli: `changepassword`
|
|
* ChangePassword changes the password of the encrypted wallet. This will
|
|
* automatically unlock the wallet database if successful.
|
|
*
|
|
* @generated from protobuf rpc: ChangePassword
|
|
*/
|
|
changePassword(input: ChangePasswordRequest, options?: RpcOptions): UnaryCall<ChangePasswordRequest, ChangePasswordResponse> {
|
|
const method = this.methods[3], opt = this._transport.mergeOptions(options);
|
|
return stackIntercept<ChangePasswordRequest, ChangePasswordResponse>("unary", this._transport, method, opt, input);
|
|
}
|
|
}
|