allow offline verification flag
This commit is contained in:
@@ -45,6 +45,7 @@ pub(crate) struct OverrideConfig {
|
||||
pub(crate) mnemonic: Option<bip39::Mnemonic>,
|
||||
pub(crate) nyxd_urls: Option<Vec<url::Url>>,
|
||||
pub(crate) only_coconut_credentials: Option<bool>,
|
||||
pub(crate) offline_credential_verification: Option<bool>,
|
||||
pub(crate) with_network_requester: Option<bool>,
|
||||
pub(crate) with_ip_packet_router: Option<bool>,
|
||||
}
|
||||
@@ -81,6 +82,10 @@ impl OverrideConfig {
|
||||
Config::with_only_coconut_credentials,
|
||||
self.only_coconut_credentials,
|
||||
)
|
||||
.with_optional(
|
||||
Config::with_offline_credential_verification,
|
||||
self.offline_credential_verification,
|
||||
)
|
||||
.with_optional(
|
||||
Config::with_enabled_network_requester,
|
||||
self.with_network_requester,
|
||||
|
||||
@@ -73,6 +73,10 @@ pub struct Run {
|
||||
#[arg(long, hide = true)]
|
||||
only_coconut_credentials: Option<bool>,
|
||||
|
||||
/// Set this gateway to use offline credentials verification
|
||||
#[clap(long, hide = true)]
|
||||
offline_credential_verification: Option<bool>,
|
||||
|
||||
/// Enable/disable gateway anonymized statistics that get sent to a statistics aggregator server
|
||||
#[arg(long)]
|
||||
enabled_statistics: Option<bool>,
|
||||
@@ -151,6 +155,7 @@ impl From<Run> for OverrideConfig {
|
||||
statistics_service_url: run_config.statistics_service_url,
|
||||
nyxd_urls: run_config.nyxd_urls,
|
||||
only_coconut_credentials: run_config.only_coconut_credentials,
|
||||
offline_credential_verification: run_config.offline_credential_verification,
|
||||
with_network_requester: run_config.with_network_requester,
|
||||
with_ip_packet_router: run_config.with_ip_packet_router,
|
||||
}
|
||||
|
||||
@@ -232,6 +232,14 @@ impl Config {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_offline_credential_verification(
|
||||
mut self,
|
||||
offline_credential_verification: bool,
|
||||
) -> Self {
|
||||
self.gateway.offline_credential_verification = offline_credential_verification;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_enabled_statistics(mut self, enabled_statistics: bool) -> Self {
|
||||
self.gateway.enabled_statistics = enabled_statistics;
|
||||
self
|
||||
@@ -395,6 +403,10 @@ pub struct Gateway {
|
||||
#[serde(default)]
|
||||
pub only_coconut_credentials: bool,
|
||||
|
||||
/// Indicates whether this gateway is using offline mode for credential verification
|
||||
#[serde(default)]
|
||||
pub offline_credential_verification: bool,
|
||||
|
||||
/// Address to which this mixnode will bind to and will be listening for packets.
|
||||
#[zeroize(skip)]
|
||||
pub listening_address: IpAddr,
|
||||
@@ -443,6 +455,7 @@ impl Gateway {
|
||||
version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
id: id.into(),
|
||||
only_coconut_credentials: false,
|
||||
offline_credential_verification: false,
|
||||
listening_address: inaddr_any(),
|
||||
mix_port: DEFAULT_MIX_LISTENING_PORT,
|
||||
clients_port: DEFAULT_CLIENT_LISTENING_PORT,
|
||||
|
||||
@@ -115,6 +115,9 @@ impl From<ConfigV1_1_31> for Config {
|
||||
version: value.gateway.version,
|
||||
id: value.gateway.id,
|
||||
only_coconut_credentials: value.gateway.only_coconut_credentials,
|
||||
// \/ ADDED
|
||||
offline_credential_verification: false,
|
||||
// /\ ADDED
|
||||
listening_address: value.gateway.listening_address,
|
||||
mix_port: value.gateway.mix_port,
|
||||
clients_port: value.gateway.clients_port,
|
||||
|
||||
@@ -33,6 +33,9 @@ id = '{{ gateway.id }}'
|
||||
# the mixnet, or if it also accepts non-paying clients
|
||||
only_coconut_credentials = {{ gateway.only_coconut_credentials }}
|
||||
|
||||
# Indicates whether this gateway is using offline mode for credential verification
|
||||
offline_credential_verification = {{ gateway.offline_credential_verification }}
|
||||
|
||||
# Socket address to which this gateway will bind to and will be listening for packets.
|
||||
listening_address = '{{ gateway.listening_address }}'
|
||||
|
||||
|
||||
@@ -413,6 +413,7 @@ async fn migrate_gateway(mut args: Args) -> Result<(), NymNodeError> {
|
||||
config::EntryGatewayConfig {
|
||||
storage_paths: config::persistence::EntryGatewayPaths::new(&data_dir),
|
||||
enforce_zk_nyms: cfg.gateway.only_coconut_credentials,
|
||||
offline_zk_nyms: cfg.gateway.offline_credential_verification,
|
||||
bind_address: SocketAddr::new(ip, cfg.gateway.clients_port),
|
||||
announce_ws_port: None,
|
||||
announce_wss_port: cfg.gateway.clients_wss_port,
|
||||
|
||||
@@ -23,6 +23,9 @@ pub struct EntryGatewayConfig {
|
||||
/// or if it also accepts non-paying clients
|
||||
pub enforce_zk_nyms: bool,
|
||||
|
||||
/// Indicates whether this gateway uses offline zk-nyms verification
|
||||
pub offline_zk_nyms: bool,
|
||||
|
||||
/// Socket address this node will use for binding its client websocket API.
|
||||
/// default: `0.0.0.0:9000`
|
||||
pub bind_address: SocketAddr,
|
||||
@@ -66,6 +69,7 @@ impl EntryGatewayConfig {
|
||||
EntryGatewayConfig {
|
||||
storage_paths: EntryGatewayPaths::new(data_dir),
|
||||
enforce_zk_nyms: false,
|
||||
offline_zk_nyms: false,
|
||||
bind_address: SocketAddr::new(inaddr_any(), DEFAULT_WS_PORT),
|
||||
announce_ws_port: None,
|
||||
announce_wss_port: None,
|
||||
|
||||
@@ -44,6 +44,7 @@ pub fn ephemeral_gateway_config(
|
||||
version: format!("{}-nym-node", crate_version!()),
|
||||
id: config.id,
|
||||
only_coconut_credentials: config.entry_gateway.enforce_zk_nyms,
|
||||
offline_credential_verification: config.entry_gateway.offline_zk_nyms,
|
||||
listening_address: clients_bind_ip,
|
||||
mix_port: config.mixnet.bind_address.port(),
|
||||
clients_port: config.entry_gateway.bind_address.port(),
|
||||
|
||||
Reference in New Issue
Block a user