lnurlcash-kit 0.8.0 → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.8.1 - 2026-09-04
6
+
7
+ **`settleNote` could report a burned note as settled, losing it outright.**
8
+ Settling reads what a split's change or a merge's output is really worth, which
9
+ puts `k1` on the wire, so a rotate follows to replace the secret it just
10
+ exposed. That rotate is best-effort by design: a SERVICE that refuses it has
11
+ burned nothing, so keeping the exposed `k1` beats failing the whole settle.
12
+
13
+ The fallback was a bare `catch`, which also covered a rotate that MAY HAVE
14
+ LANDED - an ambiguous one, an unverifiable one, or a spent-or-unknown refusal,
15
+ which is exactly what a mutation the SERVICE already applied looks like asked a
16
+ second time. In every one of those the SERVICE had burned the `k1` being
17
+ returned and minted a note under `h`, and the fresh secret `rotateNote()`
18
+ attaches to the error was the only copy of it anywhere. Discarding it handed
19
+ back a dead secret shaped like a success and dropped the live one.
20
+
21
+ - `settleNote` now rethrows anything that could describe an applied mutation:
22
+ `AmbiguousMintError`, and any error carrying `newSecretsOf(err)`. Only a
23
+ refusal that burned nothing still returns the exposed `k1`.
24
+ - It also rethrows anything that is not an `LnurlcashError`. The bare `catch`
25
+ swallowed `TypeError` and friends alongside the protocol errors the fallback
26
+ was for, so a bug in this library was reported as a settled note too.
27
+ - **Behavioural change, no API change.** A caller that treated `settleNote` as
28
+ something that never throws now sees these errors. That is the point: each
29
+ one carries secrets that must be persisted before anything else.
30
+ - Fixed in the sibling implementations the same day - Rust, Go, Python and
31
+ Kotlin all carried it.
32
+
5
33
  ## 0.8.0 - 2026-09-04
6
34
 
7
35
  **LUD-25's own derivation, and it is now the one to mint under.** The draft's
package/dist/index.js CHANGED
@@ -1179,7 +1179,13 @@ var settleNote = async (baseUrl, k1, expectedAmountMsat, signature, options = {}
1179
1179
  signature: rotated.signature,
1180
1180
  callback: info.callback
1181
1181
  };
1182
- } catch {
1182
+ } catch (err) {
1183
+ if (err instanceof AmbiguousMintError || newSecretsOf(err).length > 0) {
1184
+ throw err;
1185
+ }
1186
+ if (!(err instanceof LnurlcashError)) {
1187
+ throw err;
1188
+ }
1183
1189
  return {
1184
1190
  k1,
1185
1191
  amountMsat: info.maxWithdrawable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lnurlcash-kit",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "LNURLcash (LUD-25) bearer note client for TypeScript - mint, rotate, split, merge, melt, and verify offline",
5
5
  "author": "TheCryptoDonkey",
6
6
  "license": "MIT",