Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions bitwarden_license/bitwarden-sm/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ pub enum SecretsManagerError {
#[error(transparent)]
ValidationError(ValidationError),
#[error(transparent)]
VaultLocked(#[from] bitwarden_core::VaultLockedError),
#[error(transparent)]
CryptoError(#[from] bitwarden_crypto::CryptoError),
#[error(transparent)]
Chrono(#[from] chrono::ParseError),
Expand Down
2 changes: 0 additions & 2 deletions crates/bitwarden-core/src/auth/auth_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ impl AuthClient {
#[cfg(feature = "internal")]
#[derive(Debug, thiserror::Error)]
pub enum TrustDeviceError {
#[error(transparent)]
VaultLocked(#[from] crate::VaultLockedError),
#[error(transparent)]
Crypto(#[from] bitwarden_crypto::CryptoError),
}
Expand Down
4 changes: 1 addition & 3 deletions crates/bitwarden-core/src/auth/auth_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use thiserror::Error;

#[cfg(feature = "internal")]
use crate::client::encryption_settings::EncryptionSettingsError;
use crate::{key_management::SymmetricKeyId, Client, VaultLockedError};
use crate::{key_management::SymmetricKeyId, Client};

/// Response for `new_auth_request`.
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
Expand Down Expand Up @@ -78,8 +78,6 @@ pub(crate) fn auth_request_decrypt_master_key(
pub enum ApproveAuthRequestError {
#[error(transparent)]
Crypto(#[from] CryptoError),
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
}

/// Approve an auth request.
Expand Down
4 changes: 1 addition & 3 deletions crates/bitwarden-core/src/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use thiserror::Error;

use crate::{NotAuthenticatedError, VaultLockedError, WrongPasswordError};
use crate::{NotAuthenticatedError, WrongPasswordError};

mod access_token;
// API is intentionally not visible outside of `auth` as these should be considered private.
Expand Down Expand Up @@ -56,8 +56,6 @@ pub enum AuthValidateError {
NotAuthenticated(#[from] NotAuthenticatedError),
#[error(transparent)]
WrongPassword(#[from] WrongPasswordError),
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
#[error("wrong user key")]
WrongUserKey,
#[error(transparent)]
Expand Down
5 changes: 1 addition & 4 deletions crates/bitwarden-core/src/client/encryption_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::key_management::{AsymmetricKeyId, SecurityState, SignedSecurityState,
use crate::key_management::{KeyIds, SymmetricKeyId};
#[cfg(any(feature = "secrets", feature = "internal"))]
use crate::OrganizationId;
use crate::{error::UserIdAlreadySetError, MissingPrivateKeyError, VaultLockedError};
use crate::{error::UserIdAlreadySetError, MissingPrivateKeyError};

#[allow(missing_docs)]
#[bitwarden_error(flat)]
Expand All @@ -28,9 +28,6 @@ pub enum EncryptionSettingsError {
#[error("Cryptography error, {0}")]
Crypto(#[from] bitwarden_crypto::CryptoError),

#[error(transparent)]
VaultLocked(#[from] VaultLockedError),

#[error("Invalid private key")]
InvalidPrivateKey,

Expand Down
5 changes: 0 additions & 5 deletions crates/bitwarden-core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ pub struct UserIdAlreadySetError;
#[error("The response received was missing a required field: {0}")]
pub struct MissingFieldError(pub &'static str);

/// Client vault is locked.
#[derive(Debug, Error)]
#[error("The client vault is locked and needs to be unlocked before use")]
pub struct VaultLockedError;

/// Wrong password.
#[derive(Debug, thiserror::Error)]
#[error("Wrong password")]
Expand Down
6 changes: 1 addition & 5 deletions crates/bitwarden-core/src/key_management/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::{
non_generic_wrappers::PasswordProtectedKeyEnvelope, AsymmetricKeyId, SecurityState,
SignedSecurityState, SigningKeyId, SymmetricKeyId,
},
Client, NotAuthenticatedError, OrganizationId, UserId, VaultLockedError, WrongPasswordError,
Client, NotAuthenticatedError, OrganizationId, UserId, WrongPasswordError,
};

/// Catch all error for mobile crypto operations.
Expand All @@ -38,8 +38,6 @@ pub enum CryptoClientError {
#[error(transparent)]
NotAuthenticated(#[from] NotAuthenticatedError),
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
#[error(transparent)]
Crypto(#[from] bitwarden_crypto::CryptoError),
#[error(transparent)]
PasswordProtectedKeyEnvelope(#[from] PasswordProtectedKeyEnvelopeError),
Expand Down Expand Up @@ -444,8 +442,6 @@ fn derive_pin_protected_user_key(
#[bitwarden_error(flat)]
#[derive(Debug, thiserror::Error)]
pub enum EnrollAdminPasswordResetError {
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
#[error(transparent)]
Crypto(#[from] bitwarden_crypto::CryptoError),
}
Expand Down
3 changes: 1 addition & 2 deletions crates/bitwarden-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ pub mod client;
mod error;
pub mod key_management;
pub use error::{
ApiError, MissingFieldError, MissingPrivateKeyError, NotAuthenticatedError, VaultLockedError,
WrongPasswordError,
ApiError, MissingFieldError, MissingPrivateKeyError, NotAuthenticatedError, WrongPasswordError,
};
#[cfg(feature = "internal")]
pub mod mobile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use bitwarden_encoding::B64;
use serde::{Deserialize, Serialize};
use thiserror::Error;

use crate::{key_management::AsymmetricKeyId, MissingPrivateKeyError, VaultLockedError};
use crate::{key_management::AsymmetricKeyId, MissingPrivateKeyError};

/// Request to generate a fingerprint.
#[derive(Serialize, Deserialize, Debug)]
Expand Down Expand Up @@ -52,8 +52,6 @@ pub enum UserFingerprintError {
#[error(transparent)]
Crypto(#[from] bitwarden_crypto::CryptoError),
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
#[error(transparent)]
MissingPrivateKey(#[from] MissingPrivateKeyError),
}

Expand Down
2 changes: 0 additions & 2 deletions crates/bitwarden-exporters/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ pub enum ExportError {
MissingField(#[from] bitwarden_core::MissingFieldError),
#[error(transparent)]
NotAuthenticated(#[from] bitwarden_core::NotAuthenticatedError),
#[error(transparent)]
VaultLocked(#[from] bitwarden_core::VaultLockedError),

#[error("CSV error: {0}")]
Csv(#[from] crate::csv::CsvError),
Expand Down
20 changes: 4 additions & 16 deletions crates/bitwarden-fido/src/authenticator.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Mutex;

use bitwarden_core::{Client, VaultLockedError};
use bitwarden_core::Client;
use bitwarden_crypto::CryptoError;
use bitwarden_vault::{CipherError, CipherView, EncryptionContext};
use itertools::Itertools;
Expand Down Expand Up @@ -30,8 +30,6 @@ pub enum GetSelectedCredentialError {
#[error("No fido2 credentials found")]
NoCredentialFound,

#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
#[error(transparent)]
CryptoError(#[from] CryptoError),
}
Expand Down Expand Up @@ -74,8 +72,6 @@ pub enum SilentlyDiscoverCredentialsError {
#[error(transparent)]
CipherError(#[from] CipherError),
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
#[error(transparent)]
InvalidGuid(#[from] InvalidGuid),
#[error(transparent)]
Fido2CallbackError(#[from] Fido2CallbackError),
Expand All @@ -89,8 +85,6 @@ pub enum CredentialsForAutofillError {
#[error(transparent)]
CipherError(#[from] CipherError),
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
#[error(transparent)]
InvalidGuid(#[from] InvalidGuid),
#[error(transparent)]
Fido2CallbackError(#[from] Fido2CallbackError),
Expand Down Expand Up @@ -359,13 +353,11 @@ impl passkey::authenticator::CredentialStore for CredentialStoreImpl<'_> {
#[derive(Debug, Error)]
enum InnerError {
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
Cipher(#[from] CipherError),
#[error(transparent)]
CipherError(#[from] CipherError),
Crypto(#[from] CryptoError),
#[error(transparent)]
CryptoError(#[from] CryptoError),
#[error(transparent)]
Fido2CallbackError(#[from] Fido2CallbackError),
Fido2Callback(#[from] Fido2CallbackError),
}

// This is just a wrapper around the actual implementation to allow for ? error handling
Expand Down Expand Up @@ -443,8 +435,6 @@ impl passkey::authenticator::CredentialStore for CredentialStoreImpl<'_> {
#[error("Client User Id has not been set")]
MissingUserId,
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
#[error(transparent)]
FillCredentialError(#[from] FillCredentialError),
#[error(transparent)]
CipherError(#[from] CipherError),
Expand Down Expand Up @@ -521,8 +511,6 @@ impl passkey::authenticator::CredentialStore for CredentialStoreImpl<'_> {
#[error("Client User Id has not been set")]
MissingUserId,
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
#[error(transparent)]
InvalidGuid(#[from] InvalidGuid),
#[error("Credential ID does not match selected credential")]
CredentialIdMismatch,
Expand Down
2 changes: 0 additions & 2 deletions crates/bitwarden-fido/src/client_fido.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ pub struct ClientFido2 {
#[allow(missing_docs)]
#[derive(Debug, Error)]
pub enum DecryptFido2AutofillCredentialsError {
#[error(transparent)]
VaultLocked(#[from] bitwarden_core::VaultLockedError),
#[error(transparent)]
Fido2CredentialAutofillViewError(#[from] Fido2CredentialAutofillViewError),
}
Expand Down
4 changes: 0 additions & 4 deletions crates/bitwarden-send/src/send_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ use crate::{Send, SendListView, SendView};
pub enum SendEncryptError {
#[error(transparent)]
Crypto(#[from] bitwarden_crypto::CryptoError),
#[error(transparent)]
VaultLocked(#[from] bitwarden_core::VaultLockedError),
}

/// Generic error type for send decryption errors
Expand All @@ -24,8 +22,6 @@ pub enum SendEncryptError {
pub enum SendDecryptError {
#[error(transparent)]
Crypto(#[from] bitwarden_crypto::CryptoError),
#[error(transparent)]
VaultLocked(#[from] bitwarden_core::VaultLockedError),
}

/// Generic error type for send encryption errors.
Expand Down
4 changes: 1 addition & 3 deletions crates/bitwarden-vault/src/cipher/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bitwarden_api_api::models::CipherDetailsResponseModel;
use bitwarden_collections::collection::CollectionId;
use bitwarden_core::{
key_management::{KeyIds, SymmetricKeyId},
require, MissingFieldError, OrganizationId, UserId, VaultLockedError,
require, MissingFieldError, OrganizationId, UserId,
};
use bitwarden_crypto::{
CompositeEncryptable, CryptoError, Decryptable, EncString, IdentifyKey, KeyStoreContext,
Expand Down Expand Up @@ -42,8 +42,6 @@ pub enum CipherError {
#[error(transparent)]
MissingFieldError(#[from] MissingFieldError),
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
#[error(transparent)]
CryptoError(#[from] CryptoError),
#[error(transparent)]
EncryptError(#[from] EncryptError),
Expand Down
4 changes: 0 additions & 4 deletions crates/bitwarden-vault/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use thiserror::Error;
pub enum EncryptError {
#[error(transparent)]
Crypto(#[from] bitwarden_crypto::CryptoError),
#[error(transparent)]
VaultLocked(#[from] bitwarden_core::VaultLockedError),
#[error("Client User Id has not been set")]
MissingUserId,
}
Expand All @@ -21,8 +19,6 @@ pub enum EncryptError {
pub enum DecryptError {
#[error(transparent)]
Crypto(#[from] bitwarden_crypto::CryptoError),
#[error(transparent)]
VaultLocked(#[from] bitwarden_core::VaultLockedError),
}

#[allow(missing_docs)]
Expand Down
4 changes: 1 addition & 3 deletions crates/bitwarden-vault/src/totp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
str::FromStr,
};

use bitwarden_core::{key_management::KeyIds, VaultLockedError};
use bitwarden_core::key_management::KeyIds;
use bitwarden_crypto::{CryptoError, KeyStoreContext};
use bitwarden_error::bitwarden_error;
use chrono::{DateTime, Utc};
Expand Down Expand Up @@ -41,8 +41,6 @@ pub enum TotpError {

#[error(transparent)]
CryptoError(#[from] CryptoError),
#[error(transparent)]
VaultLocked(#[from] VaultLockedError),
}

#[allow(missing_docs)]
Expand Down
Loading