diff --git a/warzone/crates/warzone-wasm/src/lib.rs b/warzone/crates/warzone-wasm/src/lib.rs index 8c11482..3db5cbc 100644 --- a/warzone/crates/warzone-wasm/src/lib.rs +++ b/warzone/crates/warzone-wasm/src/lib.rs @@ -257,10 +257,23 @@ pub fn self_test() -> Result { let text = result.get("text").and_then(|v| v.as_str()).unwrap_or("MISSING"); + // More detailed info + let alice_shared_hex = hex::encode(x3dh_result.shared_secret); + + // Bob's side: compute shared secret for comparison + let bob_shared = x3dh::respond( + &bob_id, &bob_spk_secret, None, + &alice_pub.encryption, &x3dh_result.ephemeral_public, + ).map_err(|e| JsValue::from_str(&format!("X3DH respond direct: {}", e)))?; + let bob_shared_hex = hex::encode(bob_shared); + + let shared_match = alice_shared_hex == bob_shared_hex; + Ok(format!( - "WASM self-test: alice_fp={}, bob_fp={}, wire_bytes={}, decrypted='{}', PASS={}", - alice_pub.fingerprint, bob_pub.fingerprint, wire_bytes.len(), text, - text == "hello from WASM self-test" + "alice_fp={}, bob_fp={}, wire_bytes={}, alice_shared={}..., bob_shared={}..., shared_match={}, decrypted='{}', PASS={}", + alice_pub.fingerprint, bob_pub.fingerprint, wire_bytes.len(), + &alice_shared_hex[..16], &bob_shared_hex[..16], shared_match, + text, text == "hello from WASM self-test" )) }