From bfa60aa0230f153653f813910f506110fcbcd421 Mon Sep 17 00:00:00 2001 From: Omar Oughriss Date: Wed, 30 Oct 2024 15:26:08 +0100 Subject: [PATCH] Doc connect.rs --- tests/connect.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/connect.rs b/tests/connect.rs index 1e4b87a..5a85de8 100644 --- a/tests/connect.rs +++ b/tests/connect.rs @@ -24,6 +24,33 @@ use utils::*; wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] +/// Tests the connection process between two devices, Alice and Bob, by executing a series of secure +/// transactions to establish a shared secret for encrypted communication. +/// +/// # Process Summary +/// +/// ## Alice's Initialization: +/// - Alice initializes her device from an `sp_wallet` object and sets it as the local device. +/// - She retrieves her own address and obtains Bob’s address. +/// - Alice creates a new member using Bob’s address to identify him within the transaction. +/// - She generates a connection transaction (`connect_tx`) targeting Bob's device, initiating the process for secure message sharing. +/// - Alice processes her own transaction and stores the derived shared secrets in `alice_secrets_store`, +/// associating each shared secret with Bob's addresses. +/// +/// ## Bob's Initialization: +/// - Bob initializes his device from his own `sp_wallet`. +/// - He parses Alice’s connection transaction to retrieve the shared secret Alice created for him, +/// then responds by sending an encrypted message back to Alice in a follow-up transaction. +/// - Bob saves these derived shared secrets in `bob_secrets_store`. +/// +/// ## Message Exchange: +/// - **Alice’s Response**: Alice receives and decrypts the message from Bob’s response transaction. +/// - She replies to Bob by encrypting a confirmation message, updating her secrets in `alice_secrets_store`. +/// - **Bob’s Confirmation**: Bob receives Alice’s confirmation message, decrypts it, and updates his secrets in `bob_secrets_store`. +/// +/// ## Verification: +/// - Finally, the function asserts that Alice and Bob now share the same secrets, confirming successful +/// connection and mutual authentication between the devices. fn test_connect() { setup(); // let mut alice_process_cache = HashMap::new();