Skip to content

Commit

Permalink
Mark exporters and generators as internal dependencies (#660)
Browse files Browse the repository at this point in the history
We accidentally exposed exporters and generators without feature
flagging them. This PR properly puts them under the internal feature
flag.
  • Loading branch information
Hinton authored Mar 14, 2024
1 parent aaa6466 commit dd440ba
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/bitwarden-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rust-version = "1.71"
[features]
default = []

mobile = ["uniffi"]
mobile = ["dep:uniffi"] # Mobile-specific features

[dependencies]
aes = { version = ">=0.8.2, <0.9", features = ["zeroize"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/bitwarden-generators/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition = "2021"
rust-version = "1.71"

[features]
mobile = ["uniffi"] # Mobile-specific features
mobile = ["dep:uniffi"] # Mobile-specific features

[dependencies]
bitwarden-crypto = { path = "../bitwarden-crypto", version = "=0.1.0" }
Expand Down
11 changes: 7 additions & 4 deletions crates/bitwarden/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ rust-version = "1.71"
default = ["secrets"]

secrets = [] # Secrets manager API
internal = [] # Internal testing methods
internal = [
"dep:bitwarden-exporters",
"dep:bitwarden-generators",
] # Internal testing methods
mobile = [
"uniffi",
"internal",
"dep:uniffi",
"bitwarden-crypto/mobile",
"bitwarden-generators/mobile",
] # Mobile-specific features
Expand All @@ -31,8 +34,8 @@ base64 = ">=0.21.2, <0.22"
bitwarden-api-api = { path = "../bitwarden-api-api", version = "=0.2.3" }
bitwarden-api-identity = { path = "../bitwarden-api-identity", version = "=0.2.3" }
bitwarden-crypto = { path = "../bitwarden-crypto", version = "=0.1.0" }
bitwarden-exporters = { path = "../bitwarden-exporters", version = "0.1.0" }
bitwarden-generators = { path = "../bitwarden-generators", version = "0.1.0" }
bitwarden-exporters = { path = "../bitwarden-exporters", version = "0.1.0", optional = true }
bitwarden-generators = { path = "../bitwarden-generators", version = "0.1.0", optional = true }
chrono = { version = ">=0.4.26, <0.5", features = [
"clock",
"serde",
Expand Down
6 changes: 6 additions & 0 deletions crates/bitwarden/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use std::{borrow::Cow, fmt::Debug};

use bitwarden_api_api::apis::Error as ApiError;
use bitwarden_api_identity::apis::Error as IdentityError;
#[cfg(feature = "internal")]
use bitwarden_exporters::ExportError;
#[cfg(feature = "internal")]
use bitwarden_generators::{PassphraseError, PasswordError, UsernameError};
use reqwest::StatusCode;
use thiserror::Error;
Expand Down Expand Up @@ -52,13 +54,17 @@ pub enum Error {
InvalidStateFile,

// Generators
#[cfg(feature = "internal")]
#[error(transparent)]
UsernameError(#[from] UsernameError),
#[cfg(feature = "internal")]
#[error(transparent)]
PassphraseError(#[from] PassphraseError),
#[cfg(feature = "internal")]
#[error(transparent)]
PasswordError(#[from] PasswordError),

#[cfg(feature = "internal")]
#[error(transparent)]
ExportError(#[from] ExportError),

Expand Down
1 change: 1 addition & 0 deletions crates/bitwarden/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub use client::Client;
#[doc = include_str!("../README.md")]
mod readme {}

#[cfg(feature = "internal")]
pub mod generators {
pub use bitwarden_generators::{
PassphraseGeneratorRequest, PasswordGeneratorRequest, UsernameGeneratorRequest,
Expand Down

0 comments on commit dd440ba

Please sign in to comment.