-
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.
## Type of change ``` - [ ] Bug fix - [ ] New feature development - [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ``` ## Objective Split initializeCrypto into separate user and organization methods, so clients won't need to hold on to the master password until after sync is done to initialize the organization keys.
- Loading branch information
1 parent
9fab1fa
commit 8788f18
Showing
11 changed files
with
212 additions
and
75 deletions.
There are no files selected for viewing
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,35 @@ | ||
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?) | ||
} | ||
} |
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
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.