Skip to content

Commit 58ce5e7

Browse files
committed
Merge branch 'main' of github.com:bitwarden/sdk-internal into arch/remove-wasm-vault
2 parents 688b663 + 3d2e4b5 commit 58ce5e7

File tree

11 files changed

+65
-51
lines changed

11 files changed

+65
-51
lines changed

.github/workflows/rust-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
run: cargo install wasm-bindgen-cli --version 0.2.100
7575

7676
- name: Test WASM
77-
run: cargo test --target wasm32-unknown-unknown -p bitwarden-wasm-internal -p bitwarden-threading -p bitwarden-error --all-features
77+
run: cargo test --target wasm32-unknown-unknown -p bitwarden-wasm-internal -p bitwarden-threading -p bitwarden-error -p bitwarden-uuid --all-features
7878

7979
coverage:
8080
name: Coverage

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ validator = { version = ">=0.18.1, <0.20", features = ["derive"] }
7070
wasm-bindgen = { version = ">=0.2.91, <0.3", features = ["serde-serialize"] }
7171
wasm-bindgen-futures = "0.4.41"
7272
wasm-bindgen-test = "0.3.45"
73+
serde-wasm-bindgen = ">=0.6.0, <0.7"
7374

7475
# There is an incompatibility when using pkcs5 and chacha20 on wasm builds. This can be removed once a new
7576
# rustcrypto-formats crate version is released since the fix has been upstreamed.

crates/bitwarden-uuid/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ workspace = true
2222

2323
[dev-dependencies]
2424
serde = { workspace = true }
25+
serde-wasm-bindgen = { workspace = true }
2526
serde_json = { workspace = true }
2627
uuid = { workspace = true }
28+
wasm-bindgen-test = { workspace = true }

crates/bitwarden-uuid/tests/uuid.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,18 @@ fn test_deserialize() {
4242

4343
assert_eq!(id, deserialized);
4444
}
45+
46+
#[wasm_bindgen_test::wasm_bindgen_test]
47+
#[allow(dead_code)]
48+
fn test_wasm_serialize() {
49+
let id: TestId = "d4a722ff-ce51-47f1-ba42-c2216f547851"
50+
.parse()
51+
.expect("Test");
52+
53+
let serialized = serde_wasm_bindgen::to_value(&id).expect("Test");
54+
55+
assert_eq!(
56+
serialized.as_string().expect("Test"),
57+
"d4a722ff-ce51-47f1-ba42-c2216f547851"
58+
);
59+
}

crates/bitwarden-vault/src/cipher/attachment_client.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use wasm_bindgen::prelude::*;
99

1010
use crate::{
1111
Attachment, AttachmentEncryptResult, AttachmentFile, AttachmentFileView, AttachmentView,
12-
Cipher, DecryptError, EncryptError, VaultClient,
12+
Cipher, DecryptError, EncryptError,
1313
};
1414

1515
#[cfg_attr(feature = "wasm", wasm_bindgen)]
@@ -100,12 +100,3 @@ impl AttachmentsClient {
100100
Ok(())
101101
}
102102
}
103-
104-
#[cfg_attr(feature = "wasm", wasm_bindgen)]
105-
impl VaultClient {
106-
pub fn attachments(&self) -> AttachmentsClient {
107-
AttachmentsClient {
108-
client: self.client.clone(),
109-
}
110-
}
111-
}

crates/bitwarden-vault/src/cipher/cipher_client.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use bitwarden_crypto::IdentifyKey;
44
use wasm_bindgen::prelude::*;
55

66
use super::EncryptionContext;
7-
use crate::{
8-
Cipher, CipherError, CipherListView, CipherView, DecryptError, EncryptError, VaultClient,
9-
};
7+
use crate::{Cipher, CipherError, CipherListView, CipherView, DecryptError, EncryptError};
108

119
#[cfg_attr(feature = "wasm", wasm_bindgen)]
1210
pub struct CiphersClient {
@@ -85,15 +83,6 @@ impl CiphersClient {
8583
}
8684
}
8785

88-
#[cfg_attr(feature = "wasm", wasm_bindgen)]
89-
impl VaultClient {
90-
pub fn ciphers(&self) -> CiphersClient {
91-
CiphersClient {
92-
client: self.client.clone(),
93-
}
94-
}
95-
}
96-
9786
#[cfg(test)]
9887
mod tests {
9988

crates/bitwarden-vault/src/collection_client.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use bitwarden_core::Client;
22

3-
use crate::{error::DecryptError, Collection, CollectionView, VaultClient};
3+
use crate::{error::DecryptError, Collection, CollectionView};
44

55
pub struct CollectionsClient {
66
pub(crate) client: Client,
@@ -23,14 +23,6 @@ impl CollectionsClient {
2323
}
2424
}
2525

26-
impl VaultClient {
27-
pub fn collections(&self) -> CollectionsClient {
28-
CollectionsClient {
29-
client: self.client.clone(),
30-
}
31-
}
32-
}
33-
3426
#[cfg(test)]
3527
mod tests {
3628
use bitwarden_core::client::test_accounts::test_bitwarden_com_account;

crates/bitwarden-vault/src/folder_client.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use wasm_bindgen::prelude::*;
44

55
use crate::{
66
error::{DecryptError, EncryptError},
7-
Folder, FolderView, VaultClient,
7+
Folder, FolderView,
88
};
99

1010
#[cfg_attr(feature = "wasm", wasm_bindgen)]
@@ -32,12 +32,3 @@ impl FoldersClient {
3232
Ok(views)
3333
}
3434
}
35-
36-
#[cfg_attr(feature = "wasm", wasm_bindgen)]
37-
impl VaultClient {
38-
pub fn folders(&self) -> FoldersClient {
39-
FoldersClient {
40-
client: self.client.clone(),
41-
}
42-
}
43-
}

crates/bitwarden-vault/src/password_history_client.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use bitwarden_core::Client;
22

3-
use crate::{DecryptError, EncryptError, PasswordHistory, PasswordHistoryView, VaultClient};
3+
use crate::{DecryptError, EncryptError, PasswordHistory, PasswordHistoryView};
44

55
pub struct PasswordHistoryClient {
66
pub(crate) client: Client,
@@ -25,11 +25,3 @@ impl PasswordHistoryClient {
2525
Ok(history_view)
2626
}
2727
}
28-
29-
impl VaultClient {
30-
pub fn password_history(&self) -> PasswordHistoryClient {
31-
PasswordHistoryClient {
32-
client: self.client.clone(),
33-
}
34-
}
35-
}

0 commit comments

Comments
 (0)