Skip to content

Commit

Permalink
Update uniffi to solve Send conflict (#326)
Browse files Browse the repository at this point in the history
## Type of change
```
- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other
```

## Objective
Update uniffi to solve the conflict between our `Send` and Rust's `Send`
  • Loading branch information
dani-garcia authored Nov 13, 2023
1 parent 5268e78 commit ee33be9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ codegen-units = 1

# Using master until 0.25.1 is released to fix https://github.com/mozilla/uniffi-rs/issues/1798
[patch.crates-io]
uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "eb97592f8c48a7f5cf02a94662b8b7861a6544f3" }
uniffi_build = { git = "https://github.com/mozilla/uniffi-rs", rev = "eb97592f8c48a7f5cf02a94662b8b7861a6544f3" }
uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs", rev = "eb97592f8c48a7f5cf02a94662b8b7861a6544f3" }
uniffi_core = { git = "https://github.com/mozilla/uniffi-rs", rev = "eb97592f8c48a7f5cf02a94662b8b7861a6544f3" }
uniffi_macros = { git = "https://github.com/mozilla/uniffi-rs", rev = "eb97592f8c48a7f5cf02a94662b8b7861a6544f3" }
uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "b369e7c15b1b7ebca34de9028209db11b7ff353d" }
uniffi_build = { git = "https://github.com/mozilla/uniffi-rs", rev = "b369e7c15b1b7ebca34de9028209db11b7ff353d" }
uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs", rev = "b369e7c15b1b7ebca34de9028209db11b7ff353d" }
uniffi_core = { git = "https://github.com/mozilla/uniffi-rs", rev = "b369e7c15b1b7ebca34de9028209db11b7ff353d" }
uniffi_macros = { git = "https://github.com/mozilla/uniffi-rs", rev = "b369e7c15b1b7ebca34de9028209db11b7ff353d" }
16 changes: 8 additions & 8 deletions crates/bitwarden-uniffi/src/vault/sends.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{path::Path, sync::Arc};

use bitwarden::vault::{self, SendListView, SendView};
use bitwarden::vault::{Send, SendListView, SendView};

use crate::{Client, Result};

Expand All @@ -10,12 +10,12 @@ pub struct ClientSends(pub Arc<Client>);
#[uniffi::export]
impl ClientSends {
/// Encrypt send
pub async fn encrypt(&self, send: SendView) -> Result<vault::Send> {
pub async fn encrypt(&self, send: SendView) -> Result<Send> {
Ok(self.0 .0.read().await.vault().sends().encrypt(send).await?)
}

/// Encrypt a send file in memory
pub async fn encrypt_buffer(&self, send: vault::Send, buffer: Vec<u8>) -> Result<Vec<u8>> {
pub async fn encrypt_buffer(&self, send: Send, buffer: Vec<u8>) -> Result<Vec<u8>> {
Ok(self
.0
.0
Expand All @@ -30,7 +30,7 @@ impl ClientSends {
/// Encrypt a send file located in the file system
pub async fn encrypt_file(
&self,
send: vault::Send,
send: Send,
decrypted_file_path: String,
encrypted_file_path: String,
) -> Result<()> {
Expand All @@ -50,12 +50,12 @@ impl ClientSends {
}

/// Decrypt send
pub async fn decrypt(&self, send: vault::Send) -> Result<SendView> {
pub async fn decrypt(&self, send: Send) -> Result<SendView> {
Ok(self.0 .0.read().await.vault().sends().decrypt(send).await?)
}

/// Decrypt send list
pub async fn decrypt_list(&self, sends: Vec<vault::Send>) -> Result<Vec<SendListView>> {
pub async fn decrypt_list(&self, sends: Vec<Send>) -> Result<Vec<SendListView>> {
Ok(self
.0
.0
Expand All @@ -68,7 +68,7 @@ impl ClientSends {
}

/// Decrypt a send file in memory
pub async fn decrypt_buffer(&self, send: vault::Send, buffer: Vec<u8>) -> Result<Vec<u8>> {
pub async fn decrypt_buffer(&self, send: Send, buffer: Vec<u8>) -> Result<Vec<u8>> {
Ok(self
.0
.0
Expand All @@ -83,7 +83,7 @@ impl ClientSends {
/// Decrypt a send file located in the file system
pub async fn decrypt_file(
&self,
send: vault::Send,
send: Send,
encrypted_file_path: String,
decrypted_file_path: String,
) -> Result<()> {
Expand Down

0 comments on commit ee33be9

Please sign in to comment.