bitwarden_core/auth/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use thiserror::Error;

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

mod access_token;
pub(super) mod api;
pub mod auth_client;
mod jwt_token;
pub mod login;
#[cfg(feature = "internal")]
pub mod password;
#[cfg(feature = "internal")]
pub mod pin;
pub mod renew;
pub use access_token::{AccessToken, AccessTokenInvalidError};
pub use jwt_token::*;

#[cfg(feature = "internal")]
mod auth_request;
#[cfg(feature = "internal")]
pub(crate) use auth_request::{auth_request_decrypt_master_key, auth_request_decrypt_user_key};
#[cfg(feature = "internal")]
pub use auth_request::{ApproveAuthRequestError, AuthRequestResponse};

#[cfg(feature = "internal")]
mod register;
#[cfg(feature = "internal")]
pub use register::{RegisterError, RegisterKeyResponse, RegisterRequest};

#[cfg(feature = "internal")]
mod tde;
#[cfg(feature = "internal")]
pub use tde::RegisterTdeKeyResponse;
#[cfg(feature = "internal")]
mod key_connector;
#[cfg(feature = "internal")]
pub use key_connector::KeyConnectorResponse;

#[derive(Debug, Error)]
pub enum AuthValidateError {
    #[error(transparent)]
    NotAuthenticated(#[from] NotAuthenticatedError),
    #[error(transparent)]
    WrongPassword(#[from] WrongPasswordError),
    #[error(transparent)]
    VaultLocked(#[from] VaultLockedError),
    #[error("wrong user key")]
    WrongUserKey,
    #[error(transparent)]
    Crypto(#[from] bitwarden_crypto::CryptoError),
}