@unicitylabs/sphere-sdk 0.14.1 → 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
@@ -24457,6 +24457,15 @@ function defaultUUIDGenerator() {
24457
24457
  var COMPOSING_INDICATOR_KIND = 25050;
24458
24458
  var TIMESTAMP_RANDOMIZATION = 2 * 24 * 60 * 60;
24459
24459
  var EVENT_KINDS = NOSTR_EVENT_KINDS;
24460
+ function declaredNetwork(event) {
24461
+ let value;
24462
+ try {
24463
+ value = JSON.parse(event.content)?.network;
24464
+ } catch {
24465
+ return void 0;
24466
+ }
24467
+ return typeof value === "string" && value !== "" ? value : void 0;
24468
+ }
24460
24469
  var NostrTransportProvider = class _NostrTransportProvider {
24461
24470
  id = "nostr";
24462
24471
  name = "Nostr Transport";
@@ -24953,6 +24962,26 @@ var NostrTransportProvider = class _NostrTransportProvider {
24953
24962
  }
24954
24963
  /**
24955
24964
  * Convert a BindingInfo (from nostr-js-sdk) to PeerInfo (sphere-sdk type).
24965
+ *
24966
+ * `network` IS DELIBERATELY ABSENT HERE — a live limitation, not an oversight
24967
+ * (#734). `queryBindingByNametag`/`queryBindingByAddress` are the whole public
24968
+ * resolution API for `@nametag` and `DIRECT://`, and both hardcode
24969
+ * `parseBindingInfo` inside the SDK's PRIVATE `queryWithFirstSeenWins`: the
24970
+ * caller never sees the signed event that resolution selected, and the parse
24971
+ * has already dropped every content field outside its whitelist. Re-querying
24972
+ * raw would mean re-deriving UNIP-01 ownership ourselves (marker preference,
24973
+ * cross-author first-seen-wins, ambiguity→null, multi-relay settle — all
24974
+ * private), and a second resolver that can disagree with the SDK's is worse
24975
+ * than a missing field on a MONEY guard. Nothing can declare a network today
24976
+ * regardless: the publish builders whitelist the same fields.
24977
+ *
24978
+ * CONSEQUENCE, stated plainly: for `@nametag` and `DIRECT://` recipients the
24979
+ * §5.6 cross-network guard can only SIGNAL (`recipient:network-unverified`),
24980
+ * never refuse. Upstream #734 must add `network` to the binding builders AND
24981
+ * to `BindingInfo`; the tripwire in
24982
+ * tests/unit/payments-v2/recipient-network.transport.test.ts fails the day it
24983
+ * lands, so this wiring cannot be forgotten. Do not "fix" this by inventing a
24984
+ * value — a stamped network is what made the guard unfalsifiable (#733).
24956
24985
  */
24957
24986
  async bindingInfoToPeerInfo(binding, nametag) {
24958
24987
  return {
@@ -24979,11 +25008,13 @@ var NostrTransportProvider = class _NostrTransportProvider {
24979
25008
  const bindingEvent = events[0];
24980
25009
  try {
24981
25010
  const content = JSON.parse(bindingEvent.content);
25011
+ const network = declaredNetwork(bindingEvent);
24982
25012
  return {
24983
25013
  nametag: content.nametag || void 0,
24984
25014
  transportPubkey: bindingEvent.pubkey,
24985
25015
  chainPubkey: content.public_key || "",
24986
25016
  directAddress: content.direct_address || "",
25017
+ ...network !== void 0 ? { network } : {},
24987
25018
  timestamp: bindingEvent.created_at * 1e3
24988
25019
  };
24989
25020
  } catch {
@@ -25019,11 +25050,13 @@ var NostrTransportProvider = class _NostrTransportProvider {
25019
25050
  for (const [pubkey, event] of byAuthor) {
25020
25051
  try {
25021
25052
  const content = JSON.parse(event.content);
25053
+ const network = declaredNetwork(event);
25022
25054
  results.push({
25023
25055
  nametag: content.nametag || void 0,
25024
25056
  transportPubkey: pubkey,
25025
25057
  chainPubkey: content.public_key || "",
25026
25058
  directAddress: content.direct_address || "",
25059
+ ...network !== void 0 ? { network } : {},
25027
25060
  timestamp: event.created_at * 1e3
25028
25061
  });
25029
25062
  } catch {