Skip to content

Commit e08b851

Browse files
committed
refactor(secure_channel): rename SecureChannel::new to SecureChannel::reciprocate and make it available outside of tests
Signed-off-by: Johannes Marbach <[email protected]>
1 parent b73bd05 commit e08b851

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

crates/matrix-sdk/src/authentication/oauth/qrcode/login.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ mod test {
666666
server.mock_query_keys().ok().expect(1).named("query_keys").mount().await;
667667

668668
let client = HttpClient::new(reqwest::Client::new(), Default::default());
669-
let alice = SecureChannel::new(client, &rendezvous_server.homeserver_url)
669+
let alice = SecureChannel::reciprocate(client, &rendezvous_server.homeserver_url)
670670
.await
671671
.expect("Alice should be able to create a secure channel.");
672672

@@ -1043,7 +1043,7 @@ mod test {
10431043
server.mock_who_am_i().ok().named("whoami").mount().await;
10441044

10451045
let client = HttpClient::new(reqwest::Client::new(), Default::default());
1046-
let alice = SecureChannel::new(client, &rendezvous_server.homeserver_url)
1046+
let alice = SecureChannel::reciprocate(client, &rendezvous_server.homeserver_url)
10471047
.await
10481048
.expect("Alice should be able to create a secure channel.");
10491049

@@ -1325,7 +1325,7 @@ mod test {
13251325
server.mock_who_am_i().ok().named("whoami").mount().await;
13261326

13271327
let client = HttpClient::new(reqwest::Client::new(), Default::default());
1328-
let alice = SecureChannel::new(client, &rendezvous_server.homeserver_url)
1328+
let alice = SecureChannel::reciprocate(client, &rendezvous_server.homeserver_url)
13291329
.await
13301330
.expect("Alice should be able to create a secure channel.");
13311331

crates/matrix-sdk/src/authentication/oauth/qrcode/secure_channel.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ impl SecureChannel {
5454
Ok(Self { channel, qr_code_data, ecies })
5555
}
5656

57-
/// Create a new login to reciprocate an existing login with.
58-
#[cfg(test)]
59-
pub(super) async fn new(http_client: HttpClient, homeserver_url: &Url) -> Result<Self, Error> {
57+
/// Create a new secure channel to reciprocate an existing login with.
58+
pub(super) async fn reciprocate(
59+
http_client: HttpClient,
60+
homeserver_url: &Url,
61+
) -> Result<Self, Error> {
6062
let mut channel = SecureChannel::login(http_client, homeserver_url).await?;
61-
// We're a bit abusing the QR code data here, since we're passing the homeserver
62-
// URL, but for our tests this is fine.
6363
channel.qr_code_data.mode_data =
6464
QrCodeModeData::Reciprocate { server_name: homeserver_url.to_string() };
6565
Ok(channel)
@@ -354,7 +354,7 @@ pub(super) mod test {
354354
let rendezvous_server = MockedRendezvousServer::new(&server, "abcdEFG12345").await;
355355

356356
let client = HttpClient::new(reqwest::Client::new(), Default::default());
357-
let alice = SecureChannel::new(client, &rendezvous_server.homeserver_url)
357+
let alice = SecureChannel::reciprocate(client, &rendezvous_server.homeserver_url)
358358
.await
359359
.expect("Alice should be able to create a secure channel.");
360360

0 commit comments

Comments
 (0)