Skip to content

Commit 96b2b72

Browse files
committed
core::Wormhole: Remove deprecated methods
1 parent ebe2be3 commit 96b2b72

File tree

3 files changed

+1
-162
lines changed

3 files changed

+1
-162
lines changed

src/core.rs

-71
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,6 @@ impl From<std::convert::Infallible> for WormholeError {
7474
}
7575
}
7676

77-
/**
78-
* The result of the client-server handshake
79-
*/
80-
#[derive(Clone, Debug, PartialEq, Eq)]
81-
#[deprecated(
82-
since = "0.7.0",
83-
note = "part of the response of `Wormhole::connect_without_code(...)` and `Wormhole::connect_with_code(...) please use 'MailboxConnection::create(...)`/`MailboxConnection::connect(..)` and `Wormhole::connect(mailbox_connection)' instead"
84-
)]
85-
pub struct WormholeWelcome {
86-
/** A welcome message from the server (think of "message of the day"). Should be displayed to the user if present. */
87-
pub welcome: Option<String>,
88-
/// The wormhole code used in the exchange
89-
pub code: Code,
90-
}
91-
9277
/**
9378
* Establishing Wormhole connection
9479
*
@@ -310,62 +295,6 @@ pub struct Wormhole {
310295
}
311296

312297
impl Wormhole {
313-
/**
314-
* Generate a code and connect to the rendezvous server.
315-
*
316-
* # Returns
317-
*
318-
* A tuple with a [`WormholeWelcome`] and a [`std::future::Future`] that will
319-
* do the rest of the client-client handshake and yield the [`Wormhole`] object
320-
* on success.
321-
*/
322-
#[deprecated(
323-
since = "0.7.0",
324-
note = "please use 'MailboxConnection::create(..) and Wormhole::connect(mailbox_connection)' instead"
325-
)]
326-
#[expect(deprecated)]
327-
pub async fn connect_without_code(
328-
config: AppConfig<impl serde::Serialize + Send + Sync + 'static>,
329-
code_length: usize,
330-
) -> Result<
331-
(
332-
WormholeWelcome,
333-
impl std::future::Future<Output = Result<Self, WormholeError>>,
334-
),
335-
WormholeError,
336-
> {
337-
let mailbox_connection = MailboxConnection::create(config, code_length).await?;
338-
Ok((
339-
WormholeWelcome {
340-
welcome: mailbox_connection.welcome.clone(),
341-
code: mailbox_connection.code.clone(),
342-
},
343-
Self::connect(mailbox_connection),
344-
))
345-
}
346-
347-
/**
348-
* Connect to a peer with a code.
349-
*/
350-
#[deprecated(
351-
since = "0.7.0",
352-
note = "please use 'MailboxConnection::connect(..) and Wormhole::connect(mailbox_connection)' instead"
353-
)]
354-
#[expect(deprecated)]
355-
pub async fn connect_with_code(
356-
config: AppConfig<impl serde::Serialize + Send + Sync + 'static>,
357-
code: Code,
358-
) -> Result<(WormholeWelcome, Self), WormholeError> {
359-
let mailbox_connection = MailboxConnection::connect(config, code.clone(), true).await?;
360-
Ok((
361-
WormholeWelcome {
362-
welcome: mailbox_connection.welcome.clone(),
363-
code,
364-
},
365-
Self::connect(mailbox_connection).await?,
366-
))
367-
}
368-
369298
/// Set up a Wormhole which is the client-client part of the connection setup
370299
///
371300
/// The MailboxConnection already contains a rendezvous server with an opened mailbox.

src/core/test.rs

-89
Original file line numberDiff line numberDiff line change
@@ -227,95 +227,6 @@ async fn file_offers(
227227
])
228228
}
229229

230-
/** Send a file using the Rust implementation (using deprecated API). This does not guarantee compatibility with Python! ;) */
231-
#[cfg(feature = "transfer")]
232-
#[test(async_std::test)]
233-
// TODO Wasm test disabled, it crashes
234-
// #[cfg_attr(target_arch = "wasm32", test(wasm_bindgen_test::wasm_bindgen_test))]
235-
#[expect(deprecated)]
236-
pub async fn test_file_rust2rust_deprecated() {
237-
for (offer, answer) in file_offers().await.unwrap() {
238-
let (code_tx, code_rx) = futures::channel::oneshot::channel();
239-
240-
let sender_task = async_std::task::Builder::new()
241-
.name("sender".to_owned())
242-
.local(async {
243-
let (welcome, wormhole_future) = crate::Wormhole::connect_without_code(
244-
transfer::APP_CONFIG.id(TEST_APPID).clone(),
245-
2,
246-
)
247-
.await?;
248-
if let Some(welcome) = &welcome.welcome {
249-
tracing::info!("Got welcome: {}", welcome);
250-
}
251-
tracing::info!("This wormhole's code is: {}", &welcome.code);
252-
code_tx.send(welcome.code.clone()).unwrap();
253-
let wormhole = wormhole_future.await?;
254-
eyre::Result::<_>::Ok(
255-
transfer::send(
256-
wormhole,
257-
default_relay_hints(),
258-
magic_wormhole::transit::Abilities::ALL_ABILITIES,
259-
offer,
260-
&log_transit_connection,
261-
|_sent, _total| {},
262-
futures::future::pending(),
263-
)
264-
.await?,
265-
)
266-
})
267-
.unwrap();
268-
let receiver_task = async_std::task::Builder::new()
269-
.name("receiver".to_owned())
270-
.local(async {
271-
let code = code_rx.await?;
272-
let config = transfer::APP_CONFIG.id(TEST_APPID);
273-
tracing::info!("Got code over local: {}", &code);
274-
let (welcome, wormhole) =
275-
crate::Wormhole::connect_with_code(config.clone(), code).await?;
276-
if let Some(welcome) = &welcome.welcome {
277-
tracing::info!("Got welcome: {}", welcome);
278-
}
279-
280-
// Hacky v1-compat conversion for now
281-
let mut answer =
282-
(answer.into_iter_files().next().unwrap().1.content)(false).await?;
283-
284-
/*let transfer::ReceiveRequest::V1(req) = transfer::request(
285-
wormhole,
286-
default_relay_hints(),
287-
magic_wormhole::transit::Abilities::ALL_ABILITIES,
288-
futures::future::pending(),
289-
)
290-
.await?
291-
.unwrap() else {
292-
panic!("v2 should be disabled for now")
293-
};*/
294-
let req = transfer::request_file(
295-
wormhole,
296-
default_relay_hints(),
297-
magic_wormhole::transit::Abilities::ALL_ABILITIES,
298-
futures::future::pending(),
299-
)
300-
.await?
301-
.unwrap();
302-
303-
req.accept(
304-
&log_transit_connection,
305-
|_received, _total| {},
306-
&mut answer,
307-
futures::future::pending(),
308-
)
309-
.await?;
310-
eyre::Result::<_>::Ok(())
311-
})
312-
.unwrap();
313-
314-
sender_task.await.unwrap();
315-
receiver_task.await.unwrap();
316-
}
317-
}
318-
319230
/** Send a file using the Rust implementation. This does not guarantee compatibility with Python! ;) */
320231
#[cfg(feature = "transfer")]
321232
#[test(async_std::test)]

src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ pub mod transit;
3636
#[cfg(feature = "transfer")]
3737
pub mod uri;
3838

39-
#[expect(deprecated)]
4039
pub use crate::core::{
4140
key::{Key, KeyPurpose, WormholeKey},
4241
rendezvous, AppConfig, AppID, Code, MailboxConnection, Mood, Nameplate, ParseCodeError,
43-
ParseNameplateError, ParsePasswordError, Password, Wormhole, WormholeError, WormholeWelcome,
42+
ParseNameplateError, ParsePasswordError, Password, Wormhole, WormholeError,
4443
};
4544

4645
#[doc(hidden)]

0 commit comments

Comments
 (0)