-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PM-11764] Implement account switching and sdk initialization #1116
Changes from all commits
6fb114b
0857aa6
8670757
8860dfd
bbaccba
94e9510
30dac65
1d1644f
02ec621
a1201f1
e23e30b
79505d4
0105672
8452d66
5c6bcda
5ee793a
3c24ae7
5ea7645
fe72f34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,16 @@ use crate::{ | |
rsa::encrypt_rsa2048_oaep_sha1, | ||
AsymmetricCryptoKey, AsymmetricEncryptable, KeyDecryptable, | ||
}; | ||
|
||
// This module is a workaround to avoid deprecated warnings that come from the ZeroizeOnDrop | ||
// macro expansion | ||
#[allow(deprecated)] | ||
mod internal { | ||
#[cfg(feature = "wasm")] | ||
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] | ||
const TS_CUSTOM_TYPES: &'static str = r#" | ||
export type AsymmetricEncString = string; | ||
"#; | ||
Comment on lines
+18
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added |
||
|
||
/// # Encrypted string primitive | ||
/// | ||
/// [AsymmetricEncString] is a Bitwarden specific primitive that represents an asymmetrically | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,6 +5,8 @@ | |||||
use log::{set_max_level, Level}; | ||||||
use wasm_bindgen::prelude::*; | ||||||
|
||||||
use crate::{vault::ClientVault, ClientCrypto}; | ||||||
|
||||||
#[wasm_bindgen] | ||||||
pub enum LogLevel { | ||||||
Trace, | ||||||
|
@@ -27,7 +29,7 @@ | |||||
// Rc<...> is to avoid needing to take ownership of the Client during our async run_command | ||||||
// function https://github.com/rustwasm/wasm-bindgen/issues/2195#issuecomment-799588401 | ||||||
#[wasm_bindgen] | ||||||
pub struct BitwardenClient(Rc<Client>); | ||||||
pub struct BitwardenClient(pub(crate) Rc<Client>); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Nit: This inner value is only used on it's own impl as far as I know, so we don't need it to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
|
||||||
#[wasm_bindgen] | ||||||
impl BitwardenClient { | ||||||
|
@@ -54,4 +56,12 @@ | |||||
|
||||||
res.text().await.map_err(|e| e.to_string()) | ||||||
} | ||||||
|
||||||
pub fn crypto(&self) -> ClientCrypto { | ||||||
ClientCrypto::new(self.0.clone()) | ||||||
} | ||||||
|
||||||
pub fn vault(&self) -> ClientVault { | ||||||
ClientVault::new(self.0.clone()) | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I just discovered now thanks to this that you can use a top level
{}
block in ause
statement, neat!