@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.
- package/dist/connect/index.cjs +1 -1
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +69 -27
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +21 -1
- package/dist/core/index.d.ts +21 -1
- package/dist/core/index.js +69 -27
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +1 -1
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +1 -1
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/impl/browser/index.cjs +33 -0
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js +33 -0
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/nodejs/index.cjs +33 -0
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.d.cts +41 -1
- package/dist/impl/nodejs/index.d.ts +41 -1
- package/dist/impl/nodejs/index.js +33 -0
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/impl/shared/wallet-api/index.d.cts +21 -1
- package/dist/impl/shared/wallet-api/index.d.ts +21 -1
- package/dist/index.cjs +69 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +69 -27
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +36 -26
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +16 -6
- package/dist/modules/payments-v2/index.d.ts +16 -6
- package/dist/modules/payments-v2/index.js +35 -26
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1213,6 +1213,15 @@ function defaultUUIDGenerator() {
|
|
|
1213
1213
|
var COMPOSING_INDICATOR_KIND = 25050;
|
|
1214
1214
|
var TIMESTAMP_RANDOMIZATION = 2 * 24 * 60 * 60;
|
|
1215
1215
|
var EVENT_KINDS = NOSTR_EVENT_KINDS;
|
|
1216
|
+
function declaredNetwork(event) {
|
|
1217
|
+
let value;
|
|
1218
|
+
try {
|
|
1219
|
+
value = JSON.parse(event.content)?.network;
|
|
1220
|
+
} catch {
|
|
1221
|
+
return void 0;
|
|
1222
|
+
}
|
|
1223
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
1224
|
+
}
|
|
1216
1225
|
var NostrTransportProvider = class _NostrTransportProvider {
|
|
1217
1226
|
id = "nostr";
|
|
1218
1227
|
name = "Nostr Transport";
|
|
@@ -1709,6 +1718,26 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
1709
1718
|
}
|
|
1710
1719
|
/**
|
|
1711
1720
|
* Convert a BindingInfo (from nostr-js-sdk) to PeerInfo (sphere-sdk type).
|
|
1721
|
+
*
|
|
1722
|
+
* `network` IS DELIBERATELY ABSENT HERE — a live limitation, not an oversight
|
|
1723
|
+
* (#734). `queryBindingByNametag`/`queryBindingByAddress` are the whole public
|
|
1724
|
+
* resolution API for `@nametag` and `DIRECT://`, and both hardcode
|
|
1725
|
+
* `parseBindingInfo` inside the SDK's PRIVATE `queryWithFirstSeenWins`: the
|
|
1726
|
+
* caller never sees the signed event that resolution selected, and the parse
|
|
1727
|
+
* has already dropped every content field outside its whitelist. Re-querying
|
|
1728
|
+
* raw would mean re-deriving UNIP-01 ownership ourselves (marker preference,
|
|
1729
|
+
* cross-author first-seen-wins, ambiguity→null, multi-relay settle — all
|
|
1730
|
+
* private), and a second resolver that can disagree with the SDK's is worse
|
|
1731
|
+
* than a missing field on a MONEY guard. Nothing can declare a network today
|
|
1732
|
+
* regardless: the publish builders whitelist the same fields.
|
|
1733
|
+
*
|
|
1734
|
+
* CONSEQUENCE, stated plainly: for `@nametag` and `DIRECT://` recipients the
|
|
1735
|
+
* §5.6 cross-network guard can only SIGNAL (`recipient:network-unverified`),
|
|
1736
|
+
* never refuse. Upstream #734 must add `network` to the binding builders AND
|
|
1737
|
+
* to `BindingInfo`; the tripwire in
|
|
1738
|
+
* tests/unit/payments-v2/recipient-network.transport.test.ts fails the day it
|
|
1739
|
+
* lands, so this wiring cannot be forgotten. Do not "fix" this by inventing a
|
|
1740
|
+
* value — a stamped network is what made the guard unfalsifiable (#733).
|
|
1712
1741
|
*/
|
|
1713
1742
|
async bindingInfoToPeerInfo(binding, nametag) {
|
|
1714
1743
|
return {
|
|
@@ -1735,11 +1764,13 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
1735
1764
|
const bindingEvent = events[0];
|
|
1736
1765
|
try {
|
|
1737
1766
|
const content = JSON.parse(bindingEvent.content);
|
|
1767
|
+
const network = declaredNetwork(bindingEvent);
|
|
1738
1768
|
return {
|
|
1739
1769
|
nametag: content.nametag || void 0,
|
|
1740
1770
|
transportPubkey: bindingEvent.pubkey,
|
|
1741
1771
|
chainPubkey: content.public_key || "",
|
|
1742
1772
|
directAddress: content.direct_address || "",
|
|
1773
|
+
...network !== void 0 ? { network } : {},
|
|
1743
1774
|
timestamp: bindingEvent.created_at * 1e3
|
|
1744
1775
|
};
|
|
1745
1776
|
} catch {
|
|
@@ -1775,11 +1806,13 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
1775
1806
|
for (const [pubkey, event] of byAuthor) {
|
|
1776
1807
|
try {
|
|
1777
1808
|
const content = JSON.parse(event.content);
|
|
1809
|
+
const network = declaredNetwork(event);
|
|
1778
1810
|
results.push({
|
|
1779
1811
|
nametag: content.nametag || void 0,
|
|
1780
1812
|
transportPubkey: pubkey,
|
|
1781
1813
|
chainPubkey: content.public_key || "",
|
|
1782
1814
|
directAddress: content.direct_address || "",
|
|
1815
|
+
...network !== void 0 ? { network } : {},
|
|
1783
1816
|
timestamp: event.created_at * 1e3
|
|
1784
1817
|
});
|
|
1785
1818
|
} catch {
|