- FIXED: Rewrote BOLT11 decoder (
decodeBolt11) to use proper bech32 HRP/separator parsing —extractPaymentHashFromBolt11andextractTimestampFromBolt11previously returnednull/0on valid invoices (verified against the official BOLT11 test vector) - Added network validation — invoices are checked against the configured
network(mainnetdefault, alsotestnet/regtest) in both webhook and relay payment paths - Added invoice expiry validation — expired invoices are rejected (default 3600s if no
xtag) - Added SSRF protection for relay URLs —
isAllowedRelayUrlrejects non-wss/ws schemes, localhost, private/loopback/link-local IPs; applied to subscribe, publish, key generation, and payment handler - Relay settlement now requires preimage + bolt11 proof and verifies the payment hash —
res:"ok"without proof is refused - Atomic status transitions — offer settlement/expiry updates are conditional on
status: 'pending'and re-checked - Added Nostr event kind (
21001) andp-tag correlation checks before processing relay events
- New
networkconfig option:'mainnet' | 'testnet' | 'regtest'(defaultmainnet) NostrKeyServiceandClinkServicethrow when all configured relay URLs are blocked
- CRITICAL: Added HMAC-SHA256 signature verification for all webhook endpoints (
x-clink-signatureheader) - CRITICAL: Added preimage verification —
sha256(preimage) === payment_hashis now enforced before settling - Added BOLT11 invoice decoding to extract payment hash and amount for verification
- Added amount validation — bolt11 invoice amount must match offer amount
- Added Nostr event signature verification (
verifyEvent) for relay payments - Added
webhookSecretconfig option — required whenhttpFallbackis enabled
- Webhook endpoints now reject all requests without valid HMAC signature
- Webhook endpoints now reject requests without preimage verification
- Initial release of the Bitcoin Lightning CLINK plugin for Vendure
ClinkPaymentHandler— asynchronous payment handler with BTC price oracleClinkPaymentProcess— custom payment state machine (Created → Pending → Settled/Error/Cancelled)OracleService— BTC/USD price oracle with CoinGecko, Kraken, and custom providers- Per-channel Nostr keypair generation and relay configuration
- Shop API: create payment offers, poll payment status
- Admin API: configure CLINK settings, manage offers, test oracle providers
- HTTP webhook fallback for wallets without Nostr support
- Storefront React component (
ClinkPayment) - Comprehensive unit tests (43 tests)