thunder-bridge 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.d.cts DELETED
@@ -1,145 +0,0 @@
1
- import { T as ThunderBridge } from './rail-CqUfuYXJ.cjs';
2
- export { o as BlindLightningRailConfig, N as NwcConnection, p as NwcInvoice, q as NwcRailConfig, r as NwcVerifyConfig, s as Resolved, u as askWallet, v as blindLightningRail, w as invoiceFrom, x as nwcConnection, y as nwcHoldInvoice, z as nwcInvoice, A as nwcPay, D as nwcRail, E as nwcSettlement, G as nwcVerifyEndpoint, H as nwcVerifyUrl } from './rail-CqUfuYXJ.cjs';
3
-
4
- /** The wallet's own LUD-21 URL and the hash its preimage has to match */
5
- interface Relayed {
6
- url: string;
7
- hash: string;
8
- }
9
- interface LightningVerifyConfig {
10
- /** The secret the sealed wallet URL was made with, and nothing else uses it */
11
- secret: string;
12
- /**
13
- * How often you want the gateway to ask, in seconds. It goes out as
14
- * `Cache-Control: max-age`, so the pace is yours rather than the operator's.
15
- * Five by default, which is what a Lightning checkout wants
16
- */
17
- pollEverySecs?: number;
18
- }
19
- /**
20
- * A verify endpoint of your own that asks the recipient's wallet for you, so the
21
- * gateway polls you and never the wallet.
22
- *
23
- * `relayedVerifyUrl` seals the wallet's own LUD-21 URL into the query with your
24
- * secret, so what the gateway stores and replicates is opaque: not the wallet's
25
- * host, not which provider the recipient uses, nothing but a blob it cannot read.
26
- * This handler unseals it, asks the wallet, and answers the same LUD-21 shape.
27
- *
28
- * It relays rather than decides. The preimage still comes from the recipient's
29
- * own server and still has to hash to the payment hash, so standing between the
30
- * two buys privacy and pacing without becoming something anyone has to trust.
31
- *
32
- * A wallet it cannot reach answers `502` rather than "not settled", because those
33
- * are different claims and only one of them is true. The gateway logs a failed
34
- * poll and asks again, which is what a broken relay should look like.
35
- */
36
- declare function lightningVerifyEndpoint(config: LightningVerifyConfig): (request: Request) => Promise<Response>;
37
- /**
38
- * The URL to hand the gateway instead of the wallet's own, with the wallet's
39
- * sealed inside it. Point it at wherever `lightningVerifyEndpoint` is mounted
40
- */
41
- declare function relayedVerifyUrl(endpoint: string, wallet: Relayed, secret: string): Promise<string>;
42
-
43
- interface TriggerConfig {
44
- /** The gateway that quotes the addresses and mints the invoice */
45
- gateway: ThunderBridge;
46
- /** Priority list, quoted at payRequest and then pinned for the callback */
47
- lnAddresses: string[];
48
- /**
49
- * What this trigger costs right now, called once per payRequest. A plain
50
- * function, so a fiat peg or a time of day rule is just code you write
51
- */
52
- amountMsat: () => number | Promise<number>;
53
- /**
54
- * Signs the callback URL. Without it anyone could call the callback and make
55
- * this endpoint mint invoices on wallets of their choosing
56
- */
57
- secret: string;
58
- /** Groups every payment here so `followTrigger` can watch the place, keep it off the QR */
59
- watchSecret?: string;
60
- /**
61
- * How many settlements of this place the gateway keeps replayable past the hour
62
- * it would otherwise forget them in, up to the ceiling its operator set. What a
63
- * page that opens later still gets to see. Needs `watchSecret`
64
- */
65
- replay?: number;
66
- /** Override when a proxy hides the public URL from the request, no trailing slash */
67
- baseUrl?: string;
68
- /**
69
- * Resolve the address here and hand the gateway only a hash and a URL to poll,
70
- * instead of asking it to mint. It then cannot tell who is being paid beyond
71
- * the domain in the verify URL, nor how much at all, so the only refusal left
72
- * to it is refusing everyone. Costs one more round trip and gives up the
73
- * gateway's CORS proxying, which a server does not need anyway
74
- */
75
- blind?: boolean;
76
- /**
77
- * What the watcher needs and the gateway must not have. `data` returns it and
78
- * `secret` encrypts it, so there is no way to hand the gateway something it
79
- * can read. Needs 32 characters of randomness, not a passphrase, and every
80
- * watcher of this trigger holds the same one
81
- */
82
- sealed?: {
83
- secret: string;
84
- data: (minted: Minted) => unknown;
85
- };
86
- }
87
- interface Minted {
88
- lnAddress: string;
89
- amountMsat: number;
90
- bolt11: string;
91
- paymentHash: string;
92
- verifyUrl: string;
93
- expiresAt: number;
94
- }
95
- /**
96
- * A trigger's live stream is opened with a ticket rather than with the watch
97
- * secret, so something has to hold the secret and trade it for tickets. That is
98
- * what these two endpoints are, and they are the only place the gateway's token
99
- * has to be
100
- */
101
- interface WatchTicketConfig {
102
- /** The gateway that mints the ticket, holding the token this keeps off the wire */
103
- gateway: ThunderBridge;
104
- /** The trigger to open, the same secret `lnurlPayEndpoint` groups its payments under */
105
- watchSecret: string;
106
- /**
107
- * How many of this trigger's settlements the socket replays on connect, so a
108
- * page opened late still shows what it missed, up to the gateway's ceiling
109
- */
110
- replay?: number;
111
- }
112
- /**
113
- * An LNURL-pay endpoint standing in front of a priority list of addresses, as a
114
- * Fetch handler so it runs on Deno Deploy, Workers, Hono, Next and Node alike.
115
- *
116
- * It answers both halves of the flow on one path. A bare request is the
117
- * payRequest and quotes the list, and a signed one is the callback and mints.
118
- * The winner is chosen at payRequest and pinned into the callback URL because
119
- * LUD-06 binds the invoice to the metadata already served: if the callback
120
- * picked a different address the payer's wallet would refuse the invoice.
121
- *
122
- * Nothing is stored between the two, so this holds no state of its own.
123
- */
124
- declare function lnurlPayEndpoint(config: TriggerConfig): (request: Request) => Promise<Response>;
125
- /**
126
- * Trades the watch secret for a socket ticket, for a board that is not public.
127
- * The caller has to know the secret already, so all this adds is that the secret
128
- * stops travelling in socket URLs, where the gateway, every proxy in front of it
129
- * and the browser's own history all keep a copy. Anyone without it gets a 403.
130
- *
131
- * POST to it before every connect, because a ticket lives one minute.
132
- */
133
- declare function watchTicketEndpoint(config: WatchTicketConfig): (request: Request) => Promise<Response>;
134
- /**
135
- * Mints a socket ticket for anybody who asks, for a board meant to be read by
136
- * strangers. It reads no body and refuses nobody, which makes the trigger's
137
- * whole stream public: every viewer gets each settlement's preimage, verify url
138
- * and payment hash.
139
- *
140
- * Only for a trigger where that is the point. Gate anything on those preimages
141
- * and a viewer of the board is holding the unlock.
142
- */
143
- declare function publicWatchTicketEndpoint(config: WatchTicketConfig): (request: Request) => Promise<Response>;
144
-
145
- export { type LightningVerifyConfig, type Minted, type Relayed, type TriggerConfig, type WatchTicketConfig, lightningVerifyEndpoint, lnurlPayEndpoint, publicWatchTicketEndpoint, relayedVerifyUrl, watchTicketEndpoint };
package/dist/server.d.ts DELETED
@@ -1,145 +0,0 @@
1
- import { T as ThunderBridge } from './rail-CqUfuYXJ.js';
2
- export { o as BlindLightningRailConfig, N as NwcConnection, p as NwcInvoice, q as NwcRailConfig, r as NwcVerifyConfig, s as Resolved, u as askWallet, v as blindLightningRail, w as invoiceFrom, x as nwcConnection, y as nwcHoldInvoice, z as nwcInvoice, A as nwcPay, D as nwcRail, E as nwcSettlement, G as nwcVerifyEndpoint, H as nwcVerifyUrl } from './rail-CqUfuYXJ.js';
3
-
4
- /** The wallet's own LUD-21 URL and the hash its preimage has to match */
5
- interface Relayed {
6
- url: string;
7
- hash: string;
8
- }
9
- interface LightningVerifyConfig {
10
- /** The secret the sealed wallet URL was made with, and nothing else uses it */
11
- secret: string;
12
- /**
13
- * How often you want the gateway to ask, in seconds. It goes out as
14
- * `Cache-Control: max-age`, so the pace is yours rather than the operator's.
15
- * Five by default, which is what a Lightning checkout wants
16
- */
17
- pollEverySecs?: number;
18
- }
19
- /**
20
- * A verify endpoint of your own that asks the recipient's wallet for you, so the
21
- * gateway polls you and never the wallet.
22
- *
23
- * `relayedVerifyUrl` seals the wallet's own LUD-21 URL into the query with your
24
- * secret, so what the gateway stores and replicates is opaque: not the wallet's
25
- * host, not which provider the recipient uses, nothing but a blob it cannot read.
26
- * This handler unseals it, asks the wallet, and answers the same LUD-21 shape.
27
- *
28
- * It relays rather than decides. The preimage still comes from the recipient's
29
- * own server and still has to hash to the payment hash, so standing between the
30
- * two buys privacy and pacing without becoming something anyone has to trust.
31
- *
32
- * A wallet it cannot reach answers `502` rather than "not settled", because those
33
- * are different claims and only one of them is true. The gateway logs a failed
34
- * poll and asks again, which is what a broken relay should look like.
35
- */
36
- declare function lightningVerifyEndpoint(config: LightningVerifyConfig): (request: Request) => Promise<Response>;
37
- /**
38
- * The URL to hand the gateway instead of the wallet's own, with the wallet's
39
- * sealed inside it. Point it at wherever `lightningVerifyEndpoint` is mounted
40
- */
41
- declare function relayedVerifyUrl(endpoint: string, wallet: Relayed, secret: string): Promise<string>;
42
-
43
- interface TriggerConfig {
44
- /** The gateway that quotes the addresses and mints the invoice */
45
- gateway: ThunderBridge;
46
- /** Priority list, quoted at payRequest and then pinned for the callback */
47
- lnAddresses: string[];
48
- /**
49
- * What this trigger costs right now, called once per payRequest. A plain
50
- * function, so a fiat peg or a time of day rule is just code you write
51
- */
52
- amountMsat: () => number | Promise<number>;
53
- /**
54
- * Signs the callback URL. Without it anyone could call the callback and make
55
- * this endpoint mint invoices on wallets of their choosing
56
- */
57
- secret: string;
58
- /** Groups every payment here so `followTrigger` can watch the place, keep it off the QR */
59
- watchSecret?: string;
60
- /**
61
- * How many settlements of this place the gateway keeps replayable past the hour
62
- * it would otherwise forget them in, up to the ceiling its operator set. What a
63
- * page that opens later still gets to see. Needs `watchSecret`
64
- */
65
- replay?: number;
66
- /** Override when a proxy hides the public URL from the request, no trailing slash */
67
- baseUrl?: string;
68
- /**
69
- * Resolve the address here and hand the gateway only a hash and a URL to poll,
70
- * instead of asking it to mint. It then cannot tell who is being paid beyond
71
- * the domain in the verify URL, nor how much at all, so the only refusal left
72
- * to it is refusing everyone. Costs one more round trip and gives up the
73
- * gateway's CORS proxying, which a server does not need anyway
74
- */
75
- blind?: boolean;
76
- /**
77
- * What the watcher needs and the gateway must not have. `data` returns it and
78
- * `secret` encrypts it, so there is no way to hand the gateway something it
79
- * can read. Needs 32 characters of randomness, not a passphrase, and every
80
- * watcher of this trigger holds the same one
81
- */
82
- sealed?: {
83
- secret: string;
84
- data: (minted: Minted) => unknown;
85
- };
86
- }
87
- interface Minted {
88
- lnAddress: string;
89
- amountMsat: number;
90
- bolt11: string;
91
- paymentHash: string;
92
- verifyUrl: string;
93
- expiresAt: number;
94
- }
95
- /**
96
- * A trigger's live stream is opened with a ticket rather than with the watch
97
- * secret, so something has to hold the secret and trade it for tickets. That is
98
- * what these two endpoints are, and they are the only place the gateway's token
99
- * has to be
100
- */
101
- interface WatchTicketConfig {
102
- /** The gateway that mints the ticket, holding the token this keeps off the wire */
103
- gateway: ThunderBridge;
104
- /** The trigger to open, the same secret `lnurlPayEndpoint` groups its payments under */
105
- watchSecret: string;
106
- /**
107
- * How many of this trigger's settlements the socket replays on connect, so a
108
- * page opened late still shows what it missed, up to the gateway's ceiling
109
- */
110
- replay?: number;
111
- }
112
- /**
113
- * An LNURL-pay endpoint standing in front of a priority list of addresses, as a
114
- * Fetch handler so it runs on Deno Deploy, Workers, Hono, Next and Node alike.
115
- *
116
- * It answers both halves of the flow on one path. A bare request is the
117
- * payRequest and quotes the list, and a signed one is the callback and mints.
118
- * The winner is chosen at payRequest and pinned into the callback URL because
119
- * LUD-06 binds the invoice to the metadata already served: if the callback
120
- * picked a different address the payer's wallet would refuse the invoice.
121
- *
122
- * Nothing is stored between the two, so this holds no state of its own.
123
- */
124
- declare function lnurlPayEndpoint(config: TriggerConfig): (request: Request) => Promise<Response>;
125
- /**
126
- * Trades the watch secret for a socket ticket, for a board that is not public.
127
- * The caller has to know the secret already, so all this adds is that the secret
128
- * stops travelling in socket URLs, where the gateway, every proxy in front of it
129
- * and the browser's own history all keep a copy. Anyone without it gets a 403.
130
- *
131
- * POST to it before every connect, because a ticket lives one minute.
132
- */
133
- declare function watchTicketEndpoint(config: WatchTicketConfig): (request: Request) => Promise<Response>;
134
- /**
135
- * Mints a socket ticket for anybody who asks, for a board meant to be read by
136
- * strangers. It reads no body and refuses nobody, which makes the trigger's
137
- * whole stream public: every viewer gets each settlement's preimage, verify url
138
- * and payment hash.
139
- *
140
- * Only for a trigger where that is the point. Gate anything on those preimages
141
- * and a viewer of the board is holding the unlock.
142
- */
143
- declare function publicWatchTicketEndpoint(config: WatchTicketConfig): (request: Request) => Promise<Response>;
144
-
145
- export { type LightningVerifyConfig, type Minted, type Relayed, type TriggerConfig, type WatchTicketConfig, lightningVerifyEndpoint, lnurlPayEndpoint, publicWatchTicketEndpoint, relayedVerifyUrl, watchTicketEndpoint };