thunder-bridge 1.4.0 → 1.4.1

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.
Files changed (2) hide show
  1. package/openapi.yaml +84 -3
  2. package/package.json +1 -1
package/openapi.yaml CHANGED
@@ -2,7 +2,7 @@ openapi: 3.1.0
2
2
 
3
3
  info:
4
4
  title: thunder-bridge, the endpoint your own service serves
5
- version: 1.2.0
5
+ version: 1.4.1
6
6
  license:
7
7
  name: MIT
8
8
  identifier: MIT
@@ -26,8 +26,12 @@ info:
26
26
 
27
27
  `bankVerifyEndpoint` is the other handler, and it puts a second rail behind the same
28
28
  contract: a bank transfer, proved to the gateway by the LUD-21 shape a Lightning wallet
29
- would have answered with. Both paths below are therefore yours to mount and yours to
30
- serve, and neither of them is the gateway.
29
+ would have answered with.
30
+
31
+ `watchTicketEndpoint` and `publicWatchTicketEndpoint` are the third, and they exist so a
32
+ browser can read a trigger's live stream without holding the credentials that open it.
33
+ Every path below is therefore yours to mount and yours to serve, and none of them is the
34
+ gateway.
31
35
 
32
36
  The gateway's own API is a separate document, `openapi.yaml` in the repository root, and
33
37
  the webhook your server receives is described there under `webhooks`.
@@ -43,6 +47,8 @@ tags:
43
47
  description: The two halves of LUD-06, on the one path a lightning address resolves to.
44
48
  - name: bank-transfer
45
49
  description: The settlement proof for money that arrived over a bank rail instead of Lightning.
50
+ - name: live-board
51
+ description: The exchange that lets a page watch a trigger without being given its secret.
46
52
 
47
53
  paths:
48
54
  /.well-known/lnurlp/{name}:
@@ -137,6 +143,57 @@ paths:
137
143
  - $ref: "#/components/schemas/invoice"
138
144
  - $ref: "#/components/schemas/refusal"
139
145
 
146
+ /watch/ticket:
147
+ post:
148
+ tags: [live-board]
149
+ operationId: mintWatchTicket
150
+ summary: Trade the watch secret for a socket ticket a browser may hold
151
+ description: |
152
+ Mounted wherever you like by `watchTicketEndpoint`, or by
153
+ `publicWatchTicketEndpoint` when the board is meant to be read by strangers. Which
154
+ one you mounted is the whole difference: the first compares the offered secret in
155
+ constant time and answers 403 without it, the second reads no body and refuses
156
+ nobody.
157
+
158
+ It exists because the socket is opened at the gateway's `/ws/tickets/{ticket}`, and
159
+ minting a ticket needs the bearer token and the watch secret. Neither may reach a
160
+ browser, so this endpoint holds both and hands back only the ticket, which opens one
161
+ trigger and nothing else.
162
+
163
+ The answer is the gateway's own, passed through unchanged. A ticket lives one minute,
164
+ so a page POSTs here immediately before every connect rather than caching one.
165
+
166
+ A public board is public in full. Every viewer of that socket gets each settlement's
167
+ preimage, verify url and payment hash, which is fine for a tip jar and wrong the
168
+ moment anything is gated behind those preimages.
169
+ requestBody:
170
+ required: false
171
+ content:
172
+ application/json:
173
+ schema:
174
+ type: object
175
+ properties:
176
+ secret:
177
+ type: string
178
+ description: |
179
+ The same watch secret the trigger groups its payments under. Required by
180
+ `watchTicketEndpoint` and ignored by `publicWatchTicketEndpoint`.
181
+ responses:
182
+ "200":
183
+ description: A ticket, good for one socket on one trigger for one minute.
184
+ content:
185
+ application/json:
186
+ schema:
187
+ $ref: "#/components/schemas/socket_ticket"
188
+ "403":
189
+ description: |
190
+ The body did not carry the watch secret. Never answered by
191
+ `publicWatchTicketEndpoint`, which does not read one.
192
+ content:
193
+ application/json:
194
+ schema:
195
+ $ref: "#/components/schemas/not_the_secret"
196
+
140
197
  /verify/bank:
141
198
  get:
142
199
  tags: [bank-transfer]
@@ -274,6 +331,30 @@ components:
274
331
  const: false
275
332
  required: [settled]
276
333
 
334
+ socket_ticket:
335
+ type: object
336
+ description: The gateway's ticket, passed through so a page reading `.ticket` needs no change.
337
+ properties:
338
+ ticket:
339
+ type: string
340
+ description: |
341
+ Goes in the gateway's `/ws/tickets/{ticket}` path. Signed, not stored, and bound
342
+ to the one trigger it was minted for.
343
+ expires_at:
344
+ type: string
345
+ format: date-time
346
+ description: A minute from minting. A ticket presented after it is refused at the handshake.
347
+ required: [ticket, expires_at]
348
+
349
+ not_the_secret:
350
+ type: object
351
+ description: A refusal that says only that the secret was wrong, never what was expected.
352
+ properties:
353
+ reason:
354
+ type: string
355
+ const: not the watch secret
356
+ required: [reason]
357
+
277
358
  ln_address:
278
359
  type: string
279
360
  format: email
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thunder-bridge",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Trustless JavaScript client for the Thunder Bridge Lightning payment gateway. Proves the invoice came from your own wallet before the payer sees it.",
5
5
  "author": "i-am-fatik",
6
6
  "homepage": "https://agora.gripe/en/tools/thunder-bridge",