diff --git a/bitwarden_license/bitwarden-sm/src/error.rs b/bitwarden_license/bitwarden-sm/src/error.rs index 76203759b..51b45ffeb 100644 --- a/bitwarden_license/bitwarden-sm/src/error.rs +++ b/bitwarden_license/bitwarden-sm/src/error.rs @@ -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), diff --git a/crates/bitwarden-core/src/auth/auth_client.rs b/crates/bitwarden-core/src/auth/auth_client.rs index 9c9b2da8f..dd5f68ae3 100644 --- a/crates/bitwarden-core/src/auth/auth_client.rs +++ b/crates/bitwarden-core/src/auth/auth_client.rs @@ -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), } diff --git a/crates/bitwarden-core/src/auth/auth_request.rs b/crates/bitwarden-core/src/auth/auth_request.rs index a83cc6da0..0a9eb8425 100644 --- a/crates/bitwarden-core/src/auth/auth_request.rs +++ b/crates/bitwarden-core/src/auth/auth_request.rs @@ -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))] @@ -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. diff --git a/crates/bitwarden-core/src/auth/mod.rs b/crates/bitwarden-core/src/auth/mod.rs index 7d742b9a9..ab2d7619d 100644 --- a/crates/bitwarden-core/src/auth/mod.rs +++ b/crates/bitwarden-core/src/auth/mod.rs @@ -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. @@ -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)] diff --git a/crates/bitwarden-core/src/client/encryption_settings.rs b/crates/bitwarden-core/src/client/encryption_settings.rs index 2a8ff2c1c..533d4a079 100644 --- a/crates/bitwarden-core/src/client/encryption_settings.rs +++ b/crates/bitwarden-core/src/client/encryption_settings.rs @@ -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)] @@ -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, diff --git a/crates/bitwarden-core/src/error.rs b/crates/bitwarden-core/src/error.rs index 996d7d43d..b2b2054f7 100644 --- a/crates/bitwarden-core/src/error.rs +++ b/crates/bitwarden-core/src/error.rs @@ -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")] diff --git a/crates/bitwarden-core/src/key_management/crypto.rs b/crates/bitwarden-core/src/key_management/crypto.rs index f5253a9a7..8dade786e 100644 --- a/crates/bitwarden-core/src/key_management/crypto.rs +++ b/crates/bitwarden-core/src/key_management/crypto.rs @@ -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. @@ -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), @@ -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), } diff --git a/crates/bitwarden-core/src/lib.rs b/crates/bitwarden-core/src/lib.rs index a43745dea..95541ec3f 100644 --- a/crates/bitwarden-core/src/lib.rs +++ b/crates/bitwarden-core/src/lib.rs @@ -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; diff --git a/crates/bitwarden-core/src/platform/generate_fingerprint.rs b/crates/bitwarden-core/src/platform/generate_fingerprint.rs index 8de1702cd..74c968d55 100644 --- a/crates/bitwarden-core/src/platform/generate_fingerprint.rs +++ b/crates/bitwarden-core/src/platform/generate_fingerprint.rs @@ -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)] @@ -52,8 +52,6 @@ pub enum UserFingerprintError { #[error(transparent)] Crypto(#[from] bitwarden_crypto::CryptoError), #[error(transparent)] - VaultLocked(#[from] VaultLockedError), - #[error(transparent)] MissingPrivateKey(#[from] MissingPrivateKeyError), } diff --git a/crates/bitwarden-exporters/src/error.rs b/crates/bitwarden-exporters/src/error.rs index 062d7a9de..5f7f2c101 100644 --- a/crates/bitwarden-exporters/src/error.rs +++ b/crates/bitwarden-exporters/src/error.rs @@ -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), diff --git a/crates/bitwarden-fido/src/authenticator.rs b/crates/bitwarden-fido/src/authenticator.rs index ba1972d09..d0496da3e 100644 --- a/crates/bitwarden-fido/src/authenticator.rs +++ b/crates/bitwarden-fido/src/authenticator.rs @@ -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; @@ -30,8 +30,6 @@ pub enum GetSelectedCredentialError { #[error("No fido2 credentials found")] NoCredentialFound, - #[error(transparent)] - VaultLocked(#[from] VaultLockedError), #[error(transparent)] CryptoError(#[from] CryptoError), } @@ -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), @@ -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), @@ -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 @@ -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), @@ -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, diff --git a/crates/bitwarden-fido/src/client_fido.rs b/crates/bitwarden-fido/src/client_fido.rs index 49af1d10b..5c935ae2e 100644 --- a/crates/bitwarden-fido/src/client_fido.rs +++ b/crates/bitwarden-fido/src/client_fido.rs @@ -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), } diff --git a/crates/bitwarden-send/src/send_client.rs b/crates/bitwarden-send/src/send_client.rs index f703f47f4..1cd7edbe6 100644 --- a/crates/bitwarden-send/src/send_client.rs +++ b/crates/bitwarden-send/src/send_client.rs @@ -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 @@ -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. diff --git a/crates/bitwarden-vault/src/cipher/cipher.rs b/crates/bitwarden-vault/src/cipher/cipher.rs index a55a94911..9960b4f41 100644 --- a/crates/bitwarden-vault/src/cipher/cipher.rs +++ b/crates/bitwarden-vault/src/cipher/cipher.rs @@ -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, @@ -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), diff --git a/crates/bitwarden-vault/src/error.rs b/crates/bitwarden-vault/src/error.rs index e014da04a..c610cf63a 100644 --- a/crates/bitwarden-vault/src/error.rs +++ b/crates/bitwarden-vault/src/error.rs @@ -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, } @@ -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)] diff --git a/crates/bitwarden-vault/src/totp.rs b/crates/bitwarden-vault/src/totp.rs index 196182102..258a432ca 100644 --- a/crates/bitwarden-vault/src/totp.rs +++ b/crates/bitwarden-vault/src/totp.rs @@ -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}; @@ -41,8 +41,6 @@ pub enum TotpError { #[error(transparent)] CryptoError(#[from] CryptoError), - #[error(transparent)] - VaultLocked(#[from] VaultLockedError), } #[allow(missing_docs)]