-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ps/more-aes-decrypt-support
# Conflicts: # crates/bitwarden/src/crypto/aes_ops.rs # crates/bitwarden/src/crypto/enc_string.rs # crates/bitwarden/src/crypto/master_key.rs # crates/bitwarden/src/crypto/rsa.rs
- Loading branch information
Showing
36 changed files
with
1,464 additions
and
674 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use std::sync::Arc; | ||
|
||
use bitwarden::mobile::crypto::{InitOrgCryptoRequest, InitUserCryptoRequest}; | ||
|
||
use crate::{error::Result, Client}; | ||
|
||
#[derive(uniffi::Object)] | ||
pub struct ClientCrypto(pub(crate) Arc<Client>); | ||
|
||
#[uniffi::export] | ||
impl ClientCrypto { | ||
/// Initialization method for the user crypto. Needs to be called before any other crypto operations. | ||
pub async fn initialize_user_crypto(&self, req: InitUserCryptoRequest) -> Result<()> { | ||
Ok(self | ||
.0 | ||
.0 | ||
.write() | ||
.await | ||
.crypto() | ||
.initialize_user_crypto(req) | ||
.await?) | ||
} | ||
|
||
/// Initialization method for the organization crypto. Needs to be called after `initialize_user_crypto` but before any other crypto operations. | ||
pub async fn initialize_org_crypto(&self, req: InitOrgCryptoRequest) -> Result<()> { | ||
Ok(self | ||
.0 | ||
.0 | ||
.write() | ||
.await | ||
.crypto() | ||
.initialize_org_crypto(req) | ||
.await?) | ||
} | ||
|
||
/// Get the uses's decrypted encryption key. Note: It's very important | ||
/// to keep this key safe, as it can be used to decrypt all of the user's data | ||
pub async fn get_user_encryption_key(&self) -> Result<String> { | ||
Ok(self | ||
.0 | ||
.0 | ||
.write() | ||
.await | ||
.crypto() | ||
.get_user_encryption_key() | ||
.await?) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
[bindings.kotlin] | ||
package_name = "com.bitwarden.sdk" | ||
cdylib_name = "bitwarden_uniffi" | ||
generate_immutable_records = true | ||
|
||
[bindings.swift] | ||
ffi_module_name = "BitwardenFFI" | ||
module_name = "BitwardenSDK" | ||
generate_immutable_records = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.