@twinsearth/w2m-dsh-plugin 0.17.0 → 0.18.0
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/CHANGELOG.md +28 -0
- package/package.json +1 -1
- package/src/agent/crypto.mjs +61 -0
- package/src/plugin/tools.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@ All notable changes to this project are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.18.0] — 2026-10-15
|
|
8
|
+
|
|
9
|
+
**The whole handshake primitive set is present on both machines — so the P2P failure is not a missing algorithm.**
|
|
10
|
+
|
|
11
|
+
Two candidates for `P2P_PUNCH_FAILED: Digest method not supported` have now been **measured and excluded**:
|
|
12
|
+
|
|
13
|
+
| Candidate | Measurement | Verdict |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| BLAKE2s-256 | 32-byte digest on MacMini **and** here, on the same run that failed | **innocent** |
|
|
16
|
+
| every other primitive the handshake touches | `sha256`, `chacha20-poly1305` with a real AEAD round trip, `hkdfSync('sha256')`, `x25519`+`diffieHellman`, `ed25519` — all present on both | **innocent** |
|
|
17
|
+
|
|
18
|
+
The second row was answered by **one bit-encoded dispatch** that put eight questions to MacMini at once
|
|
19
|
+
(`exit_code: 255`, every bit set) rather than one question per round. That technique was already in this
|
|
20
|
+
repository and should have been the first move.
|
|
21
|
+
|
|
22
|
+
**What this changes:** the search moves off the runtime and onto the protocol, the session state, or the
|
|
23
|
+
transport. And it points somewhere specific — **`P2P_PUNCH_FAILED` is raised by the relay's own push, on the
|
|
24
|
+
machine that already has every primitive it needs.** The failing handshake is not on a peer missing an
|
|
25
|
+
algorithm; it is on a peer that has all of them.
|
|
26
|
+
|
|
27
|
+
`cryptoCapabilities()` now answers this question in one dispatch for any machine, and its suite asserts the
|
|
28
|
+
**count** — six primitives, six checks — because a capability report that silently checks four things reads as
|
|
29
|
+
complete.
|
|
30
|
+
|
|
31
|
+
**Honest status: the cause of `P2P_PUNCH_FAILED` remains UNVERIFIED**, and the 0 % direct share measured last
|
|
32
|
+
round is unchanged. What this release buys is that two hypotheses are dead and the next one costs one
|
|
33
|
+
dispatch to test.
|
|
34
|
+
|
|
7
35
|
## [0.17.0] — 2026-10-15
|
|
8
36
|
|
|
9
37
|
**BLAKE2s-256 is not the cause of `P2P_PUNCH_FAILED`, and a failure that names nothing costs a probe per guess.**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twinsearth/w2m-dsh-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "DSH: Windows2MacOS — drive the same project on online Windows and macOS machines from one DeepSeek account, across networks and regions. P2P hole punching is the default path (relay + shared server as rendezvous, ledger and fallback), with a bundled STUN responder, Tailscale/public-VPS/tunnel shapes, Rabbit relay + per-machine Localside + eight DSH tools (replicate / split), nine aggregate verdicts and signed requests.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
package/src/agent/crypto.mjs
CHANGED
|
@@ -704,6 +704,67 @@ export function derive(ikm, label, length = KEY_BYTES) {
|
|
|
704
704
|
return Buffer.from(hkdfSync('sha256', ikm, Buffer.alloc(0), Buffer.from(label, 'utf8'), length));
|
|
705
705
|
}
|
|
706
706
|
|
|
707
|
+
/**
|
|
708
|
+
* The cryptographic primitives the handshake requires, and whether this runtime has each.
|
|
709
|
+
*
|
|
710
|
+
* ## Why a capability report rather than a one-off diagnostic
|
|
711
|
+
*
|
|
712
|
+
* `P2P_PUNCH_FAILED: Digest method not supported` has been reproduced several times in production and never
|
|
713
|
+
* under instrumentation. Two candidates have now been **measured and excluded**:
|
|
714
|
+
*
|
|
715
|
+
* * **BLAKE2s-256** — present on both MacMini and this Windows host, on the same run that reported the
|
|
716
|
+
* failure. Ruled out by a direct 32-byte digest on each machine.
|
|
717
|
+
* * **every other primitive the handshake touches** — `sha256`, `chacha20-poly1305` with a real AEAD
|
|
718
|
+
* round trip, `hkdfSync('sha256')`, `x25519` with `diffieHellman`, and `ed25519` — all present on both.
|
|
719
|
+
*
|
|
720
|
+
* So the fault is **not a missing algorithm**, and knowing that is worth more than another hypothesis: it
|
|
721
|
+
* moves the search from the runtime to the protocol, the state, or the transport.
|
|
722
|
+
*
|
|
723
|
+
* The exclusion cost several dispatches because each candidate had to be probed over a channel carrying one
|
|
724
|
+
* exit code. This function means the next question of that kind is answered in **one** dispatch, by the
|
|
725
|
+
* machine itself, with no interpretation in between.
|
|
726
|
+
*
|
|
727
|
+
* @returns {{ ok: boolean, missing: string[], present: string[], node: string, detail: string }}
|
|
728
|
+
*/
|
|
729
|
+
export function cryptoCapabilities() {
|
|
730
|
+
const present = [];
|
|
731
|
+
const missing = [];
|
|
732
|
+
const check = (name, fn) => {
|
|
733
|
+
try {
|
|
734
|
+
if (fn()) present.push(name);
|
|
735
|
+
else missing.push(`${name} (reported as unsupported)`);
|
|
736
|
+
} catch (e) {
|
|
737
|
+
missing.push(`${name} (${e?.message ?? String(e)})`);
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
check('blake2s256', () => createHash('blake2s256').update('').digest().length === 32);
|
|
742
|
+
check('sha256', () => createHash('sha256').update('').digest().length === 32);
|
|
743
|
+
check('chacha20-poly1305', () => {
|
|
744
|
+
const key = randomBytes(32);
|
|
745
|
+
const cipher = createCipheriv('chacha20-poly1305', key, Buffer.alloc(12), { authTagLength: 16 });
|
|
746
|
+
cipher.update(Buffer.from('probe'));
|
|
747
|
+
cipher.final();
|
|
748
|
+
return cipher.getAuthTag().length === 16;
|
|
749
|
+
});
|
|
750
|
+
check('hkdf-sha256', () => hkdfSync('sha256', randomBytes(32), Buffer.alloc(0), Buffer.from('probe'), 32).byteLength === 32);
|
|
751
|
+
check('x25519+diffieHellman', () => {
|
|
752
|
+
const { privateKey, publicKey } = generateKeyPairSync('x25519');
|
|
753
|
+
return diffieHellman({ privateKey, publicKey }).length === 32;
|
|
754
|
+
});
|
|
755
|
+
check('ed25519', () => generateKeyPairSync('ed25519') !== null);
|
|
756
|
+
|
|
757
|
+
return {
|
|
758
|
+
ok: missing.length === 0,
|
|
759
|
+
present,
|
|
760
|
+
missing,
|
|
761
|
+
node: process.version,
|
|
762
|
+
detail: missing.length === 0
|
|
763
|
+
? `all ${present.length} handshake primitive(s) available on ${process.version}`
|
|
764
|
+
: `${missing.length} of ${present.length + missing.length} handshake primitive(s) unavailable on ${process.version}: ${missing.join('; ')}`,
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
|
|
707
768
|
/**
|
|
708
769
|
* How BLAKE2s-256 is reached on this runtime, discovered once and remembered.
|
|
709
770
|
*
|
package/src/plugin/tools.mjs
CHANGED
|
@@ -185,7 +185,7 @@ const MAX_STAGES = 16;
|
|
|
185
185
|
* `package.json` during `scripts/pack.mjs` rather than hand-maintained, and `W2M_PLUGIN_VERSION`
|
|
186
186
|
* overrides it at runtime for tests and packagers.
|
|
187
187
|
*/
|
|
188
|
-
const PLUGIN_VERSION = '0.
|
|
188
|
+
const PLUGIN_VERSION = '0.18.0';
|
|
189
189
|
|
|
190
190
|
/** How long any single HTTP call may take before it is aborted, in milliseconds. */
|
|
191
191
|
const DEFAULT_REQUEST_TIMEOUT_MS = 15_000;
|