d126d8e5a0
* placeholder handling of wg registration with upgrade mode token * include upgrade mode credentials as part of credential storage * introduce helper for decoding JWT payload * expose methods for removing emergency credentials from the storage * don't allow duplicate emergency credentials with the same content * added authenticator ClientMessage for upgrade mode check * retrieve credentials with longest expiration first * post rebasing fixes * fixed gateway config * feat: allow specifying minimum node performance for client init * nym-node UM improvements * fixed upgrade mode bandwidth on initial authentication * fix: logs and thresholds * expose attestation information from nym-node http api * additional logs * post rebasing fixes * make @simonwicky happy by removing empty lines in emergency_credential table definition * chore: remove '_' prefix for internal counters within in-mem ecash storage * improved import of 'UpgradeModeState' within the nym-node * use explicit time dependency within credential-storage * re-order imports within the gateway-client * moved 'AvailableBandwidth' definition to the monorepo
70 lines
2.2 KiB
Rust
70 lines
2.2 KiB
Rust
use nym_credentials_interface::TicketType;
|
|
use nym_sdk::mixnet::InputMessage;
|
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum AuthenticationClientError {
|
|
#[error("mixnet client stopped returning responses")]
|
|
NoMixnetMessagesReceived,
|
|
|
|
#[error("failed to send mixnet message")]
|
|
SendMixnetMessage(#[source] Box<tokio::sync::mpsc::error::SendError<InputMessage>>),
|
|
|
|
#[error("timeout waiting for connect response from exit gateway (authenticator)")]
|
|
TimeoutWaitingForConnectResponse,
|
|
|
|
#[error("unknown version number")]
|
|
UnknownVersion,
|
|
|
|
#[error("unsupported request version")]
|
|
UnsupportedVersion,
|
|
|
|
#[error(transparent)]
|
|
Bincode(#[from] bincode::Error),
|
|
|
|
#[error(transparent)]
|
|
AuthenticatorRequests(#[from] nym_authenticator_requests::Error),
|
|
|
|
#[error("verification failure")]
|
|
VerificationFailed(#[source] nym_authenticator_requests::Error),
|
|
|
|
#[error("failed to parse entry gateway socket addr")]
|
|
FailedToParseEntryGatewaySocketAddr(#[source] std::net::AddrParseError),
|
|
|
|
#[error("received invalid response from gateway authenticator")]
|
|
InvalidGatewayAuthResponse,
|
|
|
|
#[error("failed to get {ticketbook_type} ticket")]
|
|
GetTicket {
|
|
ticketbook_type: TicketType,
|
|
#[source]
|
|
source: nym_bandwidth_controller::error::BandwidthControllerError,
|
|
},
|
|
|
|
#[error("failed to retrieve upgrade mode token")]
|
|
UpgradeModeToken {
|
|
#[source]
|
|
source: nym_bandwidth_controller::error::BandwidthControllerError,
|
|
},
|
|
|
|
#[error("unknown authenticator version number")]
|
|
UnsupportedAuthenticatorVersion,
|
|
|
|
#[error("encountered an internal error")]
|
|
InternalError,
|
|
}
|
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum RegistrationError {
|
|
#[error(transparent)]
|
|
NoCredentialSent(AuthenticationClientError), // This intentionally doesn't use `from` to avoid random ? operator to land here when they shouldn't
|
|
|
|
#[error("an error occured after a credential was sent : {source}")]
|
|
CredentialSent {
|
|
#[source]
|
|
source: AuthenticationClientError,
|
|
},
|
|
}
|
|
|
|
// Result type based on our error type
|
|
pub(crate) type Result<T> = std::result::Result<T, AuthenticationClientError>;
|