thunder-bridge 0.8.2 → 0.8.3

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.
@@ -0,0 +1,64 @@
1
+ import { T as ThunderBridge } from './rail-Cyc5zTtA.cjs';
2
+ export { k as BlindLightningRailConfig, m as blindLightningRail } from './rail-Cyc5zTtA.cjs';
3
+
4
+ interface TriggerConfig {
5
+ /** The gateway that quotes the addresses and mints the invoice */
6
+ gateway: ThunderBridge;
7
+ /** Priority list, quoted at payRequest and then pinned for the callback */
8
+ lnAddresses: string[];
9
+ /**
10
+ * What this trigger costs right now, called once per payRequest. A plain
11
+ * function, so a fiat peg or a time of day rule is just code you write
12
+ */
13
+ amountMsat: () => number | Promise<number>;
14
+ /**
15
+ * Signs the callback URL. Without it anyone could call the callback and make
16
+ * this endpoint mint invoices on wallets of their choosing
17
+ */
18
+ secret: string;
19
+ /** Groups every payment here so `followTrigger` can watch the place, keep it off the QR */
20
+ watchSecret?: string;
21
+ /** Override when a proxy hides the public URL from the request, no trailing slash */
22
+ baseUrl?: string;
23
+ /**
24
+ * Resolve the address here and hand the gateway only a hash and a URL to poll,
25
+ * instead of asking it to mint. It then cannot tell who is being paid beyond
26
+ * the domain in the verify URL, nor how much at all, so the only refusal left
27
+ * to it is refusing everyone. Costs one more round trip and gives up the
28
+ * gateway's CORS proxying, which a server does not need anyway
29
+ */
30
+ blind?: boolean;
31
+ /**
32
+ * What the watcher needs and the gateway must not have. `data` returns it and
33
+ * `secret` encrypts it, so there is no way to hand the gateway something it
34
+ * can read. Needs 32 characters of randomness, not a passphrase, and every
35
+ * watcher of this trigger holds the same one
36
+ */
37
+ sealed?: {
38
+ secret: string;
39
+ data: (minted: Minted) => unknown;
40
+ };
41
+ }
42
+ interface Minted {
43
+ lnAddress: string;
44
+ amountMsat: number;
45
+ bolt11: string;
46
+ paymentHash: string;
47
+ verifyUrl: string;
48
+ expiresAt: number;
49
+ }
50
+ /**
51
+ * An LNURL-pay endpoint standing in front of a priority list of addresses, as a
52
+ * Fetch handler so it runs on Deno Deploy, Workers, Hono, Next and Node alike.
53
+ *
54
+ * It answers both halves of the flow on one path. A bare request is the
55
+ * payRequest and quotes the list, and a signed one is the callback and mints.
56
+ * The winner is chosen at payRequest and pinned into the callback URL because
57
+ * LUD-06 binds the invoice to the metadata already served: if the callback
58
+ * picked a different address the payer's wallet would refuse the invoice.
59
+ *
60
+ * Nothing is stored between the two, so this holds no state of its own.
61
+ */
62
+ declare function lnurlPayEndpoint(config: TriggerConfig): (request: Request) => Promise<Response>;
63
+
64
+ export { type Minted, type TriggerConfig, lnurlPayEndpoint };
@@ -0,0 +1,64 @@
1
+ import { T as ThunderBridge } from './rail-Cyc5zTtA.js';
2
+ export { k as BlindLightningRailConfig, m as blindLightningRail } from './rail-Cyc5zTtA.js';
3
+
4
+ interface TriggerConfig {
5
+ /** The gateway that quotes the addresses and mints the invoice */
6
+ gateway: ThunderBridge;
7
+ /** Priority list, quoted at payRequest and then pinned for the callback */
8
+ lnAddresses: string[];
9
+ /**
10
+ * What this trigger costs right now, called once per payRequest. A plain
11
+ * function, so a fiat peg or a time of day rule is just code you write
12
+ */
13
+ amountMsat: () => number | Promise<number>;
14
+ /**
15
+ * Signs the callback URL. Without it anyone could call the callback and make
16
+ * this endpoint mint invoices on wallets of their choosing
17
+ */
18
+ secret: string;
19
+ /** Groups every payment here so `followTrigger` can watch the place, keep it off the QR */
20
+ watchSecret?: string;
21
+ /** Override when a proxy hides the public URL from the request, no trailing slash */
22
+ baseUrl?: string;
23
+ /**
24
+ * Resolve the address here and hand the gateway only a hash and a URL to poll,
25
+ * instead of asking it to mint. It then cannot tell who is being paid beyond
26
+ * the domain in the verify URL, nor how much at all, so the only refusal left
27
+ * to it is refusing everyone. Costs one more round trip and gives up the
28
+ * gateway's CORS proxying, which a server does not need anyway
29
+ */
30
+ blind?: boolean;
31
+ /**
32
+ * What the watcher needs and the gateway must not have. `data` returns it and
33
+ * `secret` encrypts it, so there is no way to hand the gateway something it
34
+ * can read. Needs 32 characters of randomness, not a passphrase, and every
35
+ * watcher of this trigger holds the same one
36
+ */
37
+ sealed?: {
38
+ secret: string;
39
+ data: (minted: Minted) => unknown;
40
+ };
41
+ }
42
+ interface Minted {
43
+ lnAddress: string;
44
+ amountMsat: number;
45
+ bolt11: string;
46
+ paymentHash: string;
47
+ verifyUrl: string;
48
+ expiresAt: number;
49
+ }
50
+ /**
51
+ * An LNURL-pay endpoint standing in front of a priority list of addresses, as a
52
+ * Fetch handler so it runs on Deno Deploy, Workers, Hono, Next and Node alike.
53
+ *
54
+ * It answers both halves of the flow on one path. A bare request is the
55
+ * payRequest and quotes the list, and a signed one is the callback and mints.
56
+ * The winner is chosen at payRequest and pinned into the callback URL because
57
+ * LUD-06 binds the invoice to the metadata already served: if the callback
58
+ * picked a different address the payer's wallet would refuse the invoice.
59
+ *
60
+ * Nothing is stored between the two, so this holds no state of its own.
61
+ */
62
+ declare function lnurlPayEndpoint(config: TriggerConfig): (request: Request) => Promise<Response>;
63
+
64
+ export { type Minted, type TriggerConfig, lnurlPayEndpoint };