Skip to main content

restore_pair_session

Function restore_pair_session 

Source
pub fn restore_pair_session(
    role: &str,
    relay_url: &str,
    pair_id: &str,
    code: &str,
    code_hash: &str,
    our_slot_id: &str,
    our_slot_token: &str,
    seed: [u8; 32],
) -> Result<PairSessionState>
Expand description

Reconstruct a PairSessionState from persisted fields without any network I/O. The caller (typically the daemon’s cleanup_on_startup) has already recovered seed, code, code_hash, pair_id, slot info, and role from the on-disk pending-pair file; this builds an in-memory state that can resume pair_session_try_sas from where the prior daemon left off.

Idempotent w.r.t. the relay — does not call pair_open. The relay already has our msg_out from the prior pair_open call; we just need a PakeSide that produces the same scalar to compute the SAS once the peer’s msg arrives.