Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
zaneschepke committed Jan 9, 2025
1 parent 02a3439 commit 8fd2eb4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ pub enum AccountCommandError {
#[error("no device stored")]
NoDeviceStored,

#[error("device registration is in progress")]
RegistrationInProgress,

#[error("failed to remove account: {0}")]
RemoveAccount(String),

Expand Down
30 changes: 14 additions & 16 deletions nym-vpn-core/crates/nym-vpn-account-controller/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@

use std::{path::PathBuf, sync::Arc, time::Duration};

use nym_http_api_client::UserAgent;
use nym_vpn_api_client::{
response::{NymVpnDevice, NymVpnUsage},
types::{DeviceStatus, VpnApiAccount},
};
use nym_vpn_network_config::Network;
use nym_vpn_store::{mnemonic::Mnemonic, VpnStorage};
use tokio::{
sync::mpsc::{UnboundedReceiver, UnboundedSender},
task::{JoinError, JoinSet},
};
use tokio_util::sync::CancellationToken;

use crate::{
commands::{
register_device::RegisterDeviceCommandHandler,
Expand All @@ -16,19 +29,6 @@ use crate::{
storage::{AccountStorage, VpnCredentialStorage},
AccountControllerCommander, AvailableTicketbooks,
};
use nym_http_api_client::UserAgent;
use nym_vpn_api_client::types::DeviceStatus;
use nym_vpn_api_client::{
response::{NymVpnDevice, NymVpnUsage},
types::VpnApiAccount,
};
use nym_vpn_network_config::Network;
use nym_vpn_store::{mnemonic::Mnemonic, VpnStorage};
use tokio::{
sync::mpsc::{UnboundedReceiver, UnboundedSender},
task::{JoinError, JoinSet},
};
use tokio_util::sync::CancellationToken;

// The interval at which we automatically request zk-nyms
const ZK_NYM_AUTOMATIC_REQUEST_INTERVAL: Duration = Duration::from_secs(6 * 60);
Expand Down Expand Up @@ -355,9 +355,7 @@ where
if self.shared_state().is_ready_to_register_device().await
== ReadyToRegisterDevice::InProgress
{
return Err(AccountCommandError::Internal(
"Device registration in progress".to_owned(),
));
return Err(AccountCommandError::RegistrationInProgress);
}

let device = self
Expand Down

0 comments on commit 8fd2eb4

Please sign in to comment.