Doc connect.rs
This commit is contained in:
parent
0a81ce12df
commit
bfa60aa023
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user