(
esk: &SymKeyEncryptedSessionKey,
conn: &mut rusqlite::Connection,
)
| 127 | } |
| 128 | |
| 129 | fn try_decrypt_with_bobstate( |
| 130 | esk: &SymKeyEncryptedSessionKey, |
| 131 | conn: &mut rusqlite::Connection, |
| 132 | ) -> Result<Option<(PlainSessionKey, String)>> { |
| 133 | let mut stmt = conn.prepare("SELECT invite FROM bobstate")?; |
| 134 | let mut rows = stmt.query(())?; |
| 135 | while let Some(row) = rows.next()? { |
| 136 | let invite: crate::securejoin::QrInvite = row.get(0)?; |
| 137 | let authcode = invite.authcode().to_string(); |
| 138 | let alice_fp = invite.fingerprint().hex(); |
| 139 | let shared_secret = format!("securejoin/{alice_fp}/{authcode}"); |
| 140 | if let Ok(psk) = decrypt_session_key_with_password(esk, &Password::from(shared_secret)) { |
| 141 | let fingerprint = invite.fingerprint().hex(); |
| 142 | return Ok(Some((psk, fingerprint))); |
| 143 | } |
| 144 | } |
| 145 | Ok(None) |
| 146 | } |
| 147 | |
| 148 | fn try_decrypt_with_broadcast_secret( |
| 149 | esk: &SymKeyEncryptedSessionKey, |
no test coverage detected