Skip to content

Commit 3351219

Browse files
committed
Merge branch 'pilip/remove-revocation' into 'master'
Pilip/remove revocation See merge request TankerHQ/sdk-rust!93
2 parents d2b9f36 + ff9d530 commit 3351219

File tree

3 files changed

+6
-47
lines changed

3 files changed

+6
-47
lines changed

src/core.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ impl Core {
5858
/// The current device's ID.
5959
///
6060
/// The Tanker status must be `Ready`.
61+
#[deprecated(since = "2.27.0")]
6162
pub fn device_id(&self) -> Result<String, Error> {
6263
unsafe { block_on(CTankerLib::get().device_id(self.ctanker)) }
6364
}
6465

6566
/// The user's devices list.
6667
///
6768
/// The Tanker status must be `Ready`.
69+
#[deprecated(since = "2.27.0")]
6870
pub async fn device_list(&self) -> Result<Vec<Device>, Error> {
6971
unsafe { CTankerLib::get().device_list(self.ctanker).await }
7072
}
@@ -336,18 +338,6 @@ impl Core {
336338
}
337339
}
338340

339-
/// Revokes one of the user's devices.
340-
///
341-
/// The Tanker status must be `Ready`.
342-
#[deprecated(since = "2.8.0")]
343-
pub async fn revoke_device(&self, device_id: &str) -> Result<(), Error> {
344-
unsafe {
345-
CTankerLib::get()
346-
.revoke_device(self.ctanker, device_id)
347-
.await
348-
}
349-
}
350-
351341
/// Create an encryption session that will allow performing multiple encryption operations with a reduced number of keys.
352342
///
353343
/// # Arguments

src/ctanker.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -528,27 +528,6 @@ impl CTankerLib {
528528
fut.await
529529
}
530530

531-
pub async unsafe fn revoke_device(
532-
&self,
533-
ctanker: CTankerPtr,
534-
device_id: &str,
535-
) -> Result<(), Error> {
536-
let cdevice_id = CString::new(device_id).map_err(|_| {
537-
Error::new(
538-
ErrorCode::InvalidArgument,
539-
"device_id is not a valid CString".into(),
540-
)
541-
})?;
542-
543-
let fut = unsafe {
544-
CFuture::new(tanker_call!(
545-
self,
546-
tanker_revoke_device(ctanker.0, cdevice_id.as_ptr(),)
547-
))
548-
};
549-
fut.await
550-
}
551-
552531
pub async unsafe fn encryption_session_open(
553532
&self,
554533
ctanker: CTankerPtr,

tests/tanker_tests.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,18 @@ async fn start_stop_session() -> Result<(), Error> {
5959
Ok(())
6060
}
6161

62-
#[tokio::test(flavor = "multi_thread")]
63-
async fn self_revoke() -> Result<(), Error> {
64-
let app = TestApp::get().await;
65-
let tanker = app.start_anonymous(&app.create_identity(None)).await?;
66-
67-
#[allow(deprecated)]
68-
tanker.revoke_device(&tanker.device_id()?).await?;
69-
let err = tanker.encrypt(b"F", &Default::default()).await.unwrap_err();
70-
assert_eq!(err.code(), ErrorCode::DeviceRevoked);
71-
72-
tanker.stop().await
73-
}
74-
7562
#[tokio::test(flavor = "multi_thread")]
7663
async fn has_correct_device_list() -> Result<(), Error> {
7764
let app = TestApp::get().await;
7865
let tanker = app.start_anonymous(&app.create_identity(None)).await?;
7966

67+
#[allow(deprecated)]
8068
let list = tanker.device_list().await?;
8169
assert_eq!(list.len(), 1);
8270
assert!(!list[0].revoked);
83-
assert_eq!(list[0].id, tanker.device_id().unwrap());
71+
#[allow(deprecated)]
72+
let device_id = tanker.device_id().unwrap();
73+
assert_eq!(list[0].id, device_id);
8474

8575
tanker.stop().await
8676
}

0 commit comments

Comments
 (0)