feat: Lightning zap — send sats to a DID#155
Merged
Conversation
Adds publish-lightning, unpublish-lightning, and lightning-zap commands. Recipients publish a Lightning service endpoint in their DID document; senders resolve the DID, request an invoice from the endpoint, and pay it. Closes #154 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds tests for addPollVoter, removePollVoter, listPollVoters, and options variants for getVault, listVaultItems, getVaultItem, getDmailMessage, and listDmailAttachments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end support for “Lightning zaps” to a DID by publishing a Lightning service endpoint in the DID document, enabling unauthenticated invoice generation on Drawbridge, and adding Keymaster APIs/CLI commands to publish/unpublish and pay invoices.
Changes:
- Add
publish-lightning,unpublish-lightning, andlightning-zapacross Keymaster library, Keymaster server API, Keymaster client, and CLI. - Add Drawbridge support for storing published invoice keys and serving a public
GET /invoice/:did?amount=...invoice endpoint. - Extend DID document typing to include a W3C DID Core
servicearray and add/extend tests.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/keymaster/lightning.test.ts | Adds unit tests for publish/unpublish and zap flows. |
| tests/keymaster/client.test.ts | Adds client tests for new lightning endpoints (plus additional coverage for existing non-lightning methods). |
| services/keymaster/server/src/keymaster-api.ts | Exposes /lightning/publish, /lightning/unpublish, and /lightning/zap endpoints. |
| services/drawbridge/server/src/types.ts | Extends Drawbridge store interface for published Lightning mappings. |
| services/drawbridge/server/src/store.ts | Implements published Lightning persistence in Redis. |
| services/drawbridge/server/src/drawbridge-api.ts | Adds publish/unpublish routes and public invoice generation endpoint. |
| services/drawbridge/server/src/config.ts | Introduces publicHost config knob (currently unused). |
| sample.env | Documents ARCHON_DRAWBRIDGE_PUBLIC_HOST. |
| packages/keymaster/src/types.ts | Extends public Keymaster interface with publish/unpublish/zap methods. |
| packages/keymaster/src/keymaster.ts | Implements publish/unpublish (DID service mutation) and zap (resolve → fetch invoice → pay). |
| packages/keymaster/src/keymaster-client.ts | Adds client wrappers for publish/unpublish/zap API calls. |
| packages/keymaster/src/cli.ts | Adds CLI commands for publish/unpublish and lightning-zap. |
| packages/gatekeeper/src/types.ts | Adds DrawbridgeInterface methods + DidCidDocument.service typing. |
| packages/gatekeeper/src/drawbridge-client.ts | Adds Drawbridge client calls for publish/unpublish. |
| docker-compose.drawbridge.yml | Wires ARCHON_DRAWBRIDGE_PUBLIC_HOST into Drawbridge container env. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Drawbridge now auto-discovers its .onion address via a shared Docker volume and returns it when publishing Lightning service endpoints. Zap requests route through Tor SOCKS proxy for .onion endpoints. Renamed lightningZap to zapLightning and added alias support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 20 changed files in this pull request and generated 7 comments.
Files not reviewed (2)
- services/drawbridge/server/package-lock.json: Language not supported
- services/keymaster/server/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add optional memo to zapLightning across all layers - Safe req.body?.id on publish/unpublish API routes - Thread payer identity (id) through zap API route and client - Validate amount as positive integer on Drawbridge zap endpoint - Add SSRF protection: enforce https for non-.onion, block private IPs - Use dynamic port in entrypoint Tor hostname fallback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
publish-lightning/unpublish-lightningcommands to register a DID's invoiceKey on Drawbridge and publish a Lightning service endpoint in the DID documentlightning-zap <did> <amount>command to send sats to any DID with a published Lightning endpointGET /invoice/:did?amount=Xendpoint on Drawbridge for unauthenticated invoice generationservicearray toDidCidDocumenttypeTest plan
publish-lightningregisters invoiceKey on Drawbridge and adds service endpoint to DID docresolve-didshows the Lightning service endpointlightning-zap scully 25successfully creates invoice and pays itCloses #154
🤖 Generated with Claude Code