@unicitylabs/sphere-sdk 0.14.1-dev.2 → 0.14.2

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 (39) hide show
  1. package/dist/connect/index.cjs +1 -1
  2. package/dist/connect/index.cjs.map +1 -1
  3. package/dist/connect/index.js +1 -1
  4. package/dist/connect/index.js.map +1 -1
  5. package/dist/core/index.cjs +69 -27
  6. package/dist/core/index.cjs.map +1 -1
  7. package/dist/core/index.d.cts +21 -1
  8. package/dist/core/index.d.ts +21 -1
  9. package/dist/core/index.js +69 -27
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/impl/browser/connect/index.cjs +1 -1
  12. package/dist/impl/browser/connect/index.cjs.map +1 -1
  13. package/dist/impl/browser/connect/index.js +1 -1
  14. package/dist/impl/browser/connect/index.js.map +1 -1
  15. package/dist/impl/browser/index.cjs +33 -0
  16. package/dist/impl/browser/index.cjs.map +1 -1
  17. package/dist/impl/browser/index.js +33 -0
  18. package/dist/impl/browser/index.js.map +1 -1
  19. package/dist/impl/nodejs/index.cjs +33 -0
  20. package/dist/impl/nodejs/index.cjs.map +1 -1
  21. package/dist/impl/nodejs/index.d.cts +41 -1
  22. package/dist/impl/nodejs/index.d.ts +41 -1
  23. package/dist/impl/nodejs/index.js +33 -0
  24. package/dist/impl/nodejs/index.js.map +1 -1
  25. package/dist/impl/shared/wallet-api/index.d.cts +21 -1
  26. package/dist/impl/shared/wallet-api/index.d.ts +21 -1
  27. package/dist/index.cjs +69 -27
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +21 -1
  30. package/dist/index.d.ts +21 -1
  31. package/dist/index.js +69 -27
  32. package/dist/index.js.map +1 -1
  33. package/dist/modules/payments-v2/index.cjs +36 -26
  34. package/dist/modules/payments-v2/index.cjs.map +1 -1
  35. package/dist/modules/payments-v2/index.d.cts +16 -6
  36. package/dist/modules/payments-v2/index.d.ts +16 -6
  37. package/dist/modules/payments-v2/index.js +35 -26
  38. package/dist/modules/payments-v2/index.js.map +1 -1
  39. package/package.json +1 -1
@@ -1175,6 +1175,15 @@ function defaultUUIDGenerator() {
1175
1175
  var COMPOSING_INDICATOR_KIND = 25050;
1176
1176
  var TIMESTAMP_RANDOMIZATION = 2 * 24 * 60 * 60;
1177
1177
  var EVENT_KINDS = NOSTR_EVENT_KINDS;
1178
+ function declaredNetwork(event) {
1179
+ let value;
1180
+ try {
1181
+ value = JSON.parse(event.content)?.network;
1182
+ } catch {
1183
+ return void 0;
1184
+ }
1185
+ return typeof value === "string" && value !== "" ? value : void 0;
1186
+ }
1178
1187
  var NostrTransportProvider = class _NostrTransportProvider {
1179
1188
  id = "nostr";
1180
1189
  name = "Nostr Transport";
@@ -1671,6 +1680,26 @@ var NostrTransportProvider = class _NostrTransportProvider {
1671
1680
  }
1672
1681
  /**
1673
1682
  * Convert a BindingInfo (from nostr-js-sdk) to PeerInfo (sphere-sdk type).
1683
+ *
1684
+ * `network` IS DELIBERATELY ABSENT HERE — a live limitation, not an oversight
1685
+ * (#734). `queryBindingByNametag`/`queryBindingByAddress` are the whole public
1686
+ * resolution API for `@nametag` and `DIRECT://`, and both hardcode
1687
+ * `parseBindingInfo` inside the SDK's PRIVATE `queryWithFirstSeenWins`: the
1688
+ * caller never sees the signed event that resolution selected, and the parse
1689
+ * has already dropped every content field outside its whitelist. Re-querying
1690
+ * raw would mean re-deriving UNIP-01 ownership ourselves (marker preference,
1691
+ * cross-author first-seen-wins, ambiguity→null, multi-relay settle — all
1692
+ * private), and a second resolver that can disagree with the SDK's is worse
1693
+ * than a missing field on a MONEY guard. Nothing can declare a network today
1694
+ * regardless: the publish builders whitelist the same fields.
1695
+ *
1696
+ * CONSEQUENCE, stated plainly: for `@nametag` and `DIRECT://` recipients the
1697
+ * §5.6 cross-network guard can only SIGNAL (`recipient:network-unverified`),
1698
+ * never refuse. Upstream #734 must add `network` to the binding builders AND
1699
+ * to `BindingInfo`; the tripwire in
1700
+ * tests/unit/payments-v2/recipient-network.transport.test.ts fails the day it
1701
+ * lands, so this wiring cannot be forgotten. Do not "fix" this by inventing a
1702
+ * value — a stamped network is what made the guard unfalsifiable (#733).
1674
1703
  */
1675
1704
  async bindingInfoToPeerInfo(binding, nametag) {
1676
1705
  return {
@@ -1697,11 +1726,13 @@ var NostrTransportProvider = class _NostrTransportProvider {
1697
1726
  const bindingEvent = events[0];
1698
1727
  try {
1699
1728
  const content = JSON.parse(bindingEvent.content);
1729
+ const network = declaredNetwork(bindingEvent);
1700
1730
  return {
1701
1731
  nametag: content.nametag || void 0,
1702
1732
  transportPubkey: bindingEvent.pubkey,
1703
1733
  chainPubkey: content.public_key || "",
1704
1734
  directAddress: content.direct_address || "",
1735
+ ...network !== void 0 ? { network } : {},
1705
1736
  timestamp: bindingEvent.created_at * 1e3
1706
1737
  };
1707
1738
  } catch {
@@ -1737,11 +1768,13 @@ var NostrTransportProvider = class _NostrTransportProvider {
1737
1768
  for (const [pubkey, event] of byAuthor) {
1738
1769
  try {
1739
1770
  const content = JSON.parse(event.content);
1771
+ const network = declaredNetwork(event);
1740
1772
  results.push({
1741
1773
  nametag: content.nametag || void 0,
1742
1774
  transportPubkey: pubkey,
1743
1775
  chainPubkey: content.public_key || "",
1744
1776
  directAddress: content.direct_address || "",
1777
+ ...network !== void 0 ? { network } : {},
1745
1778
  timestamp: event.created_at * 1e3
1746
1779
  });
1747
1780
  } catch {