@decentnetwork/peer 0.1.9 → 0.1.10
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 +4 -29
- package/package.json +1 -1
package/dist/peer.js
CHANGED
|
@@ -1915,27 +1915,6 @@ export class Peer {
|
|
|
1915
1915
|
.sort((a, b) => this.#nodeScore(`${b.host}:${b.port}`) - this.#nodeScore(`${a.host}:${a.port}`))
|
|
1916
1916
|
.slice(0, MAX_SELF_ANNOUNCE_TARGETS);
|
|
1917
1917
|
const zeroPing = new Uint8Array(32);
|
|
1918
|
-
// Fresh ephemeral keypair for THIS announce sweep. Matches toxcore
|
|
1919
|
-
// onion_client.c::do_announce which uses Onion_Client.temp_*_key
|
|
1920
|
-
// — a per-client ephemeral pair regenerated on each round — as the
|
|
1921
|
-
// announce sender, NOT the real identity key.
|
|
1922
|
-
//
|
|
1923
|
-
// The bug we just hit: before this fix, runSelfAnnounce used
|
|
1924
|
-
// this.#keyPair (real identity) as both senderPublicKey AND
|
|
1925
|
-
// searchPublicKey. Bootstrap nodes reject `isStored=2` when
|
|
1926
|
-
// sender == search because the protocol's slot-allocation assumes
|
|
1927
|
-
// the announcing party can be revoked by knowing the secret of
|
|
1928
|
-
// the sender pubkey; if that's our long-lived identity, every
|
|
1929
|
-
// bootstrap conservatively refuses. Observed in the wild as
|
|
1930
|
-
// selfAnnounceStoredOn=0 across 9 bootstrap nodes on both a
|
|
1931
|
-
// public-IP VPS and a NAT'd Mac — identical zero, not an
|
|
1932
|
-
// environmental issue.
|
|
1933
|
-
//
|
|
1934
|
-
// searchPublicKey stays as our real identity (so peers querying
|
|
1935
|
-
// for our pubkey find this slot). dataPublicKey also stays as
|
|
1936
|
-
// #announceDataKey.publicKey (so peers can encrypt onion-data
|
|
1937
|
-
// requests to us). Only the sender envelope rotates.
|
|
1938
|
-
const announceSender = createEphemeralKeyPair();
|
|
1939
1918
|
const candidates = [];
|
|
1940
1919
|
for (const node of targets) {
|
|
1941
1920
|
if (!node.pk)
|
|
@@ -1975,8 +1954,8 @@ export class Peer {
|
|
|
1975
1954
|
const step1Settled = await Promise.allSettled(wave.map((c) => this.#sendAnnounceAndWait({
|
|
1976
1955
|
node: c.node,
|
|
1977
1956
|
nodePublicKey: c.nodePk,
|
|
1978
|
-
senderPublicKey:
|
|
1979
|
-
senderSecretKey:
|
|
1957
|
+
senderPublicKey: this.#keyPair.publicKey,
|
|
1958
|
+
senderSecretKey: this.#keyPair.secretKey,
|
|
1980
1959
|
pingId: zeroPing,
|
|
1981
1960
|
searchPublicKey: this.#keyPair.publicKey,
|
|
1982
1961
|
dataPublicKey: this.#announceDataKey.publicKey,
|
|
@@ -1999,12 +1978,8 @@ export class Peer {
|
|
|
1999
1978
|
const step2Settled = await Promise.allSettled(step1Hits.map(({ c, resp1 }) => this.#sendAnnounceAndWait({
|
|
2000
1979
|
node: c.node,
|
|
2001
1980
|
nodePublicKey: c.nodePk,
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
// ping_id against the sender envelope of the request that
|
|
2005
|
-
// issued it. Use the same announceSender as step1.
|
|
2006
|
-
senderPublicKey: announceSender.publicKey,
|
|
2007
|
-
senderSecretKey: announceSender.secretKey,
|
|
1981
|
+
senderPublicKey: this.#keyPair.publicKey,
|
|
1982
|
+
senderSecretKey: this.#keyPair.secretKey,
|
|
2008
1983
|
pingId: resp1.pingOrDataPublicKey,
|
|
2009
1984
|
searchPublicKey: this.#keyPair.publicKey,
|
|
2010
1985
|
dataPublicKey: this.#announceDataKey.publicKey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/peer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
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",
|