Add WASM self-test, bundle debug, /selftest and /bundleinfo commands
/selftest — runs full Alice→Bob encrypt/decrypt cycle within WASM (tests X3DH + Double Ratchet + bincode serialize/deserialize) /bundleinfo — dumps bundle contents, verifies SPK secret matches SPK public key in the registered bundle These help isolate whether the bug is in WASM crypto (self-test fails) or in CLI↔WASM interop (self-test passes but cross-client fails). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -144,7 +144,7 @@ const WEB_HTML: &str = r##"<!DOCTYPE html>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
import init, { WasmIdentity, WasmSession, decrypt_wire_message } from '/wasm/warzone_wasm.js';
|
||||
import init, { WasmIdentity, WasmSession, decrypt_wire_message, self_test, debug_bundle_info } from '/wasm/warzone_wasm.js';
|
||||
|
||||
const SERVER = window.location.origin;
|
||||
const $messages = document.getElementById('messages');
|
||||
@@ -581,6 +581,20 @@ async function doSend() {
|
||||
addSys('SPK secret: ' + (mySpkSecretHex ? mySpkSecretHex.slice(0,16) + '...' : 'NONE'));
|
||||
return;
|
||||
}
|
||||
if (text === '/selftest') {
|
||||
try {
|
||||
const r = self_test();
|
||||
addSys(r);
|
||||
} catch(e) { addSys('Self-test FAILED: ' + e); }
|
||||
return;
|
||||
}
|
||||
if (text === '/bundleinfo') {
|
||||
try {
|
||||
const r = debug_bundle_info(wasmIdentity);
|
||||
addSys(r);
|
||||
} catch(e) { addSys('Bundle info error: ' + e); }
|
||||
return;
|
||||
}
|
||||
if (text === '/quit') { window.close(); return; }
|
||||
if (text === '/glist') { await groupList(); return; }
|
||||
if (text === '/dm') { currentGroup = null; addSys('Switched to DM mode'); $peerInput.value = localStorage.getItem('wz-peer') || ''; return; }
|
||||
|
||||
Reference in New Issue
Block a user