@decentnetwork/peer 0.1.137 → 0.1.138
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/peer.js +18 -1
- package/package.json +1 -1
package/dist/peer.js
CHANGED
|
@@ -1712,7 +1712,24 @@ export class Peer {
|
|
|
1712
1712
|
this.#events.on("friendInfo", cb);
|
|
1713
1713
|
}
|
|
1714
1714
|
friends() {
|
|
1715
|
-
|
|
1715
|
+
// Fill in `address` when the record lacks one (friends who requested US,
|
|
1716
|
+
// or were adopted from a session, never carried it). The address is
|
|
1717
|
+
// pubkey ‖ nospam(4B LE) ‖ checksum(2B) — locally derivable, no lookup.
|
|
1718
|
+
// It is the ONLY string another person can send a friend request to, so
|
|
1719
|
+
// a client that can't show it can't let its user recommend a contact
|
|
1720
|
+
// (INBOX 2026-08-05). Use the friend's recorded nospam when we have it
|
|
1721
|
+
// (their request told us); otherwise 0, which is what every current
|
|
1722
|
+
// deployment uses.
|
|
1723
|
+
return [...this.#friends.values()].map((f) => {
|
|
1724
|
+
if (f.address)
|
|
1725
|
+
return f;
|
|
1726
|
+
try {
|
|
1727
|
+
return { ...f, address: carrierAddressFromPublicKey(base58ToBytes(f.pubkey), f.nospam ?? 0) };
|
|
1728
|
+
}
|
|
1729
|
+
catch {
|
|
1730
|
+
return f; // malformed pubkey — better an absent address than a wrong one
|
|
1731
|
+
}
|
|
1732
|
+
});
|
|
1716
1733
|
}
|
|
1717
1734
|
/**
|
|
1718
1735
|
* Read-only snapshot of the live net_crypto session state for a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/peer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.138",
|
|
4
4
|
"description": "Pure TypeScript port of Elastos Carrier (toxcore-derived) P2P messaging. DHT, onion routing, TCP relay, FlatBuffers app payloads, Express offline relay. Wire-compatible with iOS Beagle and the Carrier C SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|