lnurlcash-kit 0.2.0 → 0.2.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
@@ -3,6 +3,23 @@
3
3
  Semantic versioning. While the LUD-25 draft is unmerged, `0.x` minor bumps
4
4
  may carry breaking changes; pin an exact version.
5
5
 
6
+ ## 0.2.1 - 2026-08-22
7
+
8
+ - `WithdrawRequestInfo` carries `payLink`, the way home a SERVICE may
9
+ publish on a note's informational GET. It is the reverse of the
10
+ `withdrawLink` a payRequest advertises, and it is the only route a
11
+ bearer-note wallet has to a mint's discovery document: the document lives
12
+ under a username the note never mentions and cannot be guessed from the
13
+ callback. Without it, a WALLET that has only ever received notes cannot
14
+ read the mint's `previousPubkeys`, so an announced key rotation is
15
+ indistinguishable from a substituted key and gets refused.
16
+ - A `payLink` on any origin but the note's own is dropped rather than
17
+ passed on, so a caller can treat its presence as the fact it looks like.
18
+ Whoever controls the host controls the pin anyway, which is TOFU's own
19
+ argument, but that argument does not stretch to letting a SERVICE
20
+ nominate a THIRD party to vouch for its key history, and refusing costs
21
+ nothing.
22
+
6
23
  ## 0.2.0 - 2026-08-22
7
24
 
8
25
  ### Deterministic note secrets and restore from a seed
package/dist/index.d.ts CHANGED
@@ -39,6 +39,7 @@ type WithdrawRequestInfo = {
39
39
  maxWithdrawable: number;
40
40
  defaultDescription?: string;
41
41
  mintPubkey?: string;
42
+ payLink?: string;
42
43
  };
43
44
  declare const fetchNoteInfo: (url: string, options?: LnurlcashOptions) => Promise<WithdrawRequestInfo>;
44
45
  declare const probeBurnedNote: (url: string, options?: LnurlcashOptions) => Promise<"live" | "gone" | "unknown">;
package/dist/index.js CHANGED
@@ -649,7 +649,22 @@ var fetchNoteInfo = async (url, options = {}) => {
649
649
  "The service echoed back a different k1 than was queried - the note may have been redeemed elsewhere, or the service isn't spec-compliant."
650
650
  );
651
651
  }
652
- return body;
652
+ const info = body;
653
+ const payLink = sameOriginPayLink(body.payLink, reqUrl);
654
+ if (payLink === void 0) delete info.payLink;
655
+ else info.payLink = payLink;
656
+ return info;
657
+ };
658
+ var sameOriginPayLink = (value, noteUrl) => {
659
+ if (typeof value !== "string" || value.length === 0) return void 0;
660
+ let candidate;
661
+ try {
662
+ candidate = new URL(value, noteUrl);
663
+ } catch {
664
+ return void 0;
665
+ }
666
+ if (candidate.origin !== noteUrl.origin) return void 0;
667
+ return candidate.toString();
653
668
  };
654
669
  var probeBurnedNote = async (url, options = {}) => {
655
670
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lnurlcash-kit",
3
- "version": "0.2.0",
3
+ "version": "0.2.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",
@@ -60,7 +60,7 @@
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/node": "^26.2.0",
63
- "lnurlcash-conformance": "^0.1.1",
63
+ "lnurlcash-conformance": "^0.2.2",
64
64
  "tsup": "^8.5.0",
65
65
  "typescript": "^5.7.0",
66
66
  "vitest": "^3.0.0"