From 1aad5fc1bf8a7257d57f1fb1cbada898db9912e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Wed, 28 Feb 2024 11:22:46 +0000 Subject: [PATCH 01/35] created nym-id for importing credentials --- Cargo.lock | 26 ++++ Cargo.toml | 2 +- common/commands/src/coconut/check_pass.rs | 112 ++++++++++++++++++ .../src/coconut/bandwidth/issuance.rs | 20 +++- .../src/coconut/bandwidth/issued.rs | 31 ++++- common/credentials/src/error.rs | 15 ++- common/credentials/src/lib.rs | 1 + common/nym-id-lib/Cargo.toml | 20 ++++ common/nym-id-lib/src/error.rs | 20 ++++ common/nym-id-lib/src/import_credential.rs | 71 +++++++++++ common/nym-id-lib/src/lib.rs | 11 ++ nym-id/Cargo.toml | 22 ++++ nym-id/src/commands/build_info.rs | 15 +++ nym-id/src/commands/import_credential.rs | 48 ++++++++ nym-id/src/commands/mod.rs | 46 +++++++ nym-id/src/commands/setup.rs | 3 + nym-id/src/main.rs | 19 +++ 17 files changed, 477 insertions(+), 5 deletions(-) create mode 100644 common/commands/src/coconut/check_pass.rs create mode 100644 common/nym-id-lib/Cargo.toml create mode 100644 common/nym-id-lib/src/error.rs create mode 100644 common/nym-id-lib/src/import_credential.rs create mode 100644 common/nym-id-lib/src/lib.rs create mode 100644 nym-id/Cargo.toml create mode 100644 nym-id/src/commands/build_info.rs create mode 100644 nym-id/src/commands/import_credential.rs create mode 100644 nym-id/src/commands/mod.rs create mode 100644 nym-id/src/commands/setup.rs create mode 100644 nym-id/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 7dcb192b24..dd14db56db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5626,6 +5626,32 @@ dependencies = [ "serde", ] +[[package]] +name = "nym-id" +version = "0.1.0" +dependencies = [ + "anyhow", + "bs58 0.5.0", + "clap 4.4.7", + "nym-bin-common", + "nym-credential-storage", + "nym-id-lib", + "tokio", + "tracing", +] + +[[package]] +name = "nym-id-lib" +version = "0.1.0" +dependencies = [ + "nym-credential-storage", + "nym-credentials", + "thiserror", + "time", + "tracing", + "zeroize", +] + [[package]] name = "nym-inclusion-probability" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 6e78dea995..040b5132a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,7 +112,7 @@ members = [ "wasm/client", # "wasm/full-nym-wasm", "wasm/mix-fetch", - "wasm/node-tester", + "wasm/node-tester", "nym-id", "common/nym-id-lib", ] default-members = [ diff --git a/common/commands/src/coconut/check_pass.rs b/common/commands/src/coconut/check_pass.rs new file mode 100644 index 0000000000..ef02d80722 --- /dev/null +++ b/common/commands/src/coconut/check_pass.rs @@ -0,0 +1,112 @@ +// Copyright 2024 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use crate::context::{QueryClient, SigningClient}; +use anyhow::{anyhow, bail}; +use clap::ArgGroup; +use clap::Parser; +use futures::StreamExt; +use log::{error, info}; +use nym_coconut_dkg_common::types::EpochId; +use nym_credential_utils::utils::block_until_coconut_is_available; +use nym_credentials::coconut::bandwidth::bandwidth_credential_params; +use nym_credentials::coconut::bandwidth::freepass::MAX_FREE_PASS_VALIDITY; +use nym_credentials::coconut::utils; +use nym_credentials::{ + obtain_aggregate_verification_key, IssuanceBandwidthCredential, IssuedBandwidthCredential, +}; +use nym_credentials_interface::VerificationKey; +use nym_validator_client::coconut::all_coconut_api_clients; +use nym_validator_client::nyxd::contract_traits::{DkgQueryClient, NymContractsProvider}; +use nym_validator_client::nyxd::CosmWasmClient; +use nym_validator_client::signing::AccountData; +use nym_validator_client::CoconutApiClient; +use std::fs; +use std::fs::File; +use std::io::Write; +use std::path::PathBuf; +use std::sync::Arc; +use time::format_description::well_known::Rfc3339; +use time::OffsetDateTime; +use zeroize::Zeroizing; + +#[derive(Debug, Parser)] +pub struct Args { + /// Path to the output directory for generated free passes. + #[clap(long)] + pub(crate) pass: PathBuf, +} + +// async fn get_freepass( +// api_clients: Vec, +// aggregate_vk: &VerificationKey, +// threshold: u64, +// epoch_id: EpochId, +// signing_account: &AccountData, +// expiration_date: OffsetDateTime, +// ) -> anyhow::Result { +// let issuance_pass = IssuanceBandwidthCredential::new_freepass(Some(expiration_date)); +// let signing_data = issuance_pass.prepare_for_signing(); +// +// let credential_shares = Arc::new(tokio::sync::Mutex::new(Vec::new())); +// +// futures::stream::iter(api_clients) +// .for_each_concurrent(None, |client| async { +// // move the client into the block +// let client = client; +// let api_url = client.api_client.api_url(); +// +// info!("contacting {api_url} for blinded free pass"); +// +// match issuance_pass +// .obtain_partial_freepass_credential( +// &client.api_client, +// signing_account, +// &client.verification_key, +// signing_data.clone(), +// ) +// .await +// { +// Ok(partial_credential) => { +// credential_shares +// .lock() +// .await +// .push((partial_credential, client.node_id).into()); +// } +// Err(err) => { +// error!("failed to obtain partial free pass from {api_url}: {err}") +// } +// } +// }) +// .await; +// +// // SAFETY: the futures have completed, so we MUST have the only arc reference +// #[allow(clippy::unwrap_used)] +// let credential_shares = Arc::into_inner(credential_shares).unwrap().into_inner(); +// +// if credential_shares.len() < threshold as usize { +// bail!("we managed to obtain only {} partial credentials while the minimum threshold is {threshold}", credential_shares.len()); +// } +// +// let signature = issuance_pass.aggregate_signature_shares(aggregate_vk, &credential_shares)?; +// Ok(issuance_pass.into_issued_credential(signature, epoch_id)) +// } + +pub async fn execute(args: Args, client: QueryClient) -> anyhow::Result<()> { + let raw_credential = fs::read(args.pass)?; + let credential = IssuedBandwidthCredential::unpack_v1(&raw_credential)?; + + println!("{:?}", credential.get_plain_public_attributes()); + println!("{}", credential.epoch_id()); + println!("{:?}", credential.variant_data()); + + let api_clients = all_coconut_api_clients(&client, credential.epoch_id()).await?; + + let vk = utils::obtain_aggregate_verification_key(&api_clients)?; + + let foomp = credential.prepare_for_spending(&vk)?; + + let res = foomp.verify(bandwidth_credential_params(), &vk); + println!("res: {res}"); + Ok(()) +} diff --git a/common/credentials/src/coconut/bandwidth/issuance.rs b/common/credentials/src/coconut/bandwidth/issuance.rs index bc56bda0fd..53c89a300b 100644 --- a/common/credentials/src/coconut/bandwidth/issuance.rs +++ b/common/credentials/src/coconut/bandwidth/issuance.rs @@ -315,9 +315,12 @@ impl IssuanceBandwidthCredential { } // TODO: is that actually needed? + // idea: make it consistent with the issued credential and its vX serde pub fn try_from_recovered_bytes(bytes: &[u8]) -> Result { use bincode::Options; - Ok(make_recovery_bincode_serializer().deserialize(bytes)?) + make_recovery_bincode_serializer() + .deserialize(bytes) + .map_err(|source| Error::RecoveryCredentialDeserializationFailure { source }) } } @@ -327,3 +330,18 @@ fn make_recovery_bincode_serializer() -> impl bincode::Options { .with_big_endian() .with_varint_encoding() } + +#[cfg(test)] +mod tests { + use super::*; + + fn assert_zeroize_on_drop() {} + + fn assert_zeroize() {} + + #[test] + fn credential_is_zeroized() { + assert_zeroize::(); + assert_zeroize_on_drop::(); + } +} diff --git a/common/credentials/src/coconut/bandwidth/issued.rs b/common/credentials/src/coconut/bandwidth/issued.rs index 486fd7c7ee..5e2951d1d6 100644 --- a/common/credentials/src/coconut/bandwidth/issued.rs +++ b/common/credentials/src/coconut/bandwidth/issued.rs @@ -116,6 +116,15 @@ impl IssuedBandwidthCredential { } } + pub fn try_unpack(bytes: &[u8], revision: impl Into>) -> Result { + let revision = revision.into().unwrap_or(CURRENT_SERIALIZATION_REVISION); + + match revision { + 1 => Self::unpack_v1(bytes), + _ => Err(Error::UnknownSerializationRevision { revision }), + } + } + pub fn epoch_id(&self) -> EpochId { self.epoch_id } @@ -138,7 +147,12 @@ impl IssuedBandwidthCredential { /// Unpack (deserialize) the credential data from the given bytes using v1 serializer. pub fn unpack_v1(bytes: &[u8]) -> Result { use bincode::Options; - Ok(make_storable_bincode_serializer().deserialize(bytes)?) + make_storable_bincode_serializer() + .deserialize(bytes) + .map_err(|source| Error::SerializationFailure { + source, + revision: 1, + }) } pub fn randomise_signature(&mut self) { @@ -191,3 +205,18 @@ fn make_storable_bincode_serializer() -> impl bincode::Options { .with_big_endian() .with_varint_encoding() } + +#[cfg(test)] +mod tests { + use super::*; + + fn assert_zeroize_on_drop() {} + + fn assert_zeroize() {} + + #[test] + fn credential_is_zeroized() { + assert_zeroize::(); + assert_zeroize_on_drop::(); + } +} diff --git a/common/credentials/src/error.rs b/common/credentials/src/error.rs index 96d8bf4202..6487d23870 100644 --- a/common/credentials/src/error.rs +++ b/common/credentials/src/error.rs @@ -5,6 +5,7 @@ use nym_credentials_interface::CoconutError; use nym_crypto::asymmetric::encryption::KeyRecoveryError; use nym_validator_client::ValidatorClientError; +use crate::coconut::bandwidth::issued::CURRENT_SERIALIZATION_REVISION; use thiserror::Error; #[derive(Debug, Error)] @@ -12,8 +13,18 @@ pub enum Error { #[error("IO error")] IOError(#[from] std::io::Error), - #[error("failed to (de)serialize credential structure: {0}")] - SerializationFailure(#[from] bincode::Error), + #[error("failed to deserialize a recovery credential: {source}")] + RecoveryCredentialDeserializationFailure { source: bincode::Error }, + + #[error("failed to (de)serialize provided credential using revision {revision}: {source}")] + SerializationFailure { + #[source] + source: bincode::Error, + revision: u8, + }, + + #[error("unknown credential serializatio revision {revision}. the current (and max supported) version is {CURRENT_SERIALIZATION_REVISION}")] + UnknownSerializationRevision { revision: u8 }, #[error("The detailed description is yet to be determined")] BandwidthCredentialError, diff --git a/common/credentials/src/lib.rs b/common/credentials/src/lib.rs index caa16ee410..c06eeb0a05 100644 --- a/common/credentials/src/lib.rs +++ b/common/credentials/src/lib.rs @@ -9,3 +9,4 @@ pub use coconut::bandwidth::{ IssuedBandwidthCredential, }; pub use coconut::utils::{obtain_aggregate_signature, obtain_aggregate_verification_key}; +pub use error::Error; diff --git a/common/nym-id-lib/Cargo.toml b/common/nym-id-lib/Cargo.toml new file mode 100644 index 0000000000..3114f0eded --- /dev/null +++ b/common/nym-id-lib/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "nym-id-lib" +version = "0.1.0" +authors.workspace = true +repository.workspace = true +homepage.workspace = true +documentation.workspace = true +edition.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +thiserror.workspace = true +time.workspace = true +tracing.workspace = true +zeroize.workspace = true + +nym-credential-storage = { path = "../credential-storage" } +nym-credentials = { path = "../credentials" } diff --git a/common/nym-id-lib/src/error.rs b/common/nym-id-lib/src/error.rs new file mode 100644 index 0000000000..2edc03fd0e --- /dev/null +++ b/common/nym-id-lib/src/error.rs @@ -0,0 +1,20 @@ +// Copyright 2024 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use std::error::Error; +use thiserror::Error; +use time::OffsetDateTime; + +#[derive(Debug, Error)] +pub enum NymIdError { + #[error("failed to deserialize provided credential: {source}")] + CredentialDeserializationFailure { source: nym_credentials::Error }, + + #[error("attempted to import an expired credential (it expired on {expiration})")] + ExpiredCredentialImport { expiration: OffsetDateTime }, + + #[error("failed to store credential in the provided store: {source}")] + StorageError { + source: Box, + }, +} diff --git a/common/nym-id-lib/src/import_credential.rs b/common/nym-id-lib/src/import_credential.rs new file mode 100644 index 0000000000..f5058dfe2a --- /dev/null +++ b/common/nym-id-lib/src/import_credential.rs @@ -0,0 +1,71 @@ +// Copyright 2024 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use crate::NymIdError; +use nym_credential_storage::models::StorableIssuedCredential; +use nym_credential_storage::storage::Storage; +use nym_credentials::coconut::bandwidth::issued::BandwidthCredentialIssuedDataVariant; +use nym_credentials::IssuedBandwidthCredential; +use tracing::{debug, warn}; +use zeroize::Zeroizing; + +pub async fn import_credential( + credentials_store: S, + raw_credential: Vec, + credential_version: impl Into>, +) -> Result<(), NymIdError> +where + S: Storage, + ::StorageError: Send + Sync + 'static, +{ + let raw_credential = Zeroizing::new(raw_credential); + + // note: the type itself implements ZeroizeOnDrop + let credential = IssuedBandwidthCredential::try_unpack(&raw_credential, credential_version) + .map_err(|source| NymIdError::CredentialDeserializationFailure { source })?; + + debug!( + "attempting to import credential of type {}", + credential.typ() + ); + + match credential.variant_data() { + BandwidthCredentialIssuedDataVariant::Voucher(voucher_info) => { + debug!("with value of {}", voucher_info.value()) + } + BandwidthCredentialIssuedDataVariant::FreePass(freepass_info) => { + debug!("with expiry at {}", freepass_info.expiry_date()); + if freepass_info.expired() { + warn!("the free pass has already expired!"); + + // technically we can import it, but the gateway will just reject it so what's the point + return Err(NymIdError::ExpiredCredentialImport { + expiration: freepass_info.expiry_date(), + }); + } + } + } + + // SAFETY: + // for the epoch to run over u32::MAX, we'd have to advance it for few centuries every block... + // the alternative is a very particularly malformed serialized data, but at that point blowing up is the right call + // because we can't rely on it anyway + #[allow(clippy::expect_used)] + let storable = StorableIssuedCredential { + serialization_revision: credential.current_serialization_revision(), + credential_data: &raw_credential, + credential_type: credential.typ().to_string(), + epoch_id: credential + .epoch_id() + .try_into() + .expect("our epoch is has run over u32::MAX!"), + }; + + credentials_store + .insert_issued_credential(storable) + .await + .map_err(|source| NymIdError::StorageError { + source: Box::new(source), + })?; + Ok(()) +} diff --git a/common/nym-id-lib/src/lib.rs b/common/nym-id-lib/src/lib.rs new file mode 100644 index 0000000000..e2e3a74adc --- /dev/null +++ b/common/nym-id-lib/src/lib.rs @@ -0,0 +1,11 @@ +// Copyright 2024 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +#![warn(clippy::expect_used)] +#![warn(clippy::unwrap_used)] + +pub mod error; +pub mod import_credential; + +pub use error::NymIdError; +pub use import_credential::import_credential; diff --git a/nym-id/Cargo.toml b/nym-id/Cargo.toml new file mode 100644 index 0000000000..49da695276 --- /dev/null +++ b/nym-id/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "nym-id" +version = "0.1.0" +authors.workspace = true +repository.workspace = true +homepage.workspace = true +documentation.workspace = true +edition.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +anyhow.workspace = true +bs58.workspace = true +clap = { workspace = true, features = ["derive"] } +tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } +tracing.workspace = true + +nym-bin-common = { path = "../common/bin-common", features = ["output_format", "basic_tracing"] } +nym-credential-storage = { path = "../common/credential-storage" } +nym-id-lib = { path = "../common/nym-id-lib" } diff --git a/nym-id/src/commands/build_info.rs b/nym-id/src/commands/build_info.rs new file mode 100644 index 0000000000..a989a41f10 --- /dev/null +++ b/nym-id/src/commands/build_info.rs @@ -0,0 +1,15 @@ +// Copyright 2024 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use nym_bin_common::bin_info_owned; +use nym_bin_common::output_format::OutputFormat; + +#[derive(clap::Args)] +pub(crate) struct Args { + #[clap(short, long, default_value_t = OutputFormat::default())] + output: OutputFormat, +} + +pub(crate) fn execute(args: Args) { + println!("{}", args.output.format(&bin_info_owned!())) +} diff --git a/nym-id/src/commands/import_credential.rs b/nym-id/src/commands/import_credential.rs new file mode 100644 index 0000000000..9422a34e8d --- /dev/null +++ b/nym-id/src/commands/import_credential.rs @@ -0,0 +1,48 @@ +// Copyright 2024 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use clap::ArgGroup; +use nym_id_lib::import_credential; +use std::fs; +use std::path::PathBuf; + +fn parse_encoded_credential_data(raw: &str) -> bs58::decode::Result> { + bs58::decode(raw).into_vec() +} + +#[derive(clap::Args)] +#[clap(group(ArgGroup::new("cred_data").required(true)))] +pub(crate) struct Args { + /// Explicitly provide the encoded credential data (as base58) + #[clap(long, group = "cred_data", value_parser = parse_encoded_credential_data)] + pub(crate) credential_data: Option>, + + /// Specifies the path to file containing binary credential data + #[clap(long, group = "cred_data")] + pub(crate) credential_path: Option, + + /// Specifies path to the credentials storage + #[clap(long)] + pub credentials_store_path: PathBuf, + + // currently hidden as there exists only a single serialization standard + #[clap(long, hide = true)] + pub(crate) version: Option, +} + +pub(crate) async fn execute(args: Args) -> anyhow::Result<()> { + let credentials_store = + nym_credential_storage::initialise_persistent_storage(args.credentials_store_path).await; + + let raw_credential = match args.credential_data { + Some(data) => data, + None => { + // SAFETY: one of those arguments must have been set + #[allow(clippy::unwrap_used)] + fs::read(args.credential_path.unwrap())? + } + }; + + import_credential(credentials_store, raw_credential, args.version).await?; + Ok(()) +} diff --git a/nym-id/src/commands/mod.rs b/nym-id/src/commands/mod.rs new file mode 100644 index 0000000000..e2cf56ad46 --- /dev/null +++ b/nym-id/src/commands/mod.rs @@ -0,0 +1,46 @@ +// Copyright 2024 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +mod build_info; +mod import_credential; +mod setup; + +use clap::{Parser, Subcommand}; +use nym_bin_common::bin_info; +use std::sync::OnceLock; + +fn pretty_build_info_static() -> &'static str { + static PRETTY_BUILD_INFORMATION: OnceLock = OnceLock::new(); + PRETTY_BUILD_INFORMATION.get_or_init(|| bin_info!().pretty_print()) +} + +#[derive(Parser)] +#[clap(author = "Nymtech", version, long_version = pretty_build_info_static(), about)] +pub(crate) struct Cli { + #[clap(subcommand)] + command: Commands, +} + +impl Cli { + pub async fn execute(self) -> anyhow::Result<()> { + match self.command { + Commands::ImportCredential(args) => import_credential::execute(args).await?, + Commands::BuildInfo(args) => build_info::execute(args), + } + + Ok(()) + } +} + +#[derive(Subcommand)] +pub(crate) enum Commands { + // TODO: to be determined how it's going to work in nymvpn et al. + // /// + // Setup, + + /// Attempt to import a bandwidth credential into the provided storage. + ImportCredential(import_credential::Args), + + /// Show build information of this binary + BuildInfo(build_info::Args), +} diff --git a/nym-id/src/commands/setup.rs b/nym-id/src/commands/setup.rs new file mode 100644 index 0000000000..20bfe6232a --- /dev/null +++ b/nym-id/src/commands/setup.rs @@ -0,0 +1,3 @@ +// Copyright 2024 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + diff --git a/nym-id/src/main.rs b/nym-id/src/main.rs new file mode 100644 index 0000000000..8d8de30903 --- /dev/null +++ b/nym-id/src/main.rs @@ -0,0 +1,19 @@ +// Copyright 2024 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +#![warn(clippy::expect_used)] +#![warn(clippy::unwrap_used)] + +use crate::commands::Cli; +use clap::Parser; +use nym_bin_common::logging::setup_tracing_logger; + +mod commands; + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + setup_tracing_logger(); + let cli = Cli::parse(); + + cli.execute().await +} From 2bff66e2c7b3da6512bfadecfbf7532f10c4011e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Wed, 28 Feb 2024 16:45:00 +0000 Subject: [PATCH 02/35] Remove rustls feature on workspace deps (#4422) * Remove rustls feature on workspace deps * Cargo.lock for nym-connect and nym-wallet --- Cargo.lock | 12 ++---------- Cargo.toml | 6 +++--- nym-connect/desktop/Cargo.lock | 11 +---------- nym-wallet/Cargo.lock | 7 ------- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7dcb192b24..de96670731 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4280,7 +4280,7 @@ dependencies = [ "rw-stream-sink", "soketto", "url", - "webpki-roots 0.22.6", + "webpki-roots", ] [[package]] @@ -8014,7 +8014,6 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots 0.25.2", "winreg", ] @@ -9177,7 +9176,7 @@ dependencies = [ "time", "tokio-stream", "url", - "webpki-roots 0.22.6", + "webpki-roots", ] [[package]] @@ -9824,7 +9823,6 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "rustls 0.21.10", "tokio", "tungstenite", ] @@ -10842,12 +10840,6 @@ dependencies = [ "webpki 0.22.4", ] -[[package]] -name = "webpki-roots" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" - [[package]] name = "webrtc" version = "0.6.0" diff --git a/Cargo.toml b/Cargo.toml index 6e78dea995..e90561c0bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,7 +159,7 @@ log = "0.4" once_cell = "1.7.2" parking_lot = "0.12.1" rand = "0.8.5" -reqwest = { version = "0.11.22", default_features = false, features = ["rustls-tls"] } +reqwest = { version = "0.11.22", default_features = false } schemars = "0.8.1" serde = "1.0.152" serde_json = "1.0.91" @@ -169,9 +169,9 @@ time = "0.3.30" thiserror = "1.0.48" tokio = "1.33.0" tokio-util = "0.7.10" -tokio-tungstenite = { version = "0.20.1", features = ["rustls"] } +tokio-tungstenite = { version = "0.20.1" } tracing = "0.1.37" -tungstenite = { version = "0.20.1", default-features = false, features = ["rustls"] } +tungstenite = { version = "0.20.1", default-features = false } ts-rs = "7.0.0" utoipa = "3.5.0" utoipa-swagger-ui = "3.1.5" diff --git a/nym-connect/desktop/Cargo.lock b/nym-connect/desktop/Cargo.lock index f8ee12014b..cdd144c175 100644 --- a/nym-connect/desktop/Cargo.lock +++ b/nym-connect/desktop/Cargo.lock @@ -5516,7 +5516,6 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots 0.25.4", "winreg 0.50.0", ] @@ -6483,7 +6482,7 @@ dependencies = [ "thiserror", "tokio-stream", "url", - "webpki-roots 0.22.6", + "webpki-roots", ] [[package]] @@ -7272,7 +7271,6 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "rustls 0.21.7", "tokio", "tungstenite", ] @@ -7454,7 +7452,6 @@ dependencies = [ "httparse", "log", "rand 0.8.5", - "rustls 0.21.7", "sha1", "thiserror", "url", @@ -7898,12 +7895,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "webpki-roots" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - [[package]] name = "webview2-com" version = "0.19.1" diff --git a/nym-wallet/Cargo.lock b/nym-wallet/Cargo.lock index 0c61b55042..5fc7e020bd 100644 --- a/nym-wallet/Cargo.lock +++ b/nym-wallet/Cargo.lock @@ -4444,7 +4444,6 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", "winreg", ] @@ -6272,12 +6271,6 @@ dependencies = [ "system-deps 6.1.1", ] -[[package]] -name = "webpki-roots" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - [[package]] name = "webview2-com" version = "0.19.1" From 208ec4574bfed1ad12551f58257df58a009be845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 29 Feb 2024 15:29:41 +0000 Subject: [PATCH 03/35] using the shared code for credentials import --- Cargo.lock | 4 ++ clients/native/Cargo.toml | 1 + .../native/src/commands/import_credential.rs | 62 +++---------------- clients/native/src/error.rs | 26 ++------ clients/socks5/Cargo.toml | 1 + .../socks5/src/commands/import_credential.rs | 62 +++---------------- clients/socks5/src/error.rs | 24 ++----- common/commands/Cargo.toml | 1 + .../commands/src/coconut/import_credential.rs | 45 ++------------ .../network-requester/Cargo.toml | 2 +- .../src/cli/import_credential.rs | 62 +++---------------- .../network-requester/src/error.rs | 24 ++----- 12 files changed, 59 insertions(+), 255 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dd14db56db..f77a763245 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5128,6 +5128,7 @@ dependencies = [ "nym-credentials", "nym-credentials-interface", "nym-crypto", + "nym-id-lib", "nym-mixnet-contract-common", "nym-multisig-contract-common", "nym-name-service-common", @@ -5168,6 +5169,7 @@ dependencies = [ "nym-credentials", "nym-crypto", "nym-gateway-requests", + "nym-id-lib", "nym-network-defaults", "nym-pemstore", "nym-sphinx", @@ -5890,6 +5892,7 @@ dependencies = [ "nym-credentials", "nym-crypto", "nym-exit-policy", + "nym-id-lib", "nym-network-defaults", "nym-ordered-buffer", "nym-sdk", @@ -6177,6 +6180,7 @@ dependencies = [ "nym-credentials", "nym-crypto", "nym-gateway-requests", + "nym-id-lib", "nym-network-defaults", "nym-ordered-buffer", "nym-pemstore", diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index b113ecc3e6..9da09cd0d0 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -51,5 +51,6 @@ nym-task = { path = "../../common/task" } nym-topology = { path = "../../common/topology" } nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["http-client"] } nym-client-websocket-requests = { path = "websocket-requests" } +nym-id-lib = { path = "../../common/nym-id-lib" } [dev-dependencies] diff --git a/clients/native/src/commands/import_credential.rs b/clients/native/src/commands/import_credential.rs index de211aef01..437cffd37c 100644 --- a/clients/native/src/commands/import_credential.rs +++ b/clients/native/src/commands/import_credential.rs @@ -4,14 +4,15 @@ use crate::commands::try_load_current_config; use crate::error::ClientError; use clap::ArgGroup; -use log::{error, info}; -use nym_credential_storage::models::StorableIssuedCredential; -use nym_credential_storage::storage::Storage; -use nym_credentials::coconut::bandwidth::issued::BandwidthCredentialIssuedDataVariant; -use nym_credentials::IssuedBandwidthCredential; + + + + + +use nym_id_lib::import_credential; use std::fs; use std::path::PathBuf; -use zeroize::Zeroizing; + fn parse_encoded_credential_data(raw: &str) -> bs58::decode::Result> { bs58::decode(raw).into_vec() @@ -33,8 +34,8 @@ pub(crate) struct Args { pub(crate) credential_path: Option, // currently hidden as there exists only a single serialization standard - #[clap(long, hide = true, default_value_t = 1)] - pub(crate) version: u8, + #[clap(long, hide = true)] + pub(crate) version: Option, } pub(crate) async fn execute(args: Args) -> Result<(), ClientError> { @@ -52,50 +53,7 @@ pub(crate) async fn execute(args: Args) -> Result<(), ClientError> { fs::read(args.credential_path.unwrap())? } }; - let raw_credential = Zeroizing::new(raw_credential); - // we're unpacking the data in order to make sure it's valid - // and to extract relevant metadata for storage purposes - let credential = match args.version { - 1 => Zeroizing::new( - IssuedBandwidthCredential::unpack_v1(&raw_credential).map_err(|source| { - ClientError::CredentialDeserializationFailure { - storage_revision: 1, - source, - } - })?, - ), - other => panic!("unknown credential serialization version {other}"), - }; - - info!("importing {}", credential.typ()); - match credential.variant_data() { - BandwidthCredentialIssuedDataVariant::Voucher(voucher_info) => { - info!("with value of {}", voucher_info.value()) - } - BandwidthCredentialIssuedDataVariant::FreePass(freepass_info) => { - info!("with expiry at {}", freepass_info.expiry_date()); - if freepass_info.expired() { - error!("the free pass has already expired!"); - - // technically we can import it, but the gateway will just reject it so what's the point - return Err(ClientError::ExpiredCredentialImport { - expiration: freepass_info.expiry_date(), - }); - } - } - } - - let storable = StorableIssuedCredential { - serialization_revision: args.version, - credential_data: &raw_credential, - credential_type: credential.typ().to_string(), - epoch_id: credential - .epoch_id() - .try_into() - .expect("our epoch is has run over u32::MAX!"), - }; - - credentials_store.insert_issued_credential(storable).await?; + import_credential(credentials_store, raw_credential, args.version).await?; Ok(()) } diff --git a/clients/native/src/error.rs b/clients/native/src/error.rs index 8a21803736..2b7d0bfc8b 100644 --- a/clients/native/src/error.rs +++ b/clients/native/src/error.rs @@ -1,6 +1,7 @@ use nym_client_core::error::ClientCoreError; -use nym_credential_storage::error::StorageError; -use time::OffsetDateTime; + + +use nym_id_lib::NymIdError; #[derive(thiserror::Error, Debug)] pub enum ClientError { @@ -22,22 +23,7 @@ pub enum ClientError { #[error("Attempted to start the client in invalid socket mode")] InvalidSocketMode, - - #[error("failed to store credential: {source}")] - CredentialStorageFailure { - #[from] - source: StorageError, - }, - - #[error( - "failed to deserialize provided credential using revision {storage_revision}: {source}" - )] - CredentialDeserializationFailure { - storage_revision: u8, - #[source] - source: nym_credentials::error::Error, - }, - - #[error("attempted to import an expired credential (it expired on {expiration})")] - ExpiredCredentialImport { expiration: OffsetDateTime }, + + #[error(transparent)] + NymIdError(#[from] NymIdError) } diff --git a/clients/socks5/Cargo.toml b/clients/socks5/Cargo.toml index 37477d9d18..0af4c34770 100644 --- a/clients/socks5/Cargo.toml +++ b/clients/socks5/Cargo.toml @@ -35,6 +35,7 @@ nym-ordered-buffer = { path = "../../common/socks5/ordered-buffer" } nym-pemstore = { path = "../../common/pemstore" } nym-topology = { path = "../../common/topology" } nym-socks5-client-core = { path = "../../common/socks5-client-core" } +nym-id-lib = { path = "../../common/nym-id-lib" } [features] default = [] diff --git a/clients/socks5/src/commands/import_credential.rs b/clients/socks5/src/commands/import_credential.rs index 2ce3457015..502d49c3a3 100644 --- a/clients/socks5/src/commands/import_credential.rs +++ b/clients/socks5/src/commands/import_credential.rs @@ -4,14 +4,15 @@ use crate::commands::try_load_current_config; use crate::error::Socks5ClientError; use clap::ArgGroup; -use log::{error, info}; -use nym_credential_storage::models::StorableIssuedCredential; -use nym_credential_storage::storage::Storage; -use nym_credentials::coconut::bandwidth::issued::BandwidthCredentialIssuedDataVariant; -use nym_credentials::IssuedBandwidthCredential; + + + + + +use nym_id_lib::import_credential; use std::fs; use std::path::PathBuf; -use zeroize::Zeroizing; + fn parse_encoded_credential_data(raw: &str) -> bs58::decode::Result> { bs58::decode(raw).into_vec() @@ -33,8 +34,8 @@ pub(crate) struct Args { pub(crate) credential_path: Option, // currently hidden as there exists only a single serialization standard - #[clap(long, hide = true, default_value_t = 1)] - pub(crate) version: u8, + #[clap(long, hide = true)] + pub(crate) version: Option, } pub(crate) async fn execute(args: Args) -> Result<(), Socks5ClientError> { @@ -52,50 +53,7 @@ pub(crate) async fn execute(args: Args) -> Result<(), Socks5ClientError> { fs::read(args.credential_path.unwrap())? } }; - let raw_credential = Zeroizing::new(raw_credential); - // we're unpacking the data in order to make sure it's valid - // and to extract relevant metadata for storage purposes - let credential = match args.version { - 1 => Zeroizing::new( - IssuedBandwidthCredential::unpack_v1(&raw_credential).map_err(|source| { - Socks5ClientError::CredentialDeserializationFailure { - storage_revision: 1, - source, - } - })?, - ), - other => panic!("unknown credential serialization version {other}"), - }; - - info!("importing {}", credential.typ()); - match credential.variant_data() { - BandwidthCredentialIssuedDataVariant::Voucher(voucher_info) => { - info!("with value of {}", voucher_info.value()) - } - BandwidthCredentialIssuedDataVariant::FreePass(freepass_info) => { - info!("with expiry at {}", freepass_info.expiry_date()); - if freepass_info.expired() { - error!("the free pass has already expired!"); - - // technically we can import it, but the gateway will just reject it so what's the point - return Err(Socks5ClientError::ExpiredCredentialImport { - expiration: freepass_info.expiry_date(), - }); - } - } - } - - let storable = StorableIssuedCredential { - serialization_revision: args.version, - credential_data: &raw_credential, - credential_type: credential.typ().to_string(), - epoch_id: credential - .epoch_id() - .try_into() - .expect("our epoch is has run over u32::MAX!"), - }; - - credentials_store.insert_issued_credential(storable).await?; + import_credential(credentials_store, raw_credential, args.version).await?; Ok(()) } diff --git a/clients/socks5/src/error.rs b/clients/socks5/src/error.rs index bed06bd385..23ec79509b 100644 --- a/clients/socks5/src/error.rs +++ b/clients/socks5/src/error.rs @@ -1,6 +1,7 @@ use nym_client_core::error::ClientCoreError; -use nym_credential_storage::error::StorageError; -use time::OffsetDateTime; + +use nym_id_lib::NymIdError; + #[derive(thiserror::Error, Debug)] pub enum Socks5ClientError { @@ -23,21 +24,6 @@ pub enum Socks5ClientError { #[error(transparent)] ClientCoreError(#[from] ClientCoreError), - #[error("failed to store credential: {source}")] - CredentialStorageFailure { - #[from] - source: StorageError, - }, - - #[error( - "failed to deserialize provided credential using revision {storage_revision}: {source}" - )] - CredentialDeserializationFailure { - storage_revision: u8, - #[source] - source: nym_credentials::error::Error, - }, - - #[error("attempted to import an expired credential (it expired on {expiration})")] - ExpiredCredentialImport { expiration: OffsetDateTime }, + #[error(transparent)] + NymIdError(#[from] NymIdError), } diff --git a/common/commands/Cargo.toml b/common/commands/Cargo.toml index b2ef8bc3ea..dba6b7a9b5 100644 --- a/common/commands/Cargo.toml +++ b/common/commands/Cargo.toml @@ -55,6 +55,7 @@ nym-credentials = { path = "../../common/credentials" } nym-credentials-interface = { path = "../../common/credentials-interface" } nym-credential-storage = { path = "../../common/credential-storage" } nym-credential-utils = { path = "../../common/credential-utils" } +nym-id-lib = { path = "../../common/nym-id-lib" } nym-pemstore = { path = "../../common/pemstore", version = "0.3.0" } nym-types = { path = "../../common/types" } diff --git a/common/commands/src/coconut/import_credential.rs b/common/commands/src/coconut/import_credential.rs index 337bf9125b..225a617bff 100644 --- a/common/commands/src/coconut/import_credential.rs +++ b/common/commands/src/coconut/import_credential.rs @@ -11,6 +11,7 @@ use nym_credential_storage::models::StorableIssuedCredential; use nym_credential_storage::storage::Storage; use nym_credentials::coconut::bandwidth::issued::BandwidthCredentialIssuedDataVariant; use nym_credentials::IssuedBandwidthCredential; +use nym_id_lib::import_credential; use std::fs; use std::path::PathBuf; use zeroize::Zeroizing; @@ -35,8 +36,8 @@ pub struct Args { pub(crate) credential_path: Option, // currently hidden as there exists only a single serialization standard - #[clap(long, hide = true, default_value_t = 1)] - pub(crate) version: u8, + #[clap(long, hide = true)] + pub(crate) version: Option, } pub async fn execute(args: Args) -> anyhow::Result<()> { @@ -54,6 +55,7 @@ pub async fn execute(args: Args) -> anyhow::Result<()> { "using credentials store at '{}'", credentials_store.display() ); + let credentials_store = initialise_persistent_storage(credentials_store).await; let raw_credential = match args.credential_data { Some(data) => data, @@ -62,44 +64,7 @@ pub async fn execute(args: Args) -> anyhow::Result<()> { fs::read(args.credential_path.unwrap())? } }; - let raw_credential = Zeroizing::new(raw_credential); - // we're unpacking the data in order to make sure it's valid - // and to extract relevant metadata for storage purposes - let credential = match args.version { - 1 => Zeroizing::new(IssuedBandwidthCredential::unpack_v1(&raw_credential)?), - other => panic!("unknown credential serialization version {other}"), - }; - let persistent_storage = initialise_persistent_storage(credentials_store).await; - - info!("importing {}", credential.typ()); - match credential.variant_data() { - BandwidthCredentialIssuedDataVariant::Voucher(voucher_info) => { - info!("with value of {}", voucher_info.value()) - } - BandwidthCredentialIssuedDataVariant::FreePass(freepass_info) => { - info!("with expiry at {}", freepass_info.expiry_date()); - if freepass_info.expired() { - error!("the free pass has already expired!"); - - // technically we can, but the gateway will just reject it so what's the point - bail!("can't import an expired free pass") - } - } - } - - let storable = StorableIssuedCredential { - serialization_revision: args.version, - credential_data: &raw_credential, - credential_type: credential.typ().to_string(), - epoch_id: credential - .epoch_id() - .try_into() - .expect("our epoch is has run over u32::MAX!"), - }; - - persistent_storage - .insert_issued_credential(storable) - .await?; + import_credential(credentials_store, raw_credential, args.version).await?; Ok(()) } diff --git a/service-providers/network-requester/Cargo.toml b/service-providers/network-requester/Cargo.toml index 4b9b1c8003..65ca6c2aa3 100644 --- a/service-providers/network-requester/Cargo.toml +++ b/service-providers/network-requester/Cargo.toml @@ -61,7 +61,7 @@ nym-statistics-common = { path = "../../common/statistics" } nym-task = { path = "../../common/task" } nym-types = { path = "../../common/types" } nym-exit-policy = { path = "../../common/exit-policy", features = ["client"] } - +nym-id-lib = { path = "../../common/nym-id-lib" } [dev-dependencies] tempfile = "3.5.0" diff --git a/service-providers/network-requester/src/cli/import_credential.rs b/service-providers/network-requester/src/cli/import_credential.rs index 6d0b8fffb1..6c530b6119 100644 --- a/service-providers/network-requester/src/cli/import_credential.rs +++ b/service-providers/network-requester/src/cli/import_credential.rs @@ -4,14 +4,15 @@ use crate::cli::try_load_current_config; use crate::error::NetworkRequesterError; use clap::ArgGroup; -use log::{error, info}; -use nym_credential_storage::models::StorableIssuedCredential; -use nym_credential_storage::storage::Storage; -use nym_credentials::coconut::bandwidth::issued::BandwidthCredentialIssuedDataVariant; -use nym_credentials::IssuedBandwidthCredential; + + + + + +use nym_id_lib::import_credential; use std::fs; use std::path::PathBuf; -use zeroize::Zeroizing; + fn parse_encoded_credential_data(raw: &str) -> bs58::decode::Result> { bs58::decode(raw).into_vec() @@ -33,8 +34,8 @@ pub(crate) struct Args { pub(crate) credential_path: Option, // currently hidden as there exists only a single serialization standard - #[clap(long, hide = true, default_value_t = 1)] - pub(crate) version: u8, + #[clap(long, hide = true)] + pub(crate) version: Option, } pub(crate) async fn execute(args: Args) -> Result<(), NetworkRequesterError> { @@ -52,50 +53,7 @@ pub(crate) async fn execute(args: Args) -> Result<(), NetworkRequesterError> { fs::read(args.credential_path.unwrap())? } }; - let raw_credential = Zeroizing::new(raw_credential); - // we're unpacking the data in order to make sure it's valid - // and to extract relevant metadata for storage purposes - let credential = match args.version { - 1 => Zeroizing::new( - IssuedBandwidthCredential::unpack_v1(&raw_credential).map_err(|source| { - NetworkRequesterError::CredentialDeserializationFailure { - storage_revision: 1, - source, - } - })?, - ), - other => panic!("unknown credential serialization version {other}"), - }; - - info!("importing {}", credential.typ()); - match credential.variant_data() { - BandwidthCredentialIssuedDataVariant::Voucher(voucher_info) => { - info!("with value of {}", voucher_info.value()) - } - BandwidthCredentialIssuedDataVariant::FreePass(freepass_info) => { - info!("with expiry at {}", freepass_info.expiry_date()); - if freepass_info.expired() { - error!("the free pass has already expired!"); - - // technically we can import it, but the gateway will just reject it so what's the point - return Err(NetworkRequesterError::ExpiredCredentialImport { - expiration: freepass_info.expiry_date(), - }); - } - } - } - - let storable = StorableIssuedCredential { - serialization_revision: args.version, - credential_data: &raw_credential, - credential_type: credential.typ().to_string(), - epoch_id: credential - .epoch_id() - .try_into() - .expect("our epoch is has run over u32::MAX!"), - }; - - credentials_store.insert_issued_credential(storable).await?; + import_credential(credentials_store, raw_credential, args.version).await?; Ok(()) } diff --git a/service-providers/network-requester/src/error.rs b/service-providers/network-requester/src/error.rs index ce14ed7cf9..3ee55e3d44 100644 --- a/service-providers/network-requester/src/error.rs +++ b/service-providers/network-requester/src/error.rs @@ -2,11 +2,12 @@ // SPDX-License-Identifier: GPL-3.0-only pub use nym_client_core::error::ClientCoreError; -use nym_credential_storage::error::StorageError; + use nym_exit_policy::policy::PolicyError; +use nym_id_lib::NymIdError; use nym_socks5_requests::{RemoteAddress, Socks5RequestError}; use std::net::SocketAddr; -use time::OffsetDateTime; + #[derive(thiserror::Error, Debug)] pub enum NetworkRequesterError { @@ -70,21 +71,6 @@ pub enum NetworkRequesterError { #[error("can't setup an exit policy without any upstream urls")] NoUpstreamExitPolicy, - #[error("failed to store credential: {source}")] - CredentialStorageFailure { - #[from] - source: StorageError, - }, - - #[error( - "failed to deserialize provided credential using revision {storage_revision}: {source}" - )] - CredentialDeserializationFailure { - storage_revision: u8, - #[source] - source: nym_credentials::error::Error, - }, - - #[error("attempted to import an expired credential (it expired on {expiration})")] - ExpiredCredentialImport { expiration: OffsetDateTime }, + #[error(transparent)] + NymIdError(#[from] NymIdError), } From 41b7a2a20d5341053934dc51c87abe467c4040c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 29 Feb 2024 15:57:48 +0000 Subject: [PATCH 04/35] cargo fmt --- clients/native/src/commands/import_credential.rs | 5 ----- clients/native/src/error.rs | 5 ++--- clients/socks5/src/commands/import_credential.rs | 5 ----- clients/socks5/src/error.rs | 1 - nym-id/src/commands/mod.rs | 1 - nym-id/src/commands/setup.rs | 1 - .../network-requester/src/cli/import_credential.rs | 5 ----- service-providers/network-requester/src/error.rs | 1 - 8 files changed, 2 insertions(+), 22 deletions(-) diff --git a/clients/native/src/commands/import_credential.rs b/clients/native/src/commands/import_credential.rs index 437cffd37c..aac7feaa64 100644 --- a/clients/native/src/commands/import_credential.rs +++ b/clients/native/src/commands/import_credential.rs @@ -5,15 +5,10 @@ use crate::commands::try_load_current_config; use crate::error::ClientError; use clap::ArgGroup; - - - - use nym_id_lib::import_credential; use std::fs; use std::path::PathBuf; - fn parse_encoded_credential_data(raw: &str) -> bs58::decode::Result> { bs58::decode(raw).into_vec() } diff --git a/clients/native/src/error.rs b/clients/native/src/error.rs index 2b7d0bfc8b..b4f47cf90b 100644 --- a/clients/native/src/error.rs +++ b/clients/native/src/error.rs @@ -1,6 +1,5 @@ use nym_client_core::error::ClientCoreError; - use nym_id_lib::NymIdError; #[derive(thiserror::Error, Debug)] @@ -23,7 +22,7 @@ pub enum ClientError { #[error("Attempted to start the client in invalid socket mode")] InvalidSocketMode, - + #[error(transparent)] - NymIdError(#[from] NymIdError) + NymIdError(#[from] NymIdError), } diff --git a/clients/socks5/src/commands/import_credential.rs b/clients/socks5/src/commands/import_credential.rs index 502d49c3a3..25285870f8 100644 --- a/clients/socks5/src/commands/import_credential.rs +++ b/clients/socks5/src/commands/import_credential.rs @@ -5,15 +5,10 @@ use crate::commands::try_load_current_config; use crate::error::Socks5ClientError; use clap::ArgGroup; - - - - use nym_id_lib::import_credential; use std::fs; use std::path::PathBuf; - fn parse_encoded_credential_data(raw: &str) -> bs58::decode::Result> { bs58::decode(raw).into_vec() } diff --git a/clients/socks5/src/error.rs b/clients/socks5/src/error.rs index 23ec79509b..788d1250f8 100644 --- a/clients/socks5/src/error.rs +++ b/clients/socks5/src/error.rs @@ -2,7 +2,6 @@ use nym_client_core::error::ClientCoreError; use nym_id_lib::NymIdError; - #[derive(thiserror::Error, Debug)] pub enum Socks5ClientError { #[error("I/O error: {0}")] diff --git a/nym-id/src/commands/mod.rs b/nym-id/src/commands/mod.rs index e2cf56ad46..362dfd554b 100644 --- a/nym-id/src/commands/mod.rs +++ b/nym-id/src/commands/mod.rs @@ -37,7 +37,6 @@ pub(crate) enum Commands { // TODO: to be determined how it's going to work in nymvpn et al. // /// // Setup, - /// Attempt to import a bandwidth credential into the provided storage. ImportCredential(import_credential::Args), diff --git a/nym-id/src/commands/setup.rs b/nym-id/src/commands/setup.rs index 20bfe6232a..755fb6cc8b 100644 --- a/nym-id/src/commands/setup.rs +++ b/nym-id/src/commands/setup.rs @@ -1,3 +1,2 @@ // Copyright 2024 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 - diff --git a/service-providers/network-requester/src/cli/import_credential.rs b/service-providers/network-requester/src/cli/import_credential.rs index 6c530b6119..1fe0d3de52 100644 --- a/service-providers/network-requester/src/cli/import_credential.rs +++ b/service-providers/network-requester/src/cli/import_credential.rs @@ -5,15 +5,10 @@ use crate::cli::try_load_current_config; use crate::error::NetworkRequesterError; use clap::ArgGroup; - - - - use nym_id_lib::import_credential; use std::fs; use std::path::PathBuf; - fn parse_encoded_credential_data(raw: &str) -> bs58::decode::Result> { bs58::decode(raw).into_vec() } diff --git a/service-providers/network-requester/src/error.rs b/service-providers/network-requester/src/error.rs index 3ee55e3d44..0143494696 100644 --- a/service-providers/network-requester/src/error.rs +++ b/service-providers/network-requester/src/error.rs @@ -8,7 +8,6 @@ use nym_id_lib::NymIdError; use nym_socks5_requests::{RemoteAddress, Socks5RequestError}; use std::net::SocketAddr; - #[derive(thiserror::Error, Debug)] pub enum NetworkRequesterError { #[error("I/O error: {0}")] From ae20d2afb854ca50727088cab7bb206c0813138b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 29 Feb 2024 16:04:07 +0000 Subject: [PATCH 05/35] removed old test code --- common/commands/src/coconut/check_pass.rs | 112 ---------------------- 1 file changed, 112 deletions(-) delete mode 100644 common/commands/src/coconut/check_pass.rs diff --git a/common/commands/src/coconut/check_pass.rs b/common/commands/src/coconut/check_pass.rs deleted file mode 100644 index ef02d80722..0000000000 --- a/common/commands/src/coconut/check_pass.rs +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2024 - Nym Technologies SA -// SPDX-License-Identifier: Apache-2.0 - -use crate::context::{QueryClient, SigningClient}; -use anyhow::{anyhow, bail}; -use clap::ArgGroup; -use clap::Parser; -use futures::StreamExt; -use log::{error, info}; -use nym_coconut_dkg_common::types::EpochId; -use nym_credential_utils::utils::block_until_coconut_is_available; -use nym_credentials::coconut::bandwidth::bandwidth_credential_params; -use nym_credentials::coconut::bandwidth::freepass::MAX_FREE_PASS_VALIDITY; -use nym_credentials::coconut::utils; -use nym_credentials::{ - obtain_aggregate_verification_key, IssuanceBandwidthCredential, IssuedBandwidthCredential, -}; -use nym_credentials_interface::VerificationKey; -use nym_validator_client::coconut::all_coconut_api_clients; -use nym_validator_client::nyxd::contract_traits::{DkgQueryClient, NymContractsProvider}; -use nym_validator_client::nyxd::CosmWasmClient; -use nym_validator_client::signing::AccountData; -use nym_validator_client::CoconutApiClient; -use std::fs; -use std::fs::File; -use std::io::Write; -use std::path::PathBuf; -use std::sync::Arc; -use time::format_description::well_known::Rfc3339; -use time::OffsetDateTime; -use zeroize::Zeroizing; - -#[derive(Debug, Parser)] -pub struct Args { - /// Path to the output directory for generated free passes. - #[clap(long)] - pub(crate) pass: PathBuf, -} - -// async fn get_freepass( -// api_clients: Vec, -// aggregate_vk: &VerificationKey, -// threshold: u64, -// epoch_id: EpochId, -// signing_account: &AccountData, -// expiration_date: OffsetDateTime, -// ) -> anyhow::Result { -// let issuance_pass = IssuanceBandwidthCredential::new_freepass(Some(expiration_date)); -// let signing_data = issuance_pass.prepare_for_signing(); -// -// let credential_shares = Arc::new(tokio::sync::Mutex::new(Vec::new())); -// -// futures::stream::iter(api_clients) -// .for_each_concurrent(None, |client| async { -// // move the client into the block -// let client = client; -// let api_url = client.api_client.api_url(); -// -// info!("contacting {api_url} for blinded free pass"); -// -// match issuance_pass -// .obtain_partial_freepass_credential( -// &client.api_client, -// signing_account, -// &client.verification_key, -// signing_data.clone(), -// ) -// .await -// { -// Ok(partial_credential) => { -// credential_shares -// .lock() -// .await -// .push((partial_credential, client.node_id).into()); -// } -// Err(err) => { -// error!("failed to obtain partial free pass from {api_url}: {err}") -// } -// } -// }) -// .await; -// -// // SAFETY: the futures have completed, so we MUST have the only arc reference -// #[allow(clippy::unwrap_used)] -// let credential_shares = Arc::into_inner(credential_shares).unwrap().into_inner(); -// -// if credential_shares.len() < threshold as usize { -// bail!("we managed to obtain only {} partial credentials while the minimum threshold is {threshold}", credential_shares.len()); -// } -// -// let signature = issuance_pass.aggregate_signature_shares(aggregate_vk, &credential_shares)?; -// Ok(issuance_pass.into_issued_credential(signature, epoch_id)) -// } - -pub async fn execute(args: Args, client: QueryClient) -> anyhow::Result<()> { - let raw_credential = fs::read(args.pass)?; - let credential = IssuedBandwidthCredential::unpack_v1(&raw_credential)?; - - println!("{:?}", credential.get_plain_public_attributes()); - println!("{}", credential.epoch_id()); - println!("{:?}", credential.variant_data()); - - let api_clients = all_coconut_api_clients(&client, credential.epoch_id()).await?; - - let vk = utils::obtain_aggregate_verification_key(&api_clients)?; - - let foomp = credential.prepare_for_spending(&vk)?; - - let res = foomp.verify(bandwidth_credential_params(), &vk); - println!("res: {res}"); - Ok(()) -} From 160db346512494c6e04461d6de0e4a3c8cea8238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 29 Feb 2024 16:53:50 +0000 Subject: [PATCH 06/35] clippy --- common/commands/src/coconut/import_credential.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/common/commands/src/coconut/import_credential.rs b/common/commands/src/coconut/import_credential.rs index 225a617bff..388961ace4 100644 --- a/common/commands/src/coconut/import_credential.rs +++ b/common/commands/src/coconut/import_credential.rs @@ -5,16 +5,10 @@ use crate::utils::CommonConfigsWrapper; use anyhow::bail; use clap::ArgGroup; use clap::Parser; -use log::{error, info}; use nym_credential_storage::initialise_persistent_storage; -use nym_credential_storage::models::StorableIssuedCredential; -use nym_credential_storage::storage::Storage; -use nym_credentials::coconut::bandwidth::issued::BandwidthCredentialIssuedDataVariant; -use nym_credentials::IssuedBandwidthCredential; use nym_id_lib::import_credential; use std::fs; use std::path::PathBuf; -use zeroize::Zeroizing; fn parse_encoded_credential_data(raw: &str) -> bs58::decode::Result> { bs58::decode(raw).into_vec() From 9a6f96b5e015ef29818458c33ba30c7d17ce7fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C5=9Fu?= Date: Fri, 1 Mar 2024 12:07:38 +0200 Subject: [PATCH 07/35] Fix windows build (#4426) * Fix windows build * Fix in another place too * Install clang * With sudo * Revert "cargo update -p rustls@0.21.7 (#4404)" This reverts commit ecc47cd41832f929484f0d221922abb05e27e695. --- common/client-libs/gateway-client/src/client.rs | 4 ++-- common/client-libs/gateway-client/src/socket_state.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/client-libs/gateway-client/src/client.rs b/common/client-libs/gateway-client/src/client.rs index da2ee34f96..46b4816e2d 100644 --- a/common/client-libs/gateway-client/src/client.rs +++ b/common/client-libs/gateway-client/src/client.rs @@ -33,14 +33,14 @@ use std::sync::Arc; use std::time::Duration; use tungstenite::protocol::Message; -#[cfg(not(target_arch = "wasm32"))] +#[cfg(unix)] use std::os::fd::RawFd; #[cfg(not(target_arch = "wasm32"))] use tokio::time::sleep; #[cfg(not(target_arch = "wasm32"))] use tokio_tungstenite::connect_async; -#[cfg(target_arch = "wasm32")] +#[cfg(not(unix))] use std::os::raw::c_int as RawFd; #[cfg(target_arch = "wasm32")] use wasm_utils::websocket::JSWebsocket; diff --git a/common/client-libs/gateway-client/src/socket_state.rs b/common/client-libs/gateway-client/src/socket_state.rs index c42e2d7d08..afc50c7233 100644 --- a/common/client-libs/gateway-client/src/socket_state.rs +++ b/common/client-libs/gateway-client/src/socket_state.rs @@ -15,7 +15,7 @@ use std::os::raw::c_int as RawFd; use std::sync::Arc; use tungstenite::Message; -#[cfg(not(target_arch = "wasm32"))] +#[cfg(unix)] use std::os::fd::AsRawFd; #[cfg(not(target_arch = "wasm32"))] use tokio::net::TcpStream; @@ -41,14 +41,14 @@ type WsConn = JSWebsocket; type SplitStreamReceiver = oneshot::Receiver, GatewayClientError>>; pub(crate) fn ws_fd(_conn: &WsConn) -> Option { - #[cfg(not(target_arch = "wasm32"))] + #[cfg(unix)] match _conn.get_ref() { MaybeTlsStream::Plain(stream) => Some(stream.as_raw_fd()), &_ => unreachable!( "If tls features are enabled, the inner stream needs to be unpacked into raw fd" ), } - #[cfg(target_arch = "wasm32")] + #[cfg(not(unix))] None } From aebd386382e0bfdc66680ae1d6c895ffed68429a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C5=9Fu?= Date: Fri, 1 Mar 2024 19:28:21 +0200 Subject: [PATCH 08/35] Add IPv6 support to IPPR (#4431) --- common/ip-packet-requests/src/lib.rs | 13 +- common/ip-packet-requests/src/request.rs | 27 +- common/ip-packet-requests/src/response.rs | 10 +- common/tun/src/linux/tun_device.rs | 52 ++-- .../ip-packet-router/src/constants.rs | 8 +- .../ip-packet-router/src/error.rs | 4 + .../ip-packet-router/src/ip_packet_router.rs | 8 +- .../ip-packet-router/src/mixnet_listener.rs | 230 +++++++++++------- .../ip-packet-router/src/tun_listener.rs | 42 +++- .../src/util/generate_new_ip.rs | 53 ++-- 10 files changed, 293 insertions(+), 154 deletions(-) diff --git a/common/ip-packet-requests/src/lib.rs b/common/ip-packet-requests/src/lib.rs index fc97d13042..f61e3f266f 100644 --- a/common/ip-packet-requests/src/lib.rs +++ b/common/ip-packet-requests/src/lib.rs @@ -1,8 +1,19 @@ +use serde::{Deserialize, Serialize}; +use std::net::{Ipv4Addr, Ipv6Addr}; + pub mod codec; pub mod request; pub mod response; -pub const CURRENT_VERSION: u8 = 3; +// version 3: initial version +// version 4: IPv6 support +pub const CURRENT_VERSION: u8 = 4; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct IPPair { + pub ipv4: Ipv4Addr, + pub ipv6: Ipv6Addr, +} fn make_bincode_serializer() -> impl bincode::Options { use bincode::Options; diff --git a/common/ip-packet-requests/src/request.rs b/common/ip-packet-requests/src/request.rs index 6f4b17ffea..011ff5bfe6 100644 --- a/common/ip-packet-requests/src/request.rs +++ b/common/ip-packet-requests/src/request.rs @@ -1,9 +1,15 @@ -use std::net::IpAddr; +use std::fmt::{Display, Formatter}; use nym_sphinx::addressing::clients::Recipient; use serde::{Deserialize, Serialize}; -use crate::{make_bincode_serializer, CURRENT_VERSION}; +use crate::{make_bincode_serializer, IPPair, CURRENT_VERSION}; + +impl Display for IPPair { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + writeln!(f, "IPv4: {}, IPV6: {}", self.ipv4, self.ipv6) + } +} fn generate_random() -> u64 { use rand::RngCore; @@ -19,7 +25,7 @@ pub struct IpPacketRequest { impl IpPacketRequest { pub fn new_static_connect_request( - ip: IpAddr, + ips: IPPair, reply_to: Recipient, reply_to_hops: Option, reply_to_avg_mix_delays: Option, @@ -31,7 +37,7 @@ impl IpPacketRequest { version: CURRENT_VERSION, data: IpPacketRequestData::StaticConnect(StaticConnectRequest { request_id, - ip, + ips, reply_to, reply_to_hops, reply_to_avg_mix_delays, @@ -137,7 +143,7 @@ pub enum IpPacketRequestData { pub struct StaticConnectRequest { pub request_id: u64, - pub ip: IpAddr, + pub ips: IPPair, // The nym-address the response should be sent back to pub reply_to: Recipient, @@ -210,6 +216,8 @@ pub struct HealthRequest { #[cfg(test)] mod tests { use super::*; + use std::net::{Ipv4Addr, Ipv6Addr}; + use std::str::FromStr; #[test] fn check_size_of_request() { @@ -218,15 +226,18 @@ mod tests { data: IpPacketRequestData::StaticConnect( StaticConnectRequest { request_id: 123, - ip: IpAddr::from([10, 0, 0, 1]), + ips: IPPair { + ipv4: Ipv4Addr::from_str("10.0.0.1").unwrap(), + ipv6: Ipv6Addr::from_str("2001:db8:a160::1").unwrap(), + }, reply_to: Recipient::try_from_base58_string("D1rrpsysCGCYXy9saP8y3kmNpGtJZUXN9SvFoUcqAsM9.9Ssso1ea5NfkbMASdiseDSjTN1fSWda5SgEVjdSN4CvV@GJqd3ZxpXWSNxTfx7B1pPtswpetH4LnJdFeLeuY5KUuN").unwrap(), reply_to_hops: None, reply_to_avg_mix_delays: None, buffer_timeout: None, }, - ) + ), }; - assert_eq!(connect.to_bytes().unwrap().len(), 108); + assert_eq!(connect.to_bytes().unwrap().len(), 123); } #[test] diff --git a/common/ip-packet-requests/src/response.rs b/common/ip-packet-requests/src/response.rs index 29553fa3e9..91972a35a3 100644 --- a/common/ip-packet-requests/src/response.rs +++ b/common/ip-packet-requests/src/response.rs @@ -1,9 +1,7 @@ -use std::net::IpAddr; - use nym_sphinx::addressing::clients::Recipient; use serde::{Deserialize, Serialize}; -use crate::{make_bincode_serializer, CURRENT_VERSION}; +use crate::{make_bincode_serializer, IPPair, CURRENT_VERSION}; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct IpPacketResponse { @@ -38,13 +36,13 @@ impl IpPacketResponse { } } - pub fn new_dynamic_connect_success(request_id: u64, reply_to: Recipient, ip: IpAddr) -> Self { + pub fn new_dynamic_connect_success(request_id: u64, reply_to: Recipient, ips: IPPair) -> Self { Self { version: CURRENT_VERSION, data: IpPacketResponseData::DynamicConnect(DynamicConnectResponse { request_id, reply_to, - reply: DynamicConnectResponseReply::Success(DynamicConnectSuccess { ip }), + reply: DynamicConnectResponseReply::Success(DynamicConnectSuccess { ips }), }), } } @@ -263,7 +261,7 @@ impl DynamicConnectResponseReply { #[derive(Clone, Debug, Serialize, Deserialize)] pub struct DynamicConnectSuccess { - pub ip: IpAddr, + pub ips: IPPair, } #[derive(Clone, Debug, Serialize, Deserialize, thiserror::Error)] diff --git a/common/tun/src/linux/tun_device.rs b/common/tun/src/linux/tun_device.rs index 20f514f4a9..94aea718de 100644 --- a/common/tun/src/linux/tun_device.rs +++ b/common/tun/src/linux/tun_device.rs @@ -1,3 +1,4 @@ +use std::net::Ipv6Addr; use std::{ collections::HashMap, net::{IpAddr, Ipv4Addr}, @@ -19,6 +20,12 @@ const TUN_WRITE_TIMEOUT_MS: u64 = 1000; #[derive(thiserror::Error, Debug)] pub enum TunDeviceError { + #[error("{0}")] + IO(#[from] std::io::Error), + + #[error("{0}")] + TokioTun(#[from] tokio_tun::Error), + #[error("timeout writing to tun device, dropping packet")] TunWriteTimeout, @@ -44,14 +51,18 @@ pub enum TunDeviceError { FailedToLockPeer, } -fn setup_tokio_tun_device(name: &str, address: Ipv4Addr, netmask: Ipv4Addr) -> tokio_tun::Tun { +fn setup_tokio_tun_device( + name: &str, + address: Ipv4Addr, + netmask: Ipv4Addr, +) -> Result { log::info!("Creating TUN device with: address={address}, netmask={netmask}"); // Read MTU size from env variable NYM_MTU_SIZE, else default to 1420. let mtu = std::env::var("NYM_MTU_SIZE") .map(|mtu| mtu.parse().expect("NYM_MTU_SIZE must be a valid integer")) .unwrap_or(1420); log::info!("Using MTU size: {mtu}"); - tokio_tun::Tun::builder() + Ok(tokio_tun::Tun::builder() .name(name) .tap(false) .packet_info(false) @@ -59,8 +70,7 @@ fn setup_tokio_tun_device(name: &str, address: Ipv4Addr, netmask: Ipv4Addr) -> t .up() .address(address) .netmask(netmask) - .try_build() - .expect("Failed to setup tun device, do you have permission?") + .try_build()?) } pub struct TunDevice { @@ -103,16 +113,18 @@ pub struct NatInner { pub struct TunDeviceConfig { pub base_name: String, - pub ip: Ipv4Addr, - pub netmask: Ipv4Addr, + pub ipv4: Ipv4Addr, + pub netmaskv4: Ipv4Addr, + pub ipv6: Ipv6Addr, + pub netmaskv6: String, } impl TunDevice { pub fn new( routing_mode: RoutingMode, config: TunDeviceConfig, - ) -> (Self, TunTaskTx, TunTaskResponseRx) { - let tun = Self::new_device_only(config); + ) -> Result<(Self, TunTaskTx, TunTaskResponseRx), TunDeviceError> { + let tun = Self::new_device_only(config)?; // Channels to communicate with the other tasks let (tun_task_tx, tun_task_rx) = tun_task_channel(); @@ -125,20 +137,32 @@ impl TunDevice { routing_mode, }; - (tun_device, tun_task_tx, tun_task_response_rx) + Ok((tun_device, tun_task_tx, tun_task_response_rx)) } - pub fn new_device_only(config: TunDeviceConfig) -> tokio_tun::Tun { + pub fn new_device_only(config: TunDeviceConfig) -> Result { let TunDeviceConfig { base_name, - ip, - netmask, + ipv4, + netmaskv4, + ipv6, + netmaskv6, } = config; let name = format!("{base_name}%d"); - let tun = setup_tokio_tun_device(&name, ip, netmask); + let tun = setup_tokio_tun_device(&name, ipv4, netmaskv4)?; log::info!("Created TUN device: {}", tun.name()); - tun + std::process::Command::new("ip") + .args([ + "-6", + "addr", + "add", + &format!("{}/{}", ipv6, netmaskv6), + "dev", + &tun.name(), + ]) + .output()?; + Ok(tun) } // Send outbound packets out on the wild internet diff --git a/service-providers/ip-packet-router/src/constants.rs b/service-providers/ip-packet-router/src/constants.rs index 04e3bd1a6b..eb7874f902 100644 --- a/service-providers/ip-packet-router/src/constants.rs +++ b/service-providers/ip-packet-router/src/constants.rs @@ -1,9 +1,13 @@ +use std::net::{Ipv4Addr, Ipv6Addr}; use std::time::Duration; // The interface used to route traffic pub const TUN_BASE_NAME: &str = "nymtun"; -pub const TUN_DEVICE_ADDRESS: &str = "10.0.0.1"; -pub const TUN_DEVICE_NETMASK: &str = "255.255.255.0"; +pub const TUN_DEVICE_ADDRESS_V4: Ipv4Addr = Ipv4Addr::new(10, 0, 0, 1); +pub const TUN_DEVICE_NETMASK_V4: Ipv4Addr = Ipv4Addr::new(255, 255, 255, 0); +pub const TUN_DEVICE_ADDRESS_V6: Ipv6Addr = Ipv6Addr::new(0x2001, 0xdb8, 0xa160, 0, 0, 0, 0, 0x1); // 2001:db8:a160::1 + +pub const TUN_DEVICE_NETMASK_V6: &str = "120"; // We routinely check if any clients needs to be disconnected at this interval pub(crate) const DISCONNECT_TIMER_INTERVAL: Duration = Duration::from_secs(10); diff --git a/service-providers/ip-packet-router/src/error.rs b/service-providers/ip-packet-router/src/error.rs index d4e0940b48..4732177191 100644 --- a/service-providers/ip-packet-router/src/error.rs +++ b/service-providers/ip-packet-router/src/error.rs @@ -11,6 +11,10 @@ pub enum IpPacketRouterError { #[error("client-core error: {0}")] ClientCoreError(#[from] ClientCoreError), + #[cfg(target_os = "linux")] + #[error("tun device error: {0}")] + TunDeviceError(#[from] nym_tun::tun_device::TunDeviceError), + #[error("failed to load configuration file: {0}")] FailedToLoadConfig(String), diff --git a/service-providers/ip-packet-router/src/ip_packet_router.rs b/service-providers/ip-packet-router/src/ip_packet_router.rs index c6cd08e59d..85f2ce2f3f 100644 --- a/service-providers/ip-packet-router/src/ip_packet_router.rs +++ b/service-providers/ip-packet-router/src/ip_packet_router.rs @@ -133,11 +133,13 @@ impl IpPacketRouter { // Create the TUN device that we interact with the rest of the world with let config = nym_tun::tun_device::TunDeviceConfig { base_name: crate::constants::TUN_BASE_NAME.to_string(), - ip: crate::constants::TUN_DEVICE_ADDRESS.parse().unwrap(), - netmask: crate::constants::TUN_DEVICE_NETMASK.parse().unwrap(), + ipv4: crate::constants::TUN_DEVICE_ADDRESS_V4, + netmaskv4: crate::constants::TUN_DEVICE_NETMASK_V4, + ipv6: crate::constants::TUN_DEVICE_ADDRESS_V6, + netmaskv6: crate::constants::TUN_DEVICE_NETMASK_V6.to_string(), }; let (tun_reader, tun_writer) = - tokio::io::split(nym_tun::tun_device::TunDevice::new_device_only(config)); + tokio::io::split(nym_tun::tun_device::TunDevice::new_device_only(config)?); // Channel used by the IpPacketRouter to signal connected and disconnected clients to the // TunListener diff --git a/service-providers/ip-packet-router/src/mixnet_listener.rs b/service-providers/ip-packet-router/src/mixnet_listener.rs index 1f14c18218..813c4b2e52 100644 --- a/service-providers/ip-packet-router/src/mixnet_listener.rs +++ b/service-providers/ip-packet-router/src/mixnet_listener.rs @@ -1,7 +1,6 @@ -use std::{ - collections::HashMap, - net::{IpAddr, SocketAddr}, -}; +use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; +use std::sync::Arc; +use std::{collections::HashMap, net::SocketAddr}; use bytes::{Bytes, BytesMut}; use futures::StreamExt; @@ -12,6 +11,7 @@ use nym_ip_packet_requests::{ DynamicConnectFailureReason, ErrorResponseReply, IpPacketResponse, StaticConnectFailureReason, }, + IPPair, }; use nym_sdk::mixnet::{MixnetMessageSender, Recipient}; use nym_sphinx::receiver::ReconstructedMessage; @@ -19,6 +19,7 @@ use nym_task::TaskHandle; use tap::TapFallible; #[cfg(target_os = "linux")] use tokio::io::AsyncWriteExt; +use tokio::sync::RwLock; use tokio_util::codec::Decoder; use crate::{ @@ -37,7 +38,8 @@ use crate::{ pub(crate) struct ConnectedClients { // The set of connected clients - clients: HashMap, + clients_ipv4_mapping: HashMap, + clients_ipv6_mapping: HashMap, // Notify the tun listener when a new client connects or disconnects tun_listener_connected_client_tx: tokio::sync::mpsc::UnboundedSender, @@ -48,46 +50,62 @@ impl ConnectedClients { let (connected_client_tx, connected_client_rx) = tokio::sync::mpsc::unbounded_channel(); ( Self { - clients: Default::default(), + clients_ipv4_mapping: Default::default(), + clients_ipv6_mapping: Default::default(), tun_listener_connected_client_tx: connected_client_tx, }, tun_listener::ConnectedClientsListener::new(connected_client_rx), ) } - fn is_ip_connected(&self, ip: &IpAddr) -> bool { - self.clients.contains_key(ip) + fn is_ip_connected(&self, ips: &IPPair) -> bool { + self.clients_ipv4_mapping.contains_key(&ips.ipv4) + || self.clients_ipv6_mapping.contains_key(&ips.ipv6) } fn get_client_from_ip_mut(&mut self, ip: &IpAddr) -> Option<&mut ConnectedClient> { - self.clients.get_mut(ip) + match ip { + IpAddr::V4(ip) => self.clients_ipv4_mapping.get_mut(ip), + IpAddr::V6(ip) => self.clients_ipv6_mapping.get_mut(ip), + } } fn is_nym_address_connected(&self, nym_address: &Recipient) -> bool { - self.clients + self.clients_ipv4_mapping .values() .any(|client| client.nym_address == *nym_address) } - fn lookup_ip_from_nym_address(&self, nym_address: &Recipient) -> Option { - self.clients.iter().find_map(|(ip, client)| { - if client.nym_address == *nym_address { - Some(*ip) - } else { - None - } - }) + fn lookup_ip_from_nym_address(&self, nym_address: &Recipient) -> Option { + self.clients_ipv4_mapping + .iter() + .find_map(|(ipv4, connected_client)| { + if connected_client.nym_address == *nym_address { + Some(IPPair { + ipv4: *ipv4, + ipv6: connected_client.ipv6, + }) + } else { + None + } + }) } fn lookup_client_from_nym_address(&self, nym_address: &Recipient) -> Option<&ConnectedClient> { - self.clients - .values() - .find(|client| client.nym_address == *nym_address) + self.clients_ipv4_mapping + .iter() + .find_map(|(_, connected_client)| { + if connected_client.nym_address == *nym_address { + Some(connected_client) + } else { + None + } + }) } fn connect( &mut self, - ip: IpAddr, + ips: IPPair, nym_address: Recipient, mix_hops: Option, forward_from_tun_tx: tokio::sync::mpsc::UnboundedSender>, @@ -96,21 +114,25 @@ impl ConnectedClients { ) { // The map of connected clients that the mixnet listener keeps track of. It monitors // activity and disconnects clients that have been inactive for too long. - self.clients.insert( - ip, - ConnectedClient { + let client = ConnectedClient { + nym_address, + ipv6: ips.ipv6, + mix_hops, + last_activity: Arc::new(RwLock::new(std::time::Instant::now())), + _close_tx: Arc::new(CloseTx { nym_address, - mix_hops, - last_activity: std::time::Instant::now(), - close_tx: Some(close_tx), - handle, - }, - ); + inner: Some(close_tx), + }), + handle: Arc::new(handle), + }; + log::info!("Inserting {} and {}", ips.ipv4, ips.ipv6); + self.clients_ipv4_mapping.insert(ips.ipv4, client.clone()); + self.clients_ipv6_mapping.insert(ips.ipv6, client); // Send the connected client info to the tun listener, which will use it to forward packets // to the connected client handler. self.tun_listener_connected_client_tx .send(ConnectedClientEvent::Connect(Box::new(ConnectEvent { - ip, + ips, forward_from_tun_tx, }))) .tap_err(|err| { @@ -119,9 +141,9 @@ impl ConnectedClients { .ok(); } - fn update_activity(&mut self, ip: &IpAddr) -> Result<()> { - if let Some(client) = self.clients.get_mut(ip) { - client.last_activity = std::time::Instant::now(); + async fn update_activity(&mut self, ips: &IPPair) -> Result<()> { + if let Some(client) = self.clients_ipv4_mapping.get(&ips.ipv4) { + *client.last_activity.write().await = std::time::Instant::now(); Ok(()) } else { Err(IpPacketRouterError::FailedToUpdateClientActivity) @@ -129,12 +151,18 @@ impl ConnectedClients { } // Identify connected client handlers that have stopped without being told to stop - fn get_finished_client_handlers(&mut self) -> Vec<(IpAddr, Recipient)> { - self.clients + fn get_finished_client_handlers(&mut self) -> Vec<(IPPair, Recipient)> { + self.clients_ipv4_mapping .iter_mut() - .filter_map(|(ip, client)| { - if client.handle.is_finished() { - Some((*ip, client.nym_address)) + .filter_map(|(ip, connected_client)| { + if connected_client.handle.is_finished() { + Some(( + IPPair { + ipv4: *ip, + ipv6: connected_client.ipv6, + }, + connected_client.nym_address, + )) } else { None } @@ -142,26 +170,32 @@ impl ConnectedClients { .collect() } - fn get_inactive_clients(&mut self) -> Vec<(IpAddr, Recipient)> { + async fn get_inactive_clients(&mut self) -> Vec<(IPPair, Recipient)> { let now = std::time::Instant::now(); - self.clients - .iter() - .filter_map(|(ip, client)| { - if now.duration_since(client.last_activity) > CLIENT_MIXNET_INACTIVITY_TIMEOUT { - Some((*ip, client.nym_address)) - } else { - None - } - }) - .collect() + let mut ret = vec![]; + for (ip, connected_client) in self.clients_ipv4_mapping.iter() { + if now.duration_since(*connected_client.last_activity.read().await) + > CLIENT_MIXNET_INACTIVITY_TIMEOUT + { + ret.push(( + IPPair { + ipv4: *ip, + ipv6: connected_client.ipv6, + }, + connected_client.nym_address, + )) + } + } + ret } - fn disconnect_stopped_client_handlers(&mut self, stopped_clients: Vec<(IpAddr, Recipient)>) { - for (ip, _) in &stopped_clients { - log::info!("Disconnect stopped client: {ip}"); - self.clients.remove(ip); + fn disconnect_stopped_client_handlers(&mut self, stopped_clients: Vec<(IPPair, Recipient)>) { + for (ips, _) in &stopped_clients { + log::info!("Disconnect stopped client: {ips}"); + self.clients_ipv4_mapping.remove(&ips.ipv4); + self.clients_ipv6_mapping.remove(&ips.ipv6); self.tun_listener_connected_client_tx - .send(ConnectedClientEvent::Disconnect(DisconnectEvent(*ip))) + .send(ConnectedClientEvent::Disconnect(DisconnectEvent(*ips))) .tap_err(|err| { log::error!("Failed to send disconnect event: {err}"); }) @@ -169,12 +203,13 @@ impl ConnectedClients { } } - fn disconnect_inactive_clients(&mut self, inactive_clients: Vec<(IpAddr, Recipient)>) { - for (ip, _) in &inactive_clients { - log::info!("Disconnect inactive client: {ip}"); - self.clients.remove(ip); + fn disconnect_inactive_clients(&mut self, inactive_clients: Vec<(IPPair, Recipient)>) { + for (ips, _) in &inactive_clients { + log::info!("Disconnect inactive client: {ips}"); + self.clients_ipv4_mapping.remove(&ips.ipv4); + self.clients_ipv6_mapping.remove(&ips.ipv6); self.tun_listener_connected_client_tx - .send(ConnectedClientEvent::Disconnect(DisconnectEvent(*ip))) + .send(ConnectedClientEvent::Disconnect(DisconnectEvent(*ips))) .tap_err(|err| { log::error!("Failed to send disconnect event: {err}"); }) @@ -182,40 +217,49 @@ impl ConnectedClients { } } - fn find_new_ip(&self) -> Option { - generate_new_ip::find_new_ip(&self.clients) + fn find_new_ip(&self) -> Option { + generate_new_ip::find_new_ips(&self.clients_ipv4_mapping, &self.clients_ipv6_mapping) } } +pub(crate) struct CloseTx { + pub(crate) nym_address: Recipient, + // Send to connected clients listener to stop. This is option only because we need to take + // ownership of it when the client is dropped. + pub(crate) inner: Option>, +} + +#[derive(Clone)] pub(crate) struct ConnectedClient { // The nym address of the connected client that we are communicating with on the other side of // the mixnet pub(crate) nym_address: Recipient, + // The assigned IPv6 address of this client + pub(crate) ipv6: Ipv6Addr, + // Number of mix node hops that the client has requested to use pub(crate) mix_hops: Option, // Keep track of last activity so we can disconnect inactive clients - pub(crate) last_activity: std::time::Instant, + pub(crate) last_activity: Arc>, - // Send to connected clients listener to stop. This is option only because we need to take - // ownership of it when the client is dropped. - pub(crate) close_tx: Option>, + pub(crate) _close_tx: Arc, // Handle for the connected client handler - pub(crate) handle: tokio::task::JoinHandle<()>, + pub(crate) handle: Arc>, } impl ConnectedClient { - fn update_activity(&mut self) { - self.last_activity = std::time::Instant::now(); + async fn update_activity(&self) { + *self.last_activity.write().await = std::time::Instant::now(); } } -impl Drop for ConnectedClient { +impl Drop for CloseTx { fn drop(&mut self) { log::debug!("signal to close client: {}", self.nym_address); - if let Some(close_tx) = self.close_tx.take() { + if let Some(close_tx) = self.inner.take() { close_tx.send(()).ok(); } } @@ -259,7 +303,7 @@ impl MixnetListener { ); let request_id = connect_request.request_id; - let requested_ip = connect_request.ip; + let requested_ips = connect_request.ips; let reply_to = connect_request.reply_to; let reply_to_hops = connect_request.reply_to_hops; // TODO: add to connect request @@ -267,7 +311,7 @@ impl MixnetListener { // TODO: ignoring reply_to_avg_mix_delays for now // Check that the IP is available in the set of connected clients - let is_ip_taken = self.connected_clients.is_ip_connected(&requested_ip); + let is_ip_taken = self.connected_clients.is_ip_connected(&requested_ips); // Check that the nym address isn't already registered let is_nym_address_taken = self.connected_clients.is_nym_address_connected(&reply_to); @@ -277,7 +321,8 @@ impl MixnetListener { log::info!("Connecting an already connected client"); if self .connected_clients - .update_activity(&requested_ip) + .update_activity(&requested_ips) + .await .is_err() { log::error!("Failed to update activity for client"); @@ -300,7 +345,7 @@ impl MixnetListener { // Register the new client in the set of connected clients self.connected_clients.connect( - requested_ip, + requested_ips, reply_to, reply_to_hops, forward_from_tun_tx, @@ -350,11 +395,12 @@ impl MixnetListener { // TODO: this is problematic. Until we sign connect requests this means you can spam people // with return traffic - if let Some(existing_ip) = self.connected_clients.lookup_ip_from_nym_address(&reply_to) { + if let Some(existing_ips) = self.connected_clients.lookup_ip_from_nym_address(&reply_to) { log::info!("Found existing client for nym address"); if self .connected_clients - .update_activity(&existing_ip) + .update_activity(&existing_ips) + .await .is_err() { log::error!("Failed to update activity for client"); @@ -362,11 +408,11 @@ impl MixnetListener { return Ok(Some(IpPacketResponse::new_dynamic_connect_success( request_id, reply_to, - existing_ip, + existing_ips, ))); } - let Some(new_ip) = self.connected_clients.find_new_ip() else { + let Some(new_ips) = self.connected_clients.find_new_ip() else { log::info!("No available IP address"); return Ok(Some(IpPacketResponse::new_dynamic_connect_failure( request_id, @@ -386,7 +432,7 @@ impl MixnetListener { // Register the new client in the set of connected clients self.connected_clients.connect( - new_ip, + new_ips, reply_to, reply_to_hops, forward_from_tun_tx, @@ -394,7 +440,7 @@ impl MixnetListener { handle, ); Ok(Some(IpPacketResponse::new_dynamic_connect_success( - request_id, reply_to, new_ip, + request_id, reply_to, new_ips, ))) } @@ -428,7 +474,7 @@ impl MixnetListener { if let Some(connected_client) = self.connected_clients.get_client_from_ip_mut(&src_addr) { // Keep track of activity so we can disconnect inactive clients - connected_client.update_activity(); + connected_client.update_activity().await; // For packets without a port, use 0. let dst = dst.unwrap_or_else(|| SocketAddr::new(dst_addr, 0)); @@ -539,9 +585,9 @@ impl MixnetListener { } } - fn handle_disconnect_timer(&mut self) { + async fn handle_disconnect_timer(&mut self) { let stopped_clients = self.connected_clients.get_finished_client_handlers(); - let inactive_clients = self.connected_clients.get_inactive_clients(); + let inactive_clients = self.connected_clients.get_inactive_clients().await; // TODO: Send disconnect responses to all disconnected clients //for (ip, nym_address) in stopped_clients.iter().chain(disconnected_clients.iter()) { @@ -571,10 +617,14 @@ impl MixnetListener { })?; // We could avoid this lookup if we check this when we create the response. - let mix_hops = self + let mix_hops = if let Some(c) = self .connected_clients .lookup_client_from_nym_address(recipient) - .and_then(|c| c.mix_hops); + { + c.mix_hops + } else { + None + }; let input_message = create_input_message(*recipient, response_packet, mix_hops); self.mixnet_client @@ -613,7 +663,7 @@ impl MixnetListener { log::debug!("IpPacketRouter [main loop]: received shutdown"); }, _ = disconnect_timer.tick() => { - self.handle_disconnect_timer(); + self.handle_disconnect_timer().await; }, msg = self.mixnet_client.next() => { if let Some(msg) = msg { @@ -642,9 +692,9 @@ pub(crate) enum ConnectedClientEvent { Connect(Box), } -pub(crate) struct DisconnectEvent(pub(crate) IpAddr); +pub(crate) struct DisconnectEvent(pub(crate) IPPair); pub(crate) struct ConnectEvent { - pub(crate) ip: IpAddr, + pub(crate) ips: IPPair, pub(crate) forward_from_tun_tx: tokio::sync::mpsc::UnboundedSender>, } diff --git a/service-providers/ip-packet-router/src/tun_listener.rs b/service-providers/ip-packet-router/src/tun_listener.rs index 34fb12526e..8d2ba41371 100644 --- a/service-providers/ip-packet-router/src/tun_listener.rs +++ b/service-providers/ip-packet-router/src/tun_listener.rs @@ -1,5 +1,7 @@ -use std::{collections::HashMap, net::IpAddr}; +use std::collections::HashMap; +use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; +use nym_ip_packet_requests::IPPair; use nym_task::TaskClient; #[cfg(target_os = "linux")] use tokio::io::AsyncReadExt; @@ -15,10 +17,12 @@ use crate::{ // It's even ok if this is slightly out of date pub(crate) struct ConnectedClientMirror { pub(crate) forward_from_tun_tx: tokio::sync::mpsc::UnboundedSender>, + pub(crate) ips: IPPair, } pub(crate) struct ConnectedClientsListener { - clients: HashMap, + clients_ipv4: HashMap, + clients_ipv6: HashMap, connected_client_rx: tokio::sync::mpsc::UnboundedReceiver, } @@ -30,35 +34,48 @@ impl ConnectedClientsListener { >, ) -> Self { ConnectedClientsListener { - clients: HashMap::new(), + clients_ipv4: HashMap::new(), + clients_ipv6: HashMap::new(), connected_client_rx, } } pub(crate) fn get(&self, ip: &IpAddr) -> Option<&ConnectedClientMirror> { - self.clients.get(ip) + match ip { + IpAddr::V4(ip) => self.clients_ipv4.get(ip), + IpAddr::V6(ip) => self.clients_ipv6.get(ip), + } } pub(crate) fn update(&mut self, event: mixnet_listener::ConnectedClientEvent) { match event { mixnet_listener::ConnectedClientEvent::Connect(connected_event) => { let mixnet_listener::ConnectEvent { - ip, + ips, forward_from_tun_tx, } = *connected_event; - log::trace!("Connect client: {ip}"); - self.clients.insert( - ip, + log::trace!("Connect client: {ips}"); + self.clients_ipv4.insert( + ips.ipv4, + ConnectedClientMirror { + forward_from_tun_tx: forward_from_tun_tx.clone(), + ips, + }, + ); + self.clients_ipv6.insert( + ips.ipv6, ConnectedClientMirror { forward_from_tun_tx, + ips, }, ); } mixnet_listener::ConnectedClientEvent::Disconnect( - mixnet_listener::DisconnectEvent(ip), + mixnet_listener::DisconnectEvent(ips), ) => { - log::trace!("Disconnect client: {ip}"); - self.clients.remove(&ip); + log::trace!("Disconnect client: {ips}"); + self.clients_ipv4.remove(&ips.ipv4); + self.clients_ipv6.remove(&ips.ipv6); } } } @@ -82,6 +99,7 @@ impl TunListener { if let Some(ConnectedClientMirror { forward_from_tun_tx, + ips, }) = self.connected_clients.get(&dst_addr) { let packet = buf[..len].to_vec(); @@ -89,7 +107,7 @@ impl TunListener { log::warn!("Failed to forward packet to connected client {dst_addr}: disconnecting it from tun listener"); self.connected_clients .update(mixnet_listener::ConnectedClientEvent::Disconnect( - mixnet_listener::DisconnectEvent(dst_addr), + mixnet_listener::DisconnectEvent(*ips), )); } } else { diff --git a/service-providers/ip-packet-router/src/util/generate_new_ip.rs b/service-providers/ip-packet-router/src/util/generate_new_ip.rs index 5824ce7bba..8e7a688853 100644 --- a/service-providers/ip-packet-router/src/util/generate_new_ip.rs +++ b/service-providers/ip-packet-router/src/util/generate_new_ip.rs @@ -1,38 +1,55 @@ -use std::{ - collections::HashMap, - net::{IpAddr, Ipv4Addr}, -}; +use nym_ip_packet_requests::IPPair; +use std::net::Ipv6Addr; +use std::{collections::HashMap, net::Ipv4Addr}; -use crate::{constants::TUN_DEVICE_ADDRESS, mixnet_listener::ConnectedClient}; +use crate::constants::{TUN_DEVICE_ADDRESS_V4, TUN_DEVICE_ADDRESS_V6}; // Find an available IP address in self.connected_clients // TODO: make this nicer -fn generate_random_ip_within_subnet() -> Ipv4Addr { +fn generate_random_ips_within_subnet() -> IPPair { let mut rng = rand::thread_rng(); // Generate a random number in the range 1-254 let last_octet = rand::Rng::gen_range(&mut rng, 1..=254); - Ipv4Addr::new(10, 0, 0, last_octet) + let ipv4 = Ipv4Addr::new(10, 0, 0, last_octet); + let ipv6 = Ipv6Addr::new(0x2001, 0x0db8, 0xa160, 0, 0, 0, 0, last_octet as u16); + IPPair { ipv4, ipv6 } } -fn is_ip_taken( - connected_clients: &HashMap, - tun_ip: Ipv4Addr, - ip: Ipv4Addr, +fn is_ip_taken( + connected_clients_ipv4: &HashMap, + connected_clients_ipv6: &HashMap, + tun_ips: IPPair, + ips: IPPair, ) -> bool { - connected_clients.contains_key(&ip.into()) || ip == tun_ip + connected_clients_ipv4.contains_key(&ips.ipv4) + || connected_clients_ipv6.contains_key(&ips.ipv6) + || ips.ipv4 == tun_ips.ipv4 + || ips.ipv6 == tun_ips.ipv6 } // TODO: brute force approach. We could consider using a more efficient algorithm -pub(crate) fn find_new_ip(connected_clients: &HashMap) -> Option { - let mut new_ip = generate_random_ip_within_subnet(); +pub(crate) fn find_new_ips( + connected_clients_ipv4: &HashMap, + connected_clients_ipv6: &HashMap, +) -> Option { + let mut new_ips = generate_random_ips_within_subnet(); let mut tries = 0; - let tun_ip = TUN_DEVICE_ADDRESS.parse::().unwrap(); - while is_ip_taken(connected_clients, tun_ip, new_ip) { - new_ip = generate_random_ip_within_subnet(); + let tun_ips = IPPair { + ipv4: TUN_DEVICE_ADDRESS_V4, + ipv6: TUN_DEVICE_ADDRESS_V6, + }; + + while is_ip_taken( + connected_clients_ipv4, + connected_clients_ipv6, + tun_ips, + new_ips, + ) { + new_ips = generate_random_ips_within_subnet(); tries += 1; if tries > 100 { return None; } } - Some(new_ip.into()) + Some(new_ips) } From f5d9fda0b153591ac84bace7e872ccebe23a7bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Mon, 4 Mar 2024 09:38:29 +0000 Subject: [PATCH 09/35] moved and renamed nym-id to nym-id-cli --- Cargo.lock | 2 +- Cargo.toml | 4 +++- {nym-id => tools/nym-id-cli}/Cargo.toml | 8 ++++---- {nym-id => tools/nym-id-cli}/src/commands/build_info.rs | 0 .../nym-id-cli}/src/commands/import_credential.rs | 0 {nym-id => tools/nym-id-cli}/src/commands/mod.rs | 0 {nym-id => tools/nym-id-cli}/src/commands/setup.rs | 0 {nym-id => tools/nym-id-cli}/src/main.rs | 0 8 files changed, 8 insertions(+), 6 deletions(-) rename {nym-id => tools/nym-id-cli}/Cargo.toml (67%) rename {nym-id => tools/nym-id-cli}/src/commands/build_info.rs (100%) rename {nym-id => tools/nym-id-cli}/src/commands/import_credential.rs (100%) rename {nym-id => tools/nym-id-cli}/src/commands/mod.rs (100%) rename {nym-id => tools/nym-id-cli}/src/commands/setup.rs (100%) rename {nym-id => tools/nym-id-cli}/src/main.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 2bd734b3f6..0dc8ab742c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5629,7 +5629,7 @@ dependencies = [ ] [[package]] -name = "nym-id" +name = "nym-id-cli" version = "0.1.0" dependencies = [ "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 0f369f0a80..f479a81f57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,6 +56,7 @@ members = [ "common/node-tester-utils", "common/nonexhaustive-delayqueue", "common/nymcoconut", + "common/nym-id-lib", "common/nymsphinx", "common/nymsphinx/acknowledgements", "common/nymsphinx/addressing", @@ -106,13 +107,14 @@ members = [ "tools/internal/ssl-inject", # "tools/internal/sdk-version-bump", "tools/nym-cli", + "tools/nym-id-cli", "tools/nym-nr-query", "tools/nymvisor", "tools/ts-rs-cli", "wasm/client", # "wasm/full-nym-wasm", "wasm/mix-fetch", - "wasm/node-tester", "nym-id", "common/nym-id-lib", + "wasm/node-tester", ] default-members = [ diff --git a/nym-id/Cargo.toml b/tools/nym-id-cli/Cargo.toml similarity index 67% rename from nym-id/Cargo.toml rename to tools/nym-id-cli/Cargo.toml index 49da695276..c57404397a 100644 --- a/nym-id/Cargo.toml +++ b/tools/nym-id-cli/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "nym-id" +name = "nym-id-cli" version = "0.1.0" authors.workspace = true repository.workspace = true @@ -17,6 +17,6 @@ clap = { workspace = true, features = ["derive"] } tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } tracing.workspace = true -nym-bin-common = { path = "../common/bin-common", features = ["output_format", "basic_tracing"] } -nym-credential-storage = { path = "../common/credential-storage" } -nym-id-lib = { path = "../common/nym-id-lib" } +nym-bin-common = { path = "../../common/bin-common", features = ["output_format", "basic_tracing"] } +nym-credential-storage = { path = "../../common/credential-storage" } +nym-id-lib = { path = "../../common/nym-id-lib" } diff --git a/nym-id/src/commands/build_info.rs b/tools/nym-id-cli/src/commands/build_info.rs similarity index 100% rename from nym-id/src/commands/build_info.rs rename to tools/nym-id-cli/src/commands/build_info.rs diff --git a/nym-id/src/commands/import_credential.rs b/tools/nym-id-cli/src/commands/import_credential.rs similarity index 100% rename from nym-id/src/commands/import_credential.rs rename to tools/nym-id-cli/src/commands/import_credential.rs diff --git a/nym-id/src/commands/mod.rs b/tools/nym-id-cli/src/commands/mod.rs similarity index 100% rename from nym-id/src/commands/mod.rs rename to tools/nym-id-cli/src/commands/mod.rs diff --git a/nym-id/src/commands/setup.rs b/tools/nym-id-cli/src/commands/setup.rs similarity index 100% rename from nym-id/src/commands/setup.rs rename to tools/nym-id-cli/src/commands/setup.rs diff --git a/nym-id/src/main.rs b/tools/nym-id-cli/src/main.rs similarity index 100% rename from nym-id/src/main.rs rename to tools/nym-id-cli/src/main.rs From a04a782dbf7c5ca5b989d5e93821f95ff8587717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Mon, 4 Mar 2024 09:40:11 +0000 Subject: [PATCH 10/35] renamed nym-id-lib to nym-id --- Cargo.lock | 38 +++++++++---------- Cargo.toml | 2 +- clients/native/Cargo.toml | 2 +- .../native/src/commands/import_credential.rs | 2 +- clients/native/src/error.rs | 2 +- clients/socks5/Cargo.toml | 2 +- .../socks5/src/commands/import_credential.rs | 2 +- clients/socks5/src/error.rs | 2 +- common/commands/Cargo.toml | 2 +- .../commands/src/coconut/import_credential.rs | 2 +- common/{nym-id-lib => nym-id}/Cargo.toml | 2 +- common/{nym-id-lib => nym-id}/src/error.rs | 0 .../src/import_credential.rs | 0 common/{nym-id-lib => nym-id}/src/lib.rs | 0 .../network-requester/Cargo.toml | 2 +- .../src/cli/import_credential.rs | 2 +- .../network-requester/src/error.rs | 2 +- tools/nym-id-cli/Cargo.toml | 2 +- .../src/commands/import_credential.rs | 2 +- 19 files changed, 34 insertions(+), 34 deletions(-) rename common/{nym-id-lib => nym-id}/Cargo.toml (96%) rename common/{nym-id-lib => nym-id}/src/error.rs (100%) rename common/{nym-id-lib => nym-id}/src/import_credential.rs (100%) rename common/{nym-id-lib => nym-id}/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 0dc8ab742c..c3df2e1c05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5128,7 +5128,7 @@ dependencies = [ "nym-credentials", "nym-credentials-interface", "nym-crypto", - "nym-id-lib", + "nym-id", "nym-mixnet-contract-common", "nym-multisig-contract-common", "nym-name-service-common", @@ -5169,7 +5169,7 @@ dependencies = [ "nym-credentials", "nym-crypto", "nym-gateway-requests", - "nym-id-lib", + "nym-id", "nym-network-defaults", "nym-pemstore", "nym-sphinx", @@ -5629,21 +5629,7 @@ dependencies = [ ] [[package]] -name = "nym-id-cli" -version = "0.1.0" -dependencies = [ - "anyhow", - "bs58 0.5.0", - "clap 4.4.7", - "nym-bin-common", - "nym-credential-storage", - "nym-id-lib", - "tokio", - "tracing", -] - -[[package]] -name = "nym-id-lib" +name = "nym-id" version = "0.1.0" dependencies = [ "nym-credential-storage", @@ -5654,6 +5640,20 @@ dependencies = [ "zeroize", ] +[[package]] +name = "nym-id-cli" +version = "0.1.0" +dependencies = [ + "anyhow", + "bs58 0.5.0", + "clap 4.4.7", + "nym-bin-common", + "nym-credential-storage", + "nym-id", + "tokio", + "tracing", +] + [[package]] name = "nym-inclusion-probability" version = "0.1.0" @@ -5892,7 +5892,7 @@ dependencies = [ "nym-credentials", "nym-crypto", "nym-exit-policy", - "nym-id-lib", + "nym-id", "nym-network-defaults", "nym-ordered-buffer", "nym-sdk", @@ -6180,7 +6180,7 @@ dependencies = [ "nym-credentials", "nym-crypto", "nym-gateway-requests", - "nym-id-lib", + "nym-id", "nym-network-defaults", "nym-ordered-buffer", "nym-pemstore", diff --git a/Cargo.toml b/Cargo.toml index f479a81f57..d67b66149a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ members = [ "common/node-tester-utils", "common/nonexhaustive-delayqueue", "common/nymcoconut", - "common/nym-id-lib", + "common/nym-id", "common/nymsphinx", "common/nymsphinx/acknowledgements", "common/nymsphinx/addressing", diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index 9da09cd0d0..a85b73e5a4 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -51,6 +51,6 @@ nym-task = { path = "../../common/task" } nym-topology = { path = "../../common/topology" } nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["http-client"] } nym-client-websocket-requests = { path = "websocket-requests" } -nym-id-lib = { path = "../../common/nym-id-lib" } +nym-id = { path = "../../common/nym-id" } [dev-dependencies] diff --git a/clients/native/src/commands/import_credential.rs b/clients/native/src/commands/import_credential.rs index aac7feaa64..8554f74ee7 100644 --- a/clients/native/src/commands/import_credential.rs +++ b/clients/native/src/commands/import_credential.rs @@ -5,7 +5,7 @@ use crate::commands::try_load_current_config; use crate::error::ClientError; use clap::ArgGroup; -use nym_id_lib::import_credential; +use nym_id::import_credential; use std::fs; use std::path::PathBuf; diff --git a/clients/native/src/error.rs b/clients/native/src/error.rs index b4f47cf90b..33daa1247d 100644 --- a/clients/native/src/error.rs +++ b/clients/native/src/error.rs @@ -1,6 +1,6 @@ use nym_client_core::error::ClientCoreError; -use nym_id_lib::NymIdError; +use nym_id::NymIdError; #[derive(thiserror::Error, Debug)] pub enum ClientError { diff --git a/clients/socks5/Cargo.toml b/clients/socks5/Cargo.toml index 0af4c34770..2665f6355c 100644 --- a/clients/socks5/Cargo.toml +++ b/clients/socks5/Cargo.toml @@ -35,7 +35,7 @@ nym-ordered-buffer = { path = "../../common/socks5/ordered-buffer" } nym-pemstore = { path = "../../common/pemstore" } nym-topology = { path = "../../common/topology" } nym-socks5-client-core = { path = "../../common/socks5-client-core" } -nym-id-lib = { path = "../../common/nym-id-lib" } +nym-id = { path = "../../common/nym-id" } [features] default = [] diff --git a/clients/socks5/src/commands/import_credential.rs b/clients/socks5/src/commands/import_credential.rs index 25285870f8..8a13e799d3 100644 --- a/clients/socks5/src/commands/import_credential.rs +++ b/clients/socks5/src/commands/import_credential.rs @@ -5,7 +5,7 @@ use crate::commands::try_load_current_config; use crate::error::Socks5ClientError; use clap::ArgGroup; -use nym_id_lib::import_credential; +use nym_id::import_credential; use std::fs; use std::path::PathBuf; diff --git a/clients/socks5/src/error.rs b/clients/socks5/src/error.rs index 788d1250f8..de40ccfefa 100644 --- a/clients/socks5/src/error.rs +++ b/clients/socks5/src/error.rs @@ -1,6 +1,6 @@ use nym_client_core::error::ClientCoreError; -use nym_id_lib::NymIdError; +use nym_id::NymIdError; #[derive(thiserror::Error, Debug)] pub enum Socks5ClientError { diff --git a/common/commands/Cargo.toml b/common/commands/Cargo.toml index dba6b7a9b5..6c96a3f93d 100644 --- a/common/commands/Cargo.toml +++ b/common/commands/Cargo.toml @@ -55,7 +55,7 @@ nym-credentials = { path = "../../common/credentials" } nym-credentials-interface = { path = "../../common/credentials-interface" } nym-credential-storage = { path = "../../common/credential-storage" } nym-credential-utils = { path = "../../common/credential-utils" } -nym-id-lib = { path = "../../common/nym-id-lib" } +nym-id = { path = "../nym-id" } nym-pemstore = { path = "../../common/pemstore", version = "0.3.0" } nym-types = { path = "../../common/types" } diff --git a/common/commands/src/coconut/import_credential.rs b/common/commands/src/coconut/import_credential.rs index 388961ace4..852f94e34a 100644 --- a/common/commands/src/coconut/import_credential.rs +++ b/common/commands/src/coconut/import_credential.rs @@ -6,7 +6,7 @@ use anyhow::bail; use clap::ArgGroup; use clap::Parser; use nym_credential_storage::initialise_persistent_storage; -use nym_id_lib::import_credential; +use nym_id::import_credential; use std::fs; use std::path::PathBuf; diff --git a/common/nym-id-lib/Cargo.toml b/common/nym-id/Cargo.toml similarity index 96% rename from common/nym-id-lib/Cargo.toml rename to common/nym-id/Cargo.toml index 3114f0eded..eb80073fb7 100644 --- a/common/nym-id-lib/Cargo.toml +++ b/common/nym-id/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "nym-id-lib" +name = "nym-id" version = "0.1.0" authors.workspace = true repository.workspace = true diff --git a/common/nym-id-lib/src/error.rs b/common/nym-id/src/error.rs similarity index 100% rename from common/nym-id-lib/src/error.rs rename to common/nym-id/src/error.rs diff --git a/common/nym-id-lib/src/import_credential.rs b/common/nym-id/src/import_credential.rs similarity index 100% rename from common/nym-id-lib/src/import_credential.rs rename to common/nym-id/src/import_credential.rs diff --git a/common/nym-id-lib/src/lib.rs b/common/nym-id/src/lib.rs similarity index 100% rename from common/nym-id-lib/src/lib.rs rename to common/nym-id/src/lib.rs diff --git a/service-providers/network-requester/Cargo.toml b/service-providers/network-requester/Cargo.toml index 65ca6c2aa3..ac8d641719 100644 --- a/service-providers/network-requester/Cargo.toml +++ b/service-providers/network-requester/Cargo.toml @@ -61,7 +61,7 @@ nym-statistics-common = { path = "../../common/statistics" } nym-task = { path = "../../common/task" } nym-types = { path = "../../common/types" } nym-exit-policy = { path = "../../common/exit-policy", features = ["client"] } -nym-id-lib = { path = "../../common/nym-id-lib" } +nym-id = { path = "../../common/nym-id" } [dev-dependencies] tempfile = "3.5.0" diff --git a/service-providers/network-requester/src/cli/import_credential.rs b/service-providers/network-requester/src/cli/import_credential.rs index 1fe0d3de52..d46b0442bf 100644 --- a/service-providers/network-requester/src/cli/import_credential.rs +++ b/service-providers/network-requester/src/cli/import_credential.rs @@ -5,7 +5,7 @@ use crate::cli::try_load_current_config; use crate::error::NetworkRequesterError; use clap::ArgGroup; -use nym_id_lib::import_credential; +use nym_id::import_credential; use std::fs; use std::path::PathBuf; diff --git a/service-providers/network-requester/src/error.rs b/service-providers/network-requester/src/error.rs index 0143494696..048ca2a5d2 100644 --- a/service-providers/network-requester/src/error.rs +++ b/service-providers/network-requester/src/error.rs @@ -4,7 +4,7 @@ pub use nym_client_core::error::ClientCoreError; use nym_exit_policy::policy::PolicyError; -use nym_id_lib::NymIdError; +use nym_id::NymIdError; use nym_socks5_requests::{RemoteAddress, Socks5RequestError}; use std::net::SocketAddr; diff --git a/tools/nym-id-cli/Cargo.toml b/tools/nym-id-cli/Cargo.toml index c57404397a..bada736bfd 100644 --- a/tools/nym-id-cli/Cargo.toml +++ b/tools/nym-id-cli/Cargo.toml @@ -19,4 +19,4 @@ tracing.workspace = true nym-bin-common = { path = "../../common/bin-common", features = ["output_format", "basic_tracing"] } nym-credential-storage = { path = "../../common/credential-storage" } -nym-id-lib = { path = "../../common/nym-id-lib" } +nym-id = { path = "../../common/nym-id" } diff --git a/tools/nym-id-cli/src/commands/import_credential.rs b/tools/nym-id-cli/src/commands/import_credential.rs index 9422a34e8d..e04bb89af5 100644 --- a/tools/nym-id-cli/src/commands/import_credential.rs +++ b/tools/nym-id-cli/src/commands/import_credential.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use clap::ArgGroup; -use nym_id_lib::import_credential; +use nym_id::import_credential; use std::fs; use std::path::PathBuf; From d3ba008b88131124f458f603a60a8351848cec9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C5=9Fu?= Date: Mon, 4 Mar 2024 12:56:10 +0200 Subject: [PATCH 11/35] Add IPPair constructor (#4440) * Add IPPair constructor * Rename --- common/ip-packet-requests/src/lib.rs | 15 ++++++- common/ip-packet-requests/src/request.rs | 19 ++------- common/ip-packet-requests/src/response.rs | 6 +-- .../ip-packet-router/src/mixnet_listener.rs | 39 +++++++------------ .../ip-packet-router/src/tun_listener.rs | 4 +- .../src/util/generate_new_ip.rs | 17 ++++---- 6 files changed, 45 insertions(+), 55 deletions(-) diff --git a/common/ip-packet-requests/src/lib.rs b/common/ip-packet-requests/src/lib.rs index f61e3f266f..f3de2fb675 100644 --- a/common/ip-packet-requests/src/lib.rs +++ b/common/ip-packet-requests/src/lib.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; +use std::fmt::{Display, Formatter}; use std::net::{Ipv4Addr, Ipv6Addr}; pub mod codec; @@ -10,11 +11,23 @@ pub mod response; pub const CURRENT_VERSION: u8 = 4; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub struct IPPair { +pub struct IpPair { pub ipv4: Ipv4Addr, pub ipv6: Ipv6Addr, } +impl IpPair { + pub fn new(ipv4: Ipv4Addr, ipv6: Ipv6Addr) -> Self { + IpPair { ipv4, ipv6 } + } +} + +impl Display for IpPair { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + writeln!(f, "IPv4: {}, IPV6: {}", self.ipv4, self.ipv6) + } +} + fn make_bincode_serializer() -> impl bincode::Options { use bincode::Options; bincode::DefaultOptions::new() diff --git a/common/ip-packet-requests/src/request.rs b/common/ip-packet-requests/src/request.rs index 011ff5bfe6..9f59b8ba0e 100644 --- a/common/ip-packet-requests/src/request.rs +++ b/common/ip-packet-requests/src/request.rs @@ -1,15 +1,7 @@ -use std::fmt::{Display, Formatter}; - use nym_sphinx::addressing::clients::Recipient; use serde::{Deserialize, Serialize}; -use crate::{make_bincode_serializer, IPPair, CURRENT_VERSION}; - -impl Display for IPPair { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - writeln!(f, "IPv4: {}, IPV6: {}", self.ipv4, self.ipv6) - } -} +use crate::{make_bincode_serializer, IpPair, CURRENT_VERSION}; fn generate_random() -> u64 { use rand::RngCore; @@ -25,7 +17,7 @@ pub struct IpPacketRequest { impl IpPacketRequest { pub fn new_static_connect_request( - ips: IPPair, + ips: IpPair, reply_to: Recipient, reply_to_hops: Option, reply_to_avg_mix_delays: Option, @@ -143,7 +135,7 @@ pub enum IpPacketRequestData { pub struct StaticConnectRequest { pub request_id: u64, - pub ips: IPPair, + pub ips: IpPair, // The nym-address the response should be sent back to pub reply_to: Recipient, @@ -226,10 +218,7 @@ mod tests { data: IpPacketRequestData::StaticConnect( StaticConnectRequest { request_id: 123, - ips: IPPair { - ipv4: Ipv4Addr::from_str("10.0.0.1").unwrap(), - ipv6: Ipv6Addr::from_str("2001:db8:a160::1").unwrap(), - }, + ips: IpPair::new(Ipv4Addr::from_str("10.0.0.1").unwrap(), Ipv6Addr::from_str("2001:db8:a160::1").unwrap()), reply_to: Recipient::try_from_base58_string("D1rrpsysCGCYXy9saP8y3kmNpGtJZUXN9SvFoUcqAsM9.9Ssso1ea5NfkbMASdiseDSjTN1fSWda5SgEVjdSN4CvV@GJqd3ZxpXWSNxTfx7B1pPtswpetH4LnJdFeLeuY5KUuN").unwrap(), reply_to_hops: None, reply_to_avg_mix_delays: None, diff --git a/common/ip-packet-requests/src/response.rs b/common/ip-packet-requests/src/response.rs index 91972a35a3..b07f1a97af 100644 --- a/common/ip-packet-requests/src/response.rs +++ b/common/ip-packet-requests/src/response.rs @@ -1,7 +1,7 @@ use nym_sphinx::addressing::clients::Recipient; use serde::{Deserialize, Serialize}; -use crate::{make_bincode_serializer, IPPair, CURRENT_VERSION}; +use crate::{make_bincode_serializer, IpPair, CURRENT_VERSION}; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct IpPacketResponse { @@ -36,7 +36,7 @@ impl IpPacketResponse { } } - pub fn new_dynamic_connect_success(request_id: u64, reply_to: Recipient, ips: IPPair) -> Self { + pub fn new_dynamic_connect_success(request_id: u64, reply_to: Recipient, ips: IpPair) -> Self { Self { version: CURRENT_VERSION, data: IpPacketResponseData::DynamicConnect(DynamicConnectResponse { @@ -261,7 +261,7 @@ impl DynamicConnectResponseReply { #[derive(Clone, Debug, Serialize, Deserialize)] pub struct DynamicConnectSuccess { - pub ips: IPPair, + pub ips: IpPair, } #[derive(Clone, Debug, Serialize, Deserialize, thiserror::Error)] diff --git a/service-providers/ip-packet-router/src/mixnet_listener.rs b/service-providers/ip-packet-router/src/mixnet_listener.rs index 813c4b2e52..af3c7214f0 100644 --- a/service-providers/ip-packet-router/src/mixnet_listener.rs +++ b/service-providers/ip-packet-router/src/mixnet_listener.rs @@ -11,7 +11,7 @@ use nym_ip_packet_requests::{ DynamicConnectFailureReason, ErrorResponseReply, IpPacketResponse, StaticConnectFailureReason, }, - IPPair, + IpPair, }; use nym_sdk::mixnet::{MixnetMessageSender, Recipient}; use nym_sphinx::receiver::ReconstructedMessage; @@ -58,7 +58,7 @@ impl ConnectedClients { ) } - fn is_ip_connected(&self, ips: &IPPair) -> bool { + fn is_ip_connected(&self, ips: &IpPair) -> bool { self.clients_ipv4_mapping.contains_key(&ips.ipv4) || self.clients_ipv6_mapping.contains_key(&ips.ipv6) } @@ -76,15 +76,12 @@ impl ConnectedClients { .any(|client| client.nym_address == *nym_address) } - fn lookup_ip_from_nym_address(&self, nym_address: &Recipient) -> Option { + fn lookup_ip_from_nym_address(&self, nym_address: &Recipient) -> Option { self.clients_ipv4_mapping .iter() .find_map(|(ipv4, connected_client)| { if connected_client.nym_address == *nym_address { - Some(IPPair { - ipv4: *ipv4, - ipv6: connected_client.ipv6, - }) + Some(IpPair::new(*ipv4, connected_client.ipv6)) } else { None } @@ -105,7 +102,7 @@ impl ConnectedClients { fn connect( &mut self, - ips: IPPair, + ips: IpPair, nym_address: Recipient, mix_hops: Option, forward_from_tun_tx: tokio::sync::mpsc::UnboundedSender>, @@ -141,7 +138,7 @@ impl ConnectedClients { .ok(); } - async fn update_activity(&mut self, ips: &IPPair) -> Result<()> { + async fn update_activity(&mut self, ips: &IpPair) -> Result<()> { if let Some(client) = self.clients_ipv4_mapping.get(&ips.ipv4) { *client.last_activity.write().await = std::time::Instant::now(); Ok(()) @@ -151,16 +148,13 @@ impl ConnectedClients { } // Identify connected client handlers that have stopped without being told to stop - fn get_finished_client_handlers(&mut self) -> Vec<(IPPair, Recipient)> { + fn get_finished_client_handlers(&mut self) -> Vec<(IpPair, Recipient)> { self.clients_ipv4_mapping .iter_mut() .filter_map(|(ip, connected_client)| { if connected_client.handle.is_finished() { Some(( - IPPair { - ipv4: *ip, - ipv6: connected_client.ipv6, - }, + IpPair::new(*ip, connected_client.ipv6), connected_client.nym_address, )) } else { @@ -170,7 +164,7 @@ impl ConnectedClients { .collect() } - async fn get_inactive_clients(&mut self) -> Vec<(IPPair, Recipient)> { + async fn get_inactive_clients(&mut self) -> Vec<(IpPair, Recipient)> { let now = std::time::Instant::now(); let mut ret = vec![]; for (ip, connected_client) in self.clients_ipv4_mapping.iter() { @@ -178,10 +172,7 @@ impl ConnectedClients { > CLIENT_MIXNET_INACTIVITY_TIMEOUT { ret.push(( - IPPair { - ipv4: *ip, - ipv6: connected_client.ipv6, - }, + IpPair::new(*ip, connected_client.ipv6), connected_client.nym_address, )) } @@ -189,7 +180,7 @@ impl ConnectedClients { ret } - fn disconnect_stopped_client_handlers(&mut self, stopped_clients: Vec<(IPPair, Recipient)>) { + fn disconnect_stopped_client_handlers(&mut self, stopped_clients: Vec<(IpPair, Recipient)>) { for (ips, _) in &stopped_clients { log::info!("Disconnect stopped client: {ips}"); self.clients_ipv4_mapping.remove(&ips.ipv4); @@ -203,7 +194,7 @@ impl ConnectedClients { } } - fn disconnect_inactive_clients(&mut self, inactive_clients: Vec<(IPPair, Recipient)>) { + fn disconnect_inactive_clients(&mut self, inactive_clients: Vec<(IpPair, Recipient)>) { for (ips, _) in &inactive_clients { log::info!("Disconnect inactive client: {ips}"); self.clients_ipv4_mapping.remove(&ips.ipv4); @@ -217,7 +208,7 @@ impl ConnectedClients { } } - fn find_new_ip(&self) -> Option { + fn find_new_ip(&self) -> Option { generate_new_ip::find_new_ips(&self.clients_ipv4_mapping, &self.clients_ipv6_mapping) } } @@ -692,9 +683,9 @@ pub(crate) enum ConnectedClientEvent { Connect(Box), } -pub(crate) struct DisconnectEvent(pub(crate) IPPair); +pub(crate) struct DisconnectEvent(pub(crate) IpPair); pub(crate) struct ConnectEvent { - pub(crate) ips: IPPair, + pub(crate) ips: IpPair, pub(crate) forward_from_tun_tx: tokio::sync::mpsc::UnboundedSender>, } diff --git a/service-providers/ip-packet-router/src/tun_listener.rs b/service-providers/ip-packet-router/src/tun_listener.rs index 8d2ba41371..ce3a70ca68 100644 --- a/service-providers/ip-packet-router/src/tun_listener.rs +++ b/service-providers/ip-packet-router/src/tun_listener.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; -use nym_ip_packet_requests::IPPair; +use nym_ip_packet_requests::IpPair; use nym_task::TaskClient; #[cfg(target_os = "linux")] use tokio::io::AsyncReadExt; @@ -17,7 +17,7 @@ use crate::{ // It's even ok if this is slightly out of date pub(crate) struct ConnectedClientMirror { pub(crate) forward_from_tun_tx: tokio::sync::mpsc::UnboundedSender>, - pub(crate) ips: IPPair, + pub(crate) ips: IpPair, } pub(crate) struct ConnectedClientsListener { diff --git a/service-providers/ip-packet-router/src/util/generate_new_ip.rs b/service-providers/ip-packet-router/src/util/generate_new_ip.rs index 8e7a688853..71809cac00 100644 --- a/service-providers/ip-packet-router/src/util/generate_new_ip.rs +++ b/service-providers/ip-packet-router/src/util/generate_new_ip.rs @@ -1,4 +1,4 @@ -use nym_ip_packet_requests::IPPair; +use nym_ip_packet_requests::IpPair; use std::net::Ipv6Addr; use std::{collections::HashMap, net::Ipv4Addr}; @@ -6,20 +6,20 @@ use crate::constants::{TUN_DEVICE_ADDRESS_V4, TUN_DEVICE_ADDRESS_V6}; // Find an available IP address in self.connected_clients // TODO: make this nicer -fn generate_random_ips_within_subnet() -> IPPair { +fn generate_random_ips_within_subnet() -> IpPair { let mut rng = rand::thread_rng(); // Generate a random number in the range 1-254 let last_octet = rand::Rng::gen_range(&mut rng, 1..=254); let ipv4 = Ipv4Addr::new(10, 0, 0, last_octet); let ipv6 = Ipv6Addr::new(0x2001, 0x0db8, 0xa160, 0, 0, 0, 0, last_octet as u16); - IPPair { ipv4, ipv6 } + IpPair::new(ipv4, ipv6) } fn is_ip_taken( connected_clients_ipv4: &HashMap, connected_clients_ipv6: &HashMap, - tun_ips: IPPair, - ips: IPPair, + tun_ips: IpPair, + ips: IpPair, ) -> bool { connected_clients_ipv4.contains_key(&ips.ipv4) || connected_clients_ipv6.contains_key(&ips.ipv6) @@ -31,13 +31,10 @@ fn is_ip_taken( pub(crate) fn find_new_ips( connected_clients_ipv4: &HashMap, connected_clients_ipv6: &HashMap, -) -> Option { +) -> Option { let mut new_ips = generate_random_ips_within_subnet(); let mut tries = 0; - let tun_ips = IPPair { - ipv4: TUN_DEVICE_ADDRESS_V4, - ipv6: TUN_DEVICE_ADDRESS_V6, - }; + let tun_ips = IpPair::new(TUN_DEVICE_ADDRESS_V4, TUN_DEVICE_ADDRESS_V6); while is_ip_taken( connected_clients_ipv4, From 5b35cfcfb2ce7a89f5a7cfac85c5d84d22ed475d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Mon, 4 Mar 2024 11:16:48 +0000 Subject: [PATCH 12/35] build-information: pick up vergen from consuming crate (#4424) --- .../bin-common/src/build_information/mod.rs | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/common/bin-common/src/build_information/mod.rs b/common/bin-common/src/build_information/mod.rs index a29e5ccf29..7b1a9d3321 100644 --- a/common/bin-common/src/build_information/mod.rs +++ b/common/bin-common/src/build_information/mod.rs @@ -69,6 +69,35 @@ impl BinaryBuildInformation { } } + // Varient where we want to use the metadata generated by vergen in the consuming crate. + pub const fn new_with_local_vergen( + binary_name: &'static str, + build_timestamp: &'static str, + build_version: &'static str, + commit_sha: &'static str, + commit_timestamp: &'static str, + commit_branch: &'static str, + ) -> Self { + let cargo_debug = env!("VERGEN_CARGO_DEBUG"); + let cargo_profile = if const_str::equal!(cargo_debug, "true") { + "debug" + } else { + "release" + }; + + BinaryBuildInformation { + binary_name, + build_timestamp, + build_version, + commit_sha, + commit_timestamp, + commit_branch, + rustc_version: env!("VERGEN_RUSTC_SEMVER"), + rustc_channel: env!("VERGEN_RUSTC_CHANNEL"), + cargo_profile, + } + } + pub fn to_owned(&self) -> BinaryBuildInformationOwned { BinaryBuildInformationOwned { binary_name: self.binary_name.to_owned(), @@ -187,3 +216,33 @@ macro_rules! bin_info_owned { .to_owned() }; } + +// variant that picks up the vergen build information generated by the build.rs in the consumer +// crate. +#[macro_export] +macro_rules! bin_info_local_vergen { + () => { + $crate::build_information::BinaryBuildInformation::new_vergen( + env!("CARGO_PKG_NAME"), + env!("VERGEN_BUILD_TIMESTAMP"), + env!("CARGO_PKG_VERSION"), + env!("VERGEN_GIT_SHA"), + env!("VERGEN_GIT_COMMIT_TIMESTAMP"), + env!("VERGEN_GIT_BRANCH"), + ) + }; +} + +#[macro_export] +macro_rules! bin_info_local_vergen_owned { + () => { + $crate::build_information::BinaryBuildInformation::new_vergen( + env!("CARGO_PKG_NAME"), + env!("VERGEN_BUILD_TIMESTAMP"), + env!("CARGO_PKG_VERSION"), + env!("VERGEN_GIT_SHA"), + env!("VERGEN_GIT_COMMIT_TIMESTAMP"), + env!("VERGEN_GIT_BRANCH"), + ) + }; +} From bd0cbbc18a305624a684473385f466cc086cdd5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Mon, 4 Mar 2024 13:48:43 +0000 Subject: [PATCH 13/35] Fix typo in macro invocation (#4441) --- common/bin-common/src/build_information/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/bin-common/src/build_information/mod.rs b/common/bin-common/src/build_information/mod.rs index 7b1a9d3321..90d495c288 100644 --- a/common/bin-common/src/build_information/mod.rs +++ b/common/bin-common/src/build_information/mod.rs @@ -222,7 +222,7 @@ macro_rules! bin_info_owned { #[macro_export] macro_rules! bin_info_local_vergen { () => { - $crate::build_information::BinaryBuildInformation::new_vergen( + $crate::build_information::BinaryBuildInformation::new_with_local_vergen( env!("CARGO_PKG_NAME"), env!("VERGEN_BUILD_TIMESTAMP"), env!("CARGO_PKG_VERSION"), @@ -236,7 +236,7 @@ macro_rules! bin_info_local_vergen { #[macro_export] macro_rules! bin_info_local_vergen_owned { () => { - $crate::build_information::BinaryBuildInformation::new_vergen( + $crate::build_information::BinaryBuildInformation::new_with_local_vergen( env!("CARGO_PKG_NAME"), env!("VERGEN_BUILD_TIMESTAMP"), env!("CARGO_PKG_VERSION"), From 154dfa089b773b777251ba3416311af5105ca952 Mon Sep 17 00:00:00 2001 From: import this <97586125+serinko@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:07:38 +0000 Subject: [PATCH 14/35] [DOC]: Hotfix - remove unexisting page (#4438) * [DOC]: Hotfix - remove unexisting page * update modules and run build * installed with nvm 18 * yarn version solved * remove extra files * attempt to resolve module versioning * Update package versions and fix keplr example --------- Co-authored-by: Mark Sinclair --- .../docs/components/cosmos-kit/index.tsx | 2 +- sdk/typescript/docs/package.json | 21 ++++++++++--------- sdk/typescript/docs/pages/integrations.mdx | 1 - 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk/typescript/docs/components/cosmos-kit/index.tsx b/sdk/typescript/docs/components/cosmos-kit/index.tsx index c7d5abbf56..0f575ec77a 100644 --- a/sdk/typescript/docs/components/cosmos-kit/index.tsx +++ b/sdk/typescript/docs/components/cosmos-kit/index.tsx @@ -1,7 +1,7 @@ import React, { FC } from 'react'; import { ChainProvider, useChain } from '@cosmos-kit/react'; import { assets, chains } from 'chain-registry'; -import { wallets as keplr } from '@cosmos-kit/keplr'; +import { wallets as keplr } from '@cosmos-kit/keplr-extension'; import { wallets as ledger } from '@cosmos-kit/ledger'; import Button from '@mui/material/Button'; import CircularProgress from '@mui/material/CircularProgress'; diff --git a/sdk/typescript/docs/package.json b/sdk/typescript/docs/package.json index f4c99e0a38..4d0bb71c80 100644 --- a/sdk/typescript/docs/package.json +++ b/sdk/typescript/docs/package.json @@ -12,16 +12,17 @@ "start": "next start" }, "dependencies": { - "@cosmjs/amino": "^0.31.1", + "@cosmjs/amino": "^0.32.2", "@cosmjs/cosmwasm-launchpad": "^0.25.6", - "@cosmjs/cosmwasm-stargate": "^0.31.1", - "@cosmjs/encoding": "^0.31.1", - "@cosmjs/proto-signing": "^0.31.1", - "@cosmjs/stargate": "^0.31.0", - "@cosmos-kit/core": "^2.6.2", - "@cosmos-kit/keplr": "^2.3.9", - "@cosmos-kit/ledger": "^2.4.3", - "@cosmos-kit/react": "^2.8.0", + "@cosmjs/cosmwasm-stargate": "^0.32.2", + "@cosmjs/encoding": "^0.32.2", + "@cosmjs/proto-signing": "^0.32.2", + "@cosmjs/stargate": "^0.32.2", + "@cosmos-kit/core": "^2.8.9", + "@cosmos-kit/keplr": "^2.6.9", + "@cosmos-kit/keplr-extension": "^2.7.9", + "@cosmos-kit/ledger": "^2.6.9", + "@cosmos-kit/react": "^2.10.11", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@interchain-ui/react": "^1.8.0", @@ -32,7 +33,7 @@ "@nymproject/mix-fetch-full-fat": ">=1.2.4-rc.2 || ^1", "@nymproject/sdk-full-fat": ">=1.2.4-rc.2 || ^1", "chain-registry": "^1.19.0", - "cosmjs-types": "^0.8.0", + "cosmjs-types": "^0.9.0", "next": "^13.4.19", "nextra": "latest", "nextra-theme-docs": "latest", diff --git a/sdk/typescript/docs/pages/integrations.mdx b/sdk/typescript/docs/pages/integrations.mdx index d22fdccf25..50b1522002 100644 --- a/sdk/typescript/docs/pages/integrations.mdx +++ b/sdk/typescript/docs/pages/integrations.mdx @@ -32,7 +32,6 @@ If you're unsure where to start, the following set of questions should help you ### Use one of our standalone Nym clients If you've answered 'No' to all of the above, you may need to use one of our [standalone clients](https://nymtech.net/docs/clients/overview.html). All Nym client packages present basically the same capabilities to the privacy application developer. They need to run as a persistent process in order to stay connected and ready to receive any incoming messages from their gateway nodes. They register and authenticate to gateways, and construct Sphinx packets. While setting up those, and depending on your usecase, you may need to set-up and run a Service Provider. Read below the "How to deal with Service Providers" section for more details. - You can find more information about the different standalone clients and the ways to interact with them [in this page](https://nymtech.net/developers/integrations/mixnet-integration.html). From 3bda5f59a3c98f35fe84b64bf26a62690686b97e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 07:58:31 +0100 Subject: [PATCH 15/35] Bump ip from 2.0.0 to 2.0.1 (#4417) Bumps [ip](https://github.com/indutny/node-ip) from 2.0.0 to 2.0.1. - [Commits](https://github.com/indutny/node-ip/compare/v2.0.0...v2.0.1) --- updated-dependencies: - dependency-name: ip dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a711579c53..3ab8f0a0d7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11174,9 +11174,9 @@ interpret@^2.2.0: integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== ip@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.0.tgz#4cf4ab182fee2314c75ede1276f8c80b479936da" - integrity sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ== + version "2.0.1" + resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.1.tgz#e8f3595d33a3ea66490204234b77636965307105" + integrity sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ== ipaddr.js@1.9.1: version "1.9.1" From 9e5890a0d783df9763a8993d62d9a4137e21eaaa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 08:15:03 +0100 Subject: [PATCH 16/35] Bump ip in /clients/native/examples/js-examples/websocket (#4421) Bumps [ip](https://github.com/indutny/node-ip) from 1.1.5 to 1.1.9. - [Commits](https://github.com/indutny/node-ip/compare/v1.1.5...v1.1.9) --- updated-dependencies: - dependency-name: ip dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../examples/js-examples/websocket/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/clients/native/examples/js-examples/websocket/package-lock.json b/clients/native/examples/js-examples/websocket/package-lock.json index 97239acad7..99ca088e7e 100644 --- a/clients/native/examples/js-examples/websocket/package-lock.json +++ b/clients/native/examples/js-examples/websocket/package-lock.json @@ -2160,9 +2160,9 @@ } }, "node_modules/ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz", + "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==", "dev": true }, "node_modules/ipaddr.js": { @@ -6157,9 +6157,9 @@ "dev": true }, "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz", + "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==", "dev": true }, "ipaddr.js": { From 67b893175fc85d2e16097fcec8fbd0bfd2d1a78b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 14:19:51 +0100 Subject: [PATCH 17/35] Bump ip in /sdk/typescript/tests/integration-tests/mix-fetch (#4420) Bumps [ip](https://github.com/indutny/node-ip) from 1.1.8 to 1.1.9. - [Commits](https://github.com/indutny/node-ip/compare/v1.1.8...v1.1.9) --- updated-dependencies: - dependency-name: ip dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: benedettadavico --- .../integration-tests/mix-fetch/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/typescript/tests/integration-tests/mix-fetch/package-lock.json b/sdk/typescript/tests/integration-tests/mix-fetch/package-lock.json index 8659d27038..fcf414162d 100644 --- a/sdk/typescript/tests/integration-tests/mix-fetch/package-lock.json +++ b/sdk/typescript/tests/integration-tests/mix-fetch/package-lock.json @@ -600,9 +600,9 @@ } }, "node_modules/ip": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", - "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz", + "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==" }, "node_modules/is-arrayish": { "version": "0.2.1", @@ -976,9 +976,9 @@ } }, "node_modules/socks/node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", + "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==" }, "node_modules/source-map": { "version": "0.6.1", From b94c81a78484da11cb99e84ed9a555e88cdf4957 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 14:48:56 +0100 Subject: [PATCH 18/35] Bump ip from 2.0.0 to 2.0.1 in /wasm/client/internal-dev-node (#4418) Bumps [ip](https://github.com/indutny/node-ip) from 2.0.0 to 2.0.1. - [Commits](https://github.com/indutny/node-ip/compare/v2.0.0...v2.0.1) --- updated-dependencies: - dependency-name: ip dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: benedettadavico --- wasm/client/internal-dev-node/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wasm/client/internal-dev-node/yarn.lock b/wasm/client/internal-dev-node/yarn.lock index 3932b9c4b2..35968ffdf7 100644 --- a/wasm/client/internal-dev-node/yarn.lock +++ b/wasm/client/internal-dev-node/yarn.lock @@ -376,9 +376,9 @@ inherits@2, inherits@^2.0.3: integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== ip@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.0.tgz#4cf4ab182fee2314c75ede1276f8c80b479936da" - integrity sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ== + version "2.0.1" + resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.1.tgz#e8f3595d33a3ea66490204234b77636965307105" + integrity sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ== is-fullwidth-code-point@^3.0.0: version "3.0.0" From fbba59f0014d9be76a290337827cda7e02cd0b75 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 14:49:27 +0100 Subject: [PATCH 19/35] Bump ip from 2.0.0 to 2.0.1 in /wasm/mix-fetch/internal-dev-node (#4419) Bumps [ip](https://github.com/indutny/node-ip) from 2.0.0 to 2.0.1. - [Commits](https://github.com/indutny/node-ip/compare/v2.0.0...v2.0.1) --- updated-dependencies: - dependency-name: ip dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: benedettadavico --- wasm/mix-fetch/internal-dev-node/package-lock.json | 10 ++++------ wasm/mix-fetch/internal-dev-node/yarn.lock | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/wasm/mix-fetch/internal-dev-node/package-lock.json b/wasm/mix-fetch/internal-dev-node/package-lock.json index 51943d47e5..9ede843aa0 100644 --- a/wasm/mix-fetch/internal-dev-node/package-lock.json +++ b/wasm/mix-fetch/internal-dev-node/package-lock.json @@ -17,8 +17,7 @@ }, "../../../dist/node/wasm/mix-fetch": { "name": "@nymproject/mix-fetch-wasm", - "version": "1.2.0-rc.2", - "license": "Apache-2.0" + "version": "1.2.0-rc.2" }, "node_modules/@gar/promisify": { "version": "1.1.3", @@ -643,10 +642,9 @@ "license": "ISC" }, "node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", - "license": "MIT", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", + "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==", "optional": true }, "node_modules/is-fullwidth-code-point": { diff --git a/wasm/mix-fetch/internal-dev-node/yarn.lock b/wasm/mix-fetch/internal-dev-node/yarn.lock index a89db430e7..c15faf4ccc 100644 --- a/wasm/mix-fetch/internal-dev-node/yarn.lock +++ b/wasm/mix-fetch/internal-dev-node/yarn.lock @@ -396,9 +396,9 @@ inherits@2, inherits@^2.0.3: integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== ip@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz" - integrity sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ== + version "2.0.1" + resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.1.tgz#e8f3595d33a3ea66490204234b77636965307105" + integrity sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ== is-fullwidth-code-point@^3.0.0: version "3.0.0" From 846fd6aeaadd9bab14c04030a57aeec31fe8d94d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 14:50:44 +0100 Subject: [PATCH 20/35] Bump mio from 0.8.10 to 0.8.11 in /sdk/ffi/cpp (#4443) Bumps [mio](https://github.com/tokio-rs/mio) from 0.8.10 to 0.8.11. - [Release notes](https://github.com/tokio-rs/mio/releases) - [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/mio/compare/v0.8.10...v0.8.11) --- updated-dependencies: - dependency-name: mio dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- sdk/ffi/cpp/Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/ffi/cpp/Cargo.lock b/sdk/ffi/cpp/Cargo.lock index 7222de08de..e7174a3505 100644 --- a/sdk/ffi/cpp/Cargo.lock +++ b/sdk/ffi/cpp/Cargo.lock @@ -2300,9 +2300,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", From df1b648fa07ac30af7664ac928e95347b41aeff9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 15:05:34 +0100 Subject: [PATCH 21/35] Bump es5-ext in /sdk/typescript/packages/mix-fetch-node (#4433) Bumps [es5-ext](https://github.com/medikoo/es5-ext) from 0.10.62 to 0.10.64. - [Release notes](https://github.com/medikoo/es5-ext/releases) - [Changelog](https://github.com/medikoo/es5-ext/blob/main/CHANGELOG.md) - [Commits](https://github.com/medikoo/es5-ext/compare/v0.10.62...v0.10.64) --- updated-dependencies: - dependency-name: es5-ext dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: benedettadavico --- .../packages/mix-fetch-node/yarn.lock | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/sdk/typescript/packages/mix-fetch-node/yarn.lock b/sdk/typescript/packages/mix-fetch-node/yarn.lock index e0bdcadf88..f104bf5210 100644 --- a/sdk/typescript/packages/mix-fetch-node/yarn.lock +++ b/sdk/typescript/packages/mix-fetch-node/yarn.lock @@ -621,10 +621,10 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@nymproject/mix-fetch-wasm-node@>=1.2.0-rc.10 || ^1": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@nymproject/mix-fetch-wasm-node/-/mix-fetch-wasm-node-1.2.0.tgz#76439db4eb5fd4b95dcf6b6883cb5a059aeb5ad2" - integrity sha512-vdEO4WfY1ql+DXIMR4nHvIlTB9tzhALiVjzbbf7UBgrQLxPSFTD2oGwGOVfgpNvXv0F92rDj3AHRommKKGa5pw== +"@nymproject/mix-fetch-wasm-node@>=1.2.4-rc.2 || ^1": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@nymproject/mix-fetch-wasm-node/-/mix-fetch-wasm-node-1.2.3.tgz#f600df714782e6eb691faa14683e44c2507a8e53" + integrity sha512-J9mj52WSpsGpuCeW65zEj8RWJ3GvWG0VqVWIDD6w1RK4SesXiGb7ghD7F1rChRMlSbl9rP9reYkmAHz63Sb6Cw== "@rollup/plugin-commonjs@^24.0.1": version "24.1.0" @@ -1648,13 +1648,14 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: - version "0.10.62" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" - integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@^0.10.62, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: + version "0.10.64" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714" + integrity sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg== dependencies: es6-iterator "^2.0.3" es6-symbol "^3.1.3" + esniff "^2.0.1" next-tick "^1.1.0" es6-iterator@^2.0.3: @@ -1887,6 +1888,16 @@ eslint@^8.10.0: strip-ansi "^6.0.1" text-table "^0.2.0" +esniff@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/esniff/-/esniff-2.0.1.tgz#a4d4b43a5c71c7ec51c51098c1d8a29081f9b308" + integrity sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg== + dependencies: + d "^1.0.1" + es5-ext "^0.10.62" + event-emitter "^0.3.5" + type "^2.7.2" + espree@^9.6.0, espree@^9.6.1: version "9.6.1" resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" From bc19fa7a788e21e612373e803f5ce5296dba9563 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 15:11:32 +0100 Subject: [PATCH 22/35] Bump es5-ext in /sdk/typescript/packages/nodejs-client (#4434) Bumps [es5-ext](https://github.com/medikoo/es5-ext) from 0.10.62 to 0.10.64. - [Release notes](https://github.com/medikoo/es5-ext/releases) - [Changelog](https://github.com/medikoo/es5-ext/blob/main/CHANGELOG.md) - [Commits](https://github.com/medikoo/es5-ext/compare/v0.10.62...v0.10.64) --- updated-dependencies: - dependency-name: es5-ext dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: benedettadavico --- .../packages/nodejs-client/yarn.lock | 153 ++++-------------- 1 file changed, 35 insertions(+), 118 deletions(-) diff --git a/sdk/typescript/packages/nodejs-client/yarn.lock b/sdk/typescript/packages/nodejs-client/yarn.lock index 943e1eb3de..cbfb0e71ed 100644 --- a/sdk/typescript/packages/nodejs-client/yarn.lock +++ b/sdk/typescript/packages/nodejs-client/yarn.lock @@ -65,46 +65,11 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@jridgewell/gen-mapping@^0.3.0": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" - integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== - dependencies: - "@jridgewell/set-array" "^1.0.1" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/resolve-uri@^3.1.0": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" - integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== - -"@jridgewell/set-array@^1.0.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" - integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== - -"@jridgewell/source-map@^0.3.3": - version "0.3.5" - resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.5.tgz#a3bb4d5c6825aab0d281268f47f6ad5853431e91" - integrity sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ== - dependencies: - "@jridgewell/gen-mapping" "^0.3.0" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15": +"@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.15": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== -"@jridgewell/trace-mapping@^0.3.9": - version "0.3.19" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz#f8a3249862f91be48d3127c3cfe992f79b4b8811" - integrity sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw== - dependencies: - "@jridgewell/resolve-uri" "^3.1.0" - "@jridgewell/sourcemap-codec" "^1.4.14" - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -126,10 +91,10 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@nymproject/nym-client-wasm-node@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@nymproject/nym-client-wasm-node/-/nym-client-wasm-node-1.2.0.tgz#46abe6b7535e80107d837bc6cc47edc1734aa773" - integrity sha512-L2hvMuudTQJgS/ZGGCSCD2oroccf7jWYXrq/E0Qqu0IxLlyjnTJ1xWWwXzUuwzBs+V5YZb0VIdB0kAovGLA+VA== +"@nymproject/nym-client-wasm-node@>=1.2.4-rc.2 || ^1": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@nymproject/nym-client-wasm-node/-/nym-client-wasm-node-1.2.3.tgz#e75e234714494fafffb86115cdee6759dcede366" + integrity sha512-fUGld4MJOgnvyqk5/KIpFePIXn8Nsl/7T/jh9a9WdTWntECnnJ/DBqoO+6NzDkyXaLYhByqR7reO8ZApNR0YCw== "@rollup/plugin-commonjs@^24.0.1": version "24.1.0" @@ -143,14 +108,12 @@ is-reference "1.2.1" magic-string "^0.27.0" -"@rollup/plugin-inject@^5.0.3": - version "5.0.5" - resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-5.0.5.tgz#616f3a73fe075765f91c5bec90176608bed277a3" - integrity sha512-2+DEJbNBoPROPkgTDNe8/1YXWcqxbN5DTjASVIOx8HS+pITXushyNiBV56RB08zuptzz8gT3YfkqriTBVycepg== +"@rollup/plugin-json@^6.0.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-6.1.0.tgz#fbe784e29682e9bb6dee28ea75a1a83702e7b805" + integrity sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA== dependencies: - "@rollup/pluginutils" "^5.0.1" - estree-walker "^2.0.2" - magic-string "^0.30.3" + "@rollup/pluginutils" "^5.1.0" "@rollup/plugin-node-resolve@^15.0.1": version "15.2.3" @@ -172,15 +135,6 @@ "@rollup/pluginutils" "^5.0.1" magic-string "^0.30.3" -"@rollup/plugin-terser@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@rollup/plugin-terser/-/plugin-terser-0.2.1.tgz#dcf0b163216dafb64611b170a7667e76a7f03d2b" - integrity sha512-hV52c8Oo6/cXZZxVVoRNBb4zh+EKSHS4I1sedWV5pf0O+hTLSkrf6w86/V0AZutYtwBguB6HLKwz89WDBfwGOA== - dependencies: - serialize-javascript "^6.0.0" - smob "^0.0.6" - terser "^5.15.1" - "@rollup/plugin-typescript@^10.0.1": version "10.0.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-10.0.1.tgz#270b515b116ea28320e6bb62451c4767d49072d6" @@ -223,6 +177,15 @@ estree-walker "^2.0.2" picomatch "^2.3.1" +"@rollup/pluginutils@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0" + integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g== + dependencies: + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^2.3.1" + "@types/estree@*", "@types/estree@^1.0.0": version "1.0.2" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.2.tgz#ff02bc3dc8317cd668dfec247b750ba1f1d62453" @@ -352,7 +315,7 @@ acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn@^8.8.2, acorn@^8.9.0: +acorn@^8.9.0: version "8.10.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== @@ -549,11 +512,6 @@ braces@^3.0.2, braces@~3.0.2: dependencies: fill-range "^7.0.1" -buffer-from@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" - integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== - builtin-modules@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" @@ -623,11 +581,6 @@ comlink@^4.3.1: resolved "https://registry.yarnpkg.com/comlink/-/comlink-4.4.1.tgz#e568b8e86410b809e8600eb2cf40c189371ef981" integrity sha512-+1dlx0aY5Jo1vHy/tSsIGpSkN4tS9rZSW8FIhG0JH/crs9wwweswIo/POr451r7bZww3hFbPAKnTpimzL/mm4Q== -commander@^2.20.0: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - commander@~9.4.0: version "9.4.1" resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd" @@ -880,13 +833,14 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: - version "0.10.62" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" - integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@^0.10.62, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: + version "0.10.64" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714" + integrity sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg== dependencies: es6-iterator "^2.0.3" es6-symbol "^3.1.3" + esniff "^2.0.1" next-tick "^1.1.0" es6-iterator@^2.0.3: @@ -1131,6 +1085,16 @@ eslint@^8.10.0: strip-ansi "^6.0.1" text-table "^0.2.0" +esniff@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/esniff/-/esniff-2.0.1.tgz#a4d4b43a5c71c7ec51c51098c1d8a29081f9b308" + integrity sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg== + dependencies: + d "^1.0.1" + es5-ext "^0.10.62" + event-emitter "^0.3.5" + type "^2.7.2" + espree@^9.6.0, espree@^9.6.1: version "9.6.1" resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" @@ -2243,13 +2207,6 @@ queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -randombytes@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - range-parser@~1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" @@ -2400,11 +2357,6 @@ safe-array-concat@^1.0.1: has-symbols "^1.0.3" isarray "^2.0.5" -safe-buffer@^5.1.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - safe-regex-test@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295" @@ -2445,13 +2397,6 @@ send@0.18.0: range-parser "~1.2.1" statuses "2.0.1" -serialize-javascript@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.1.tgz#b206efb27c3da0b0ab6b52f48d170b7996458e5c" - integrity sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w== - dependencies: - randombytes "^2.1.0" - serve-static@~1.15.0: version "1.15.0" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" @@ -2519,24 +2464,6 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -smob@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/smob/-/smob-0.0.6.tgz#09b268fea916158a2781c152044c6155adbb8aa1" - integrity sha512-V21+XeNni+tTyiST1MHsa84AQhT1aFZipzPpOFAVB8DkHzwJyjjAmt9bgwnuZiZWnIbMo2duE29wybxv/7HWUw== - -source-map-support@~0.5.20: - version "0.5.21" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - source-map@^0.7.4: version "0.7.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" @@ -2640,16 +2567,6 @@ tapable@^2.2.0: resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== -terser@^5.15.1: - version "5.22.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.22.0.tgz#4f18103f84c5c9437aafb7a14918273310a8a49d" - integrity sha512-hHZVLgRA2z4NWcN6aS5rQDc+7Dcy58HOf2zbYwmFcQ+ua3h6eEFf5lIDKTzbWwlazPyOZsFQO8V80/IjVNExEw== - dependencies: - "@jridgewell/source-map" "^0.3.3" - acorn "^8.8.2" - commander "^2.20.0" - source-map-support "~0.5.20" - text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" From fa8e81d9dd1e93e133c666ef777757edd7fdce25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Wed, 6 Mar 2024 17:26:51 +0100 Subject: [PATCH 23/35] Re-export Location type in explorer-client (#4445) --- explorer-api/explorer-client/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/explorer-api/explorer-client/src/lib.rs b/explorer-api/explorer-client/src/lib.rs index 6a8790bd34..3ff4807b2b 100644 --- a/explorer-api/explorer-client/src/lib.rs +++ b/explorer-api/explorer-client/src/lib.rs @@ -6,7 +6,9 @@ use thiserror::Error; use url::Url; // Re-export request types -pub use nym_explorer_api_requests::{PrettyDetailedGatewayBond, PrettyDetailedMixNodeBond}; +pub use nym_explorer_api_requests::{ + Location, PrettyDetailedGatewayBond, PrettyDetailedMixNodeBond, +}; // Paths const API_VERSION: &str = "v1"; From aa5691447df6606de208da811dbd8dfc3da2b8a3 Mon Sep 17 00:00:00 2001 From: serinko <97586125+serinko@users.noreply.github.com> Date: Thu, 7 Mar 2024 13:00:46 +0100 Subject: [PATCH 24/35] update version, new script and simplify releases var --- documentation/dev-portal/book.toml | 2 +- .../dev-portal/src/nymvpn/cli-linux.md | 4 +- .../dev-portal/src/nymvpn/cli-mac.md | 4 +- documentation/dev-portal/src/nymvpn/cli.md | 16 +---- .../dev-portal/src/nymvpn/gui-linux.md | 15 +++-- .../dev-portal/src/nymvpn/gui-mac.md | 4 +- documentation/dev-portal/src/nymvpn/gui.md | 13 ++-- .../dev-portal/src/nymvpn/old-gui-mac.md | 61 ------------------- .../dev-portal/src/nymvpn/testing.md | 2 +- 9 files changed, 26 insertions(+), 95 deletions(-) delete mode 100644 documentation/dev-portal/src/nymvpn/old-gui-mac.md diff --git a/documentation/dev-portal/book.toml b/documentation/dev-portal/book.toml index 3b6b9f077d..5e6c22b0a0 100644 --- a/documentation/dev-portal/book.toml +++ b/documentation/dev-portal/book.toml @@ -31,7 +31,7 @@ assets_version = "3.0.0" # do not edit: managed by `mdbook-admonish install` minimum_rust_version = "1.66" wallet_release_version = "1.2.8" # nym-vpn related variables -nym_vpn_latest_binary_url = "https://github.com/nymtech/nym/releases/tag/nym-vpn-alpha-0.0.4" +nym_vpn_releases = "https://github.com/nymtech/nym-vpn-client/releases" nym_vpn_form_url = "https://opnform.com/forms/nymvpn-user-research-at-37c3-yccqko-2" [preprocessor.last-changed] diff --git a/documentation/dev-portal/src/nymvpn/cli-linux.md b/documentation/dev-portal/src/nymvpn/cli-linux.md index eb08043535..92f129f5e3 100644 --- a/documentation/dev-portal/src/nymvpn/cli-linux.md +++ b/documentation/dev-portal/src/nymvpn/cli-linux.md @@ -8,8 +8,8 @@ NymVPN is an experimental software and it's for [testing](./testing.md) purposes > Any syntax in `<>` brackets is a user's/version unique variable. Exchange with a corresponding name without the `<>` brackets. -1. Open Github [releases page]({{nym_vpn_latest_binary_url}}) and download the binary for Debian based Linux -2. Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_latest_binary_url}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: +1. Open Github [releases page]({{nym_vpn_releases}}) and download the binary for Debian based Linux +2. Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_releasesl}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: ```sh echo "" | shasum -a 256 -c diff --git a/documentation/dev-portal/src/nymvpn/cli-mac.md b/documentation/dev-portal/src/nymvpn/cli-mac.md index a4093168db..85b65cd551 100644 --- a/documentation/dev-portal/src/nymvpn/cli-mac.md +++ b/documentation/dev-portal/src/nymvpn/cli-mac.md @@ -8,8 +8,8 @@ NymVPN is an experimental software and it's for [testing](./testing.md) purposes > Any syntax in `<>` brackets is a user's/version unique variable. Exchange with a corresponding name without the `<>` brackets. -1. Open Github [releases page]({{nym_vpn_latest_binary_url}}) and download the binary for MacOS -2. Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_latest_binary_url}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: +1. Open Github [releases page]({{nym_vpn_releases}}) and download the binary for MacOS +2. Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_releasesl}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: ```sh echo "" | shasum -a 256 -c diff --git a/documentation/dev-portal/src/nymvpn/cli.md b/documentation/dev-portal/src/nymvpn/cli.md index ea0a7f0e9a..2c2ae285a7 100644 --- a/documentation/dev-portal/src/nymvpn/cli.md +++ b/documentation/dev-portal/src/nymvpn/cli.md @@ -16,22 +16,12 @@ We wrote a [script](https://gist.github.com/serinko/d65450653d6bbafacbcee71c9cb8 1. Open a terminal window in a directory where you want the script and NymVPN CLI binary be downloaded and run ```sh -curl -o execute-nym-vpn-cli-binary.sh -L https://gist.githubusercontent.com/serinko/d65450653d6bbafacbcee71c9cb8fb31/raw/0cbcdd18f7ee94f559692b936061248ebbbf2773/execute-nym-vpn-cli-binary.sh +curl -o execute-nym-vpn-cli-binary.sh -L https://gist.githubusercontent.com/serinko/d65450653d6bbafacbcee71c9cb8fb31/raw/0cbcdd18f7ee94f559692b936061248ebbbf2773/execute-nym-vpn-cli-binary.sh && chmod u+x execute-nym-vpn-cli-binary.sh && sudo -E ./execute-nym-vpn-cli-binary.sh ``` -2. Make the script executable -```sh -chmod u+x execute-nym-vpn-cli-binary.sh -``` +2. Follow the prompts in the program -3. Start the script, turn off any VPN and run -```sh -sudo -E ./execute-nym-vpn-cli-binary.sh -``` - -4. Follow the prompts in the program - -5. The script will automatically start the client. Make sure to **turn off any other VPNs** and follow the prompts: +3. The script will automatically start the client. Make sure to **turn off any other VPNs** and follow the prompts: * It prints a JSON view of existing Gateways and prompt you to: - *Make sure to use two different Gateways for entry and exit!* diff --git a/documentation/dev-portal/src/nymvpn/gui-linux.md b/documentation/dev-portal/src/nymvpn/gui-linux.md index 713142c2eb..794b22904f 100644 --- a/documentation/dev-portal/src/nymvpn/gui-linux.md +++ b/documentation/dev-portal/src/nymvpn/gui-linux.md @@ -12,8 +12,8 @@ NymVPN is an experimental software and it's for [testing](./testing.md) purposes ### Installation -1. Open Github [releases page]({{nym_vpn_latest_binary_url}}) and download the binary for Debian based Linux -2. Required (if you don't want to check shasum, skip this point): Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_latest_binary_url}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: +1. Open Github [releases page]({{nym_vpn_releases}}) and download the binary for Debian based Linux +2. Required (if you don't want to check shasum, skip this point): Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_releases}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: ```sh echo "" | shasum -a 256 -c @@ -30,15 +30,14 @@ tar -xvf 4. If you prefer to run `.AppImage` make executable by running: ```sh # make sure you cd into the right sub-directory after extraction -chmod u+x ./appimage/nym-vpn_0.0.4_amd64.AppImage +chmod u+x ./nym-vpn_0.0.5-dev_amd64.AppImage ``` 5. If you prefer to use the `.deb` version for installation (works on Debian based Linux only), open terminal in the same directory and run: ```sh -cd deb - -sudo dpkg -i ./nym-vpn_0.0.4_amd64.deb +# make sure you cd into the right sub-directory after extraction +sudo dpkg -i ./nym-vpn_0.0.5-dev_amd64.deb # or -sudo apt-get install -f ./nym-vpn_0.0.4_amd64.deb +sudo apt-get install -f ./nym-vpn-dev_0.0.5_amd64.deb ``` NymVPN alpha version runs over Nym testnet (called sandbox), a little extra configuration is needed for the application to work. @@ -72,7 +71,7 @@ Open terminal and run: ```sh # .AppImage must be run from the same directory as the binary -sudo -E ./nym-vpn_0.0.4_amd64.AppImage +sudo -E ./nym-vpn-dev_0.0.5_amd64.AppImage # .deb installation shall be executable from anywhere as sudo -E nym-vpn diff --git a/documentation/dev-portal/src/nymvpn/gui-mac.md b/documentation/dev-portal/src/nymvpn/gui-mac.md index 336a0cede2..854e5dcaf8 100644 --- a/documentation/dev-portal/src/nymvpn/gui-mac.md +++ b/documentation/dev-portal/src/nymvpn/gui-mac.md @@ -17,9 +17,9 @@ mkdir -p "$HOME/nym-vpn-latest" ``` --> -1. Open Github [releases page]({{nym_vpn_latest_binary_url}}) and download the binary for your version of MacOS +1. Open Github [releases page]({{nym_vpn_releases}}) and download the binary for your version of MacOS -2. Recommended (skip this point if you don't want to verify): Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_latest_binary_url}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: +2. Recommended (skip this point if you don't want to verify): Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_releases}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: ```sh echo "" | shasum -a 256 -c diff --git a/documentation/dev-portal/src/nymvpn/gui.md b/documentation/dev-portal/src/nymvpn/gui.md index 779ddab4dd..dc12e610b5 100644 --- a/documentation/dev-portal/src/nymvpn/gui.md +++ b/documentation/dev-portal/src/nymvpn/gui.md @@ -10,23 +10,26 @@ This is the alpha version of NymVPN desktop application (GUI). A demo of how the Follow the simple [automated script](#automated-script-for-gui-installation) below to install and run NymVPN GUI. If the script didn't work for your distribution or you prefer to do a manual setup follow the steps in the guide for [Linux](gui-linux.md) or [MacOS](gui-mac.md) . -Visit NymVPN alpha latest [release page]({{nym_vpn_latest_binary_url}}) to check sha sums or download the binaries directly. +Visit NymVPN alpha latest [release page]({{nym_vpn_releases}}) to check sha sums or download the binaries directly. ## Automated Script for GUI Installation -We wrote a [script](https://gist.github.com/serinko/e0a9f7ff3d79e974ec6f6783caa1137e) which does download of dependencies and the application, sha256 verification, extraction, installation and configuration for Linux and MacOS users automatically. Turn off all VPNs and follow the steps below. +We wrote a [script](https://gist.github.com/tommyv1987/7d210d4daa8f7abc61f9a696d0321f19) which does download of dependencies and the application, sha256 verification, extraction, installation and configuration for Linux and MacOS users automatically. Turn off all VPNs and follow the steps below. 1. Open a terminal window in a directory where you want the script to be downloaded and run ```sh -curl -o nym-vpn-desktop-install-run.sh -L https://gist.githubusercontent.com/serinko/e0a9f7ff3d79e974ec6f6783caa1137e/raw/227c8c348a1e58f68cb500e4504b22412177c680/nym-vpn-desktop-install-run.sh && chmod u+x nym-vpn-desktop-install-run.sh && sudo -E ./nym-vpn-desktop-install-run.sh +curl -o nym-vpn-desktop-install-run.sh -L https://gist.githubusercontent.com/tommyv1987/7d210d4daa8f7abc61f9a696d0321f19/raw/8e673170da309996b31de2cfcd3a65bd4d7c158f/nym-vpn-client-install-run.sh && chmod u+x nym-vpn-desktop-install-run.sh && sudo -E ./nym-vpn-desktop-install-run.sh ``` 2. Follow the prompts in the program To start the application again, reconnect your wifi and run ```sh -# Linux -sudo -E ~/nym-vpn-latest/nym-vpn_0.0.4_amd64.AppImage +# Linux .AppImage +sudo -E ~/nym-vpn-latest/nym-vpn-desktop_0.0.5-dev_ubuntu-22.04_x86_64/nym-vpn_0.0.5_amd64.AppImage + +# Linux .deb +sudo -E nym-vpn # MacOS sudo -E $HOME/nym-vpn-latest/nym-vpn diff --git a/documentation/dev-portal/src/nymvpn/old-gui-mac.md b/documentation/dev-portal/src/nymvpn/old-gui-mac.md deleted file mode 100644 index ba74a23f41..0000000000 --- a/documentation/dev-portal/src/nymvpn/old-gui-mac.md +++ /dev/null @@ -1,61 +0,0 @@ -# NymVPN alpha - Desktop: Guide for Mac OS - -```admonish info -NymVPN is an experimental software and it's for [testing](./testing.md) purposes only. All users testing the client are expected to sign GDPR Information Sheet and Consent Form (shared at the workshop) so we use their results to improve the client, and submit the form [*NymVPN User research*]({{nym_vpn_form_url}}) with the testing results. -``` - -## Preparation - -> Any syntax in `<>` brackets is a user's/version unique variable. Exchange with a corresponding name without the `<>` brackets. - -### Installation - -1. Create a directory `~/nym-vpn-latest` -```sh -mkdir -p "$HOME/nym-vpn-latest" -``` -2. Open Github [releases page]({{nym_vpn_latest_binary_url}}) and download the binary for MacOS -3. Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_latest_binary_url}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: -```sh -echo "" | shasum -a 256 -c - -# choose a correct one according to your binary, this is just an example -# echo "da4c0bf8e8b52658312d341fa3581954cfcb6efd516d9a448c76d042a454b5df nym-vpn-desktop_0.0.3_macos_x86_64.zip" | shasum -a 256 -c -``` -4. Extract files: -```sh -tar -xvf -# for example -# tar -xvf nym-vpn-desktop_0.0.4_macos_aarch64.tar.gz -``` -5. Move to the application directory and make executable -```sh -cd "macos/nym-vpn.app/Contents/MacOS" - -chmod u+x nym-vpn -``` -6. Move `nym-vpn` to your `~/nym-vpn-latest` directory -```sh -mv nym-vpn "$HOME/nym-vpn-latest" -``` - -### Configuration - -7. Create the configuration file by opening a text editor and saving the lines below as `config.toml` in the same directory `~/nym-vpn-latest` -```toml -env_config_file = ".env" -``` -8. Create testnet configuration file by saving [this](https://raw.githubusercontent.com/nymtech/nym/develop/envs/sandbox.env) as `.env` in the same directory `~/nym-vpn-latest` -```sh -curl -L "https://raw.githubusercontent.com/nymtech/nym/develop/envs/sandbox.env" -o "$HOME/nym-vpn-latest/.env" -``` -## Run NymVPN - -**For NymVPN to work, all other VPNs must be switched off!** At this alpha stage of NymVPN, the network connection (wifi) must be reconnected after or in between the testing rounds. - -Run: -```sh -sudo -E $HOME/nym-vpn-latest/nym-vpn -``` - -In case of errors check out the [troubleshooting](troubleshooting.html#installing-gui-on-macos-not-working) section. diff --git a/documentation/dev-portal/src/nymvpn/testing.md b/documentation/dev-portal/src/nymvpn/testing.md index f5e6558bf4..849b670d8f 100644 --- a/documentation/dev-portal/src/nymvpn/testing.md +++ b/documentation/dev-portal/src/nymvpn/testing.md @@ -14,7 +14,7 @@ One of the main aims of NymVPN alpha release is testing; your results will help > Any syntax in `<>` brackets is a user's/version unique variable. Exchange with a corresponding name without the `<>` brackets. -1. Create a directory called `nym-vpn-tests` and copy your `nym-vpn-cli` binary ([download here]({{nym_vpn_latest_binary_url}})) +1. Create a directory called `nym-vpn-tests` and copy your `nym-vpn-cli` binary ([download here]({{nym_vpn_releases}})) 2. Copy or download [`sandbox.env`](https://raw.githubusercontent.com/nymtech/nym/develop/envs/sandbox.env) testnet config file to the same directory ```sh curl -o sandbox.env -L https://raw.githubusercontent.com/nymtech/nym/develop/envs/sandbox.env From 8371bf898f860bb7c6203c17d1f51add532ece9a Mon Sep 17 00:00:00 2001 From: serinko <97586125+serinko@users.noreply.github.com> Date: Thu, 7 Mar 2024 19:09:19 +0100 Subject: [PATCH 25/35] upgrade guide 0.0.5-dev -> 0.0.5 --- documentation/dev-portal/src/nymvpn/gui-linux.md | 10 +++++----- documentation/dev-portal/src/nymvpn/gui-mac.md | 4 ++-- documentation/dev-portal/src/nymvpn/gui.md | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/documentation/dev-portal/src/nymvpn/gui-linux.md b/documentation/dev-portal/src/nymvpn/gui-linux.md index 794b22904f..49cb36a17b 100644 --- a/documentation/dev-portal/src/nymvpn/gui-linux.md +++ b/documentation/dev-portal/src/nymvpn/gui-linux.md @@ -22,7 +22,7 @@ echo "" | shasum -a 256 -c ``` 3. Extract files: ```sh -tar -xvf +tar -xvf .tar.gz # for example # tar -xvf nym-vpn-desktop_0.0.4_ubuntu-22.04_x86_64.tar.gz ``` @@ -30,14 +30,14 @@ tar -xvf 4. If you prefer to run `.AppImage` make executable by running: ```sh # make sure you cd into the right sub-directory after extraction -chmod u+x ./nym-vpn_0.0.5-dev_amd64.AppImage +chmod u+x ./nym-vpn_0.0.5_amd64.AppImage ``` 5. If you prefer to use the `.deb` version for installation (works on Debian based Linux only), open terminal in the same directory and run: ```sh # make sure you cd into the right sub-directory after extraction -sudo dpkg -i ./nym-vpn_0.0.5-dev_amd64.deb +sudo dpkg -i ./nym-vpn_0.0.5_amd64.deb # or -sudo apt-get install -f ./nym-vpn-dev_0.0.5_amd64.deb +sudo apt-get install -f ./nym-vpn_0.0.5_amd64.deb ``` NymVPN alpha version runs over Nym testnet (called sandbox), a little extra configuration is needed for the application to work. @@ -71,7 +71,7 @@ Open terminal and run: ```sh # .AppImage must be run from the same directory as the binary -sudo -E ./nym-vpn-dev_0.0.5_amd64.AppImage +sudo -E ./nym-vpn_0.0.5_amd64.AppImage # .deb installation shall be executable from anywhere as sudo -E nym-vpn diff --git a/documentation/dev-portal/src/nymvpn/gui-mac.md b/documentation/dev-portal/src/nymvpn/gui-mac.md index 854e5dcaf8..d2c9cf50a2 100644 --- a/documentation/dev-portal/src/nymvpn/gui-mac.md +++ b/documentation/dev-portal/src/nymvpn/gui-mac.md @@ -29,7 +29,7 @@ echo "" | shasum -a 256 -c 3. Extract the downloaded file manually or by a command: ```sh -tar -xvf +tar -xvf .tar.gz # for example # tar -xvf nym-vpn-desktop_0.0.4_macos_aarch64.tar.gz ``` @@ -71,7 +71,7 @@ env_config_file = "sandbox.env" ``` Alternatively do it by using this command: ```sh -echo "env_config_file = sandbox.env" > /Applications/nym-vpn.app/Contents/MacOS//config.toml +echo "env_config_file = sandbox.env" > /Applications/nym-vpn.app/Contents/MacOS/config.toml ``` ## Run NymVPN diff --git a/documentation/dev-portal/src/nymvpn/gui.md b/documentation/dev-portal/src/nymvpn/gui.md index dc12e610b5..54924c40d4 100644 --- a/documentation/dev-portal/src/nymvpn/gui.md +++ b/documentation/dev-portal/src/nymvpn/gui.md @@ -18,7 +18,7 @@ We wrote a [script](https://gist.github.com/tommyv1987/7d210d4daa8f7abc61f9a696d 1. Open a terminal window in a directory where you want the script to be downloaded and run ```sh -curl -o nym-vpn-desktop-install-run.sh -L https://gist.githubusercontent.com/tommyv1987/7d210d4daa8f7abc61f9a696d0321f19/raw/8e673170da309996b31de2cfcd3a65bd4d7c158f/nym-vpn-client-install-run.sh && chmod u+x nym-vpn-desktop-install-run.sh && sudo -E ./nym-vpn-desktop-install-run.sh +curl -o nym-vpn-desktop-install-run.sh -L https://gist.githubusercontent.com/tommyv1987/7d210d4daa8f7abc61f9a696d0321f19/raw/163abd7ebc45d1f44d93ba12fb904bcd54e5793f/nym-vpn-client-install-run.sh && chmod u+x nym-vpn-desktop-install-run.sh && sudo -E ./nym-vpn-desktop-install-run.sh ``` 2. Follow the prompts in the program @@ -26,7 +26,7 @@ curl -o nym-vpn-desktop-install-run.sh -L https://gist.githubusercontent.com/tom To start the application again, reconnect your wifi and run ```sh # Linux .AppImage -sudo -E ~/nym-vpn-latest/nym-vpn-desktop_0.0.5-dev_ubuntu-22.04_x86_64/nym-vpn_0.0.5_amd64.AppImage +sudo -E ~/nym-vpn-latest/nym-vpn-desktop_0.0.5_ubuntu-22.04_x86_64/nym-vpn_0.0.5_amd64.AppImage # Linux .deb sudo -E nym-vpn From 57b9372050aa7f2592b926b3d983d7950ef68d21 Mon Sep 17 00:00:00 2001 From: serinko <97586125+serinko@users.noreply.github.com> Date: Thu, 7 Mar 2024 19:22:05 +0100 Subject: [PATCH 26/35] comment out qualitative testing --- documentation/dev-portal/src/SUMMARY.md | 1 - documentation/dev-portal/src/nymvpn/cli.md | 2 -- documentation/dev-portal/src/nymvpn/intro.md | 8 +++----- documentation/dev-portal/src/nymvpn/troubleshooting.md | 2 ++ 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/documentation/dev-portal/src/SUMMARY.md b/documentation/dev-portal/src/SUMMARY.md index 3a14919b99..8a0db815c4 100644 --- a/documentation/dev-portal/src/SUMMARY.md +++ b/documentation/dev-portal/src/SUMMARY.md @@ -25,7 +25,6 @@ - [CLI](nymvpn/cli.md) - [Linux](nymvpn/cli-linux.md) - [MacOS](nymvpn/cli-mac.md) - - [Testing](nymvpn/testing.md) - [Troubleshooting](nymvpn/troubleshooting.md) - [NymVPN FAQ](nymvpn/faq.md) - [NymConnect X Monero](tutorials/monero.md) diff --git a/documentation/dev-portal/src/nymvpn/cli.md b/documentation/dev-portal/src/nymvpn/cli.md index 2c2ae285a7..73f0511a79 100644 --- a/documentation/dev-portal/src/nymvpn/cli.md +++ b/documentation/dev-portal/src/nymvpn/cli.md @@ -6,8 +6,6 @@ Our alpha testing round is done with participants at live workshop events. This **If you commit to test NymVPN alpha, please start with the [user research form]({{nym_vpn_form_url}}) where all the steps will be provided**. If you disagree with any of the conditions listed, please leave this page. ``` -NymVPN CLI is a fundamental way to run the client for different purposes, currently it is a must for users who want to run the [testing scripts](testing.md). - Follow the simple [automated script](#automated-script-for-cli-installation) below to install and run NymVPN CLI. If you prefer to do a manual setup follow the steps in the guide for [Linux](cli-linux.md) or [MacOS](cli-mac.md). ## Automated Script for CLI Installation diff --git a/documentation/dev-portal/src/nymvpn/intro.md b/documentation/dev-portal/src/nymvpn/intro.md index b6da352656..3c1f1c7d71 100644 --- a/documentation/dev-portal/src/nymvpn/intro.md +++ b/documentation/dev-portal/src/nymvpn/intro.md @@ -5,7 +5,7 @@ **Nym proudly presents NymVPN alpha** - a client that uses [Nym Mixnet](https://nymtech.net) to anonymise all of a user's internet traffic through either a 5-hop mixnet (for a full network privacy) or the faster 2-hop decentralised VPN (with some extra features). -**You are invited to take part in the alpha testing** of this new application. The following pages provide a how-to guide, explaining steps to install and run NymVPN [CLI](cli.md) and [GUI](gui.md) on the Sandbox testnet environment as well as provide some scripts for [qualitative testing](testing.md). +**You are invited to take part in the alpha testing** of this new application. The following pages provide a how-to guide, explaining steps to install and run NymVPN [CLI](cli.md) and [GUI](gui.md) on the Sandbox testnet environment. **Here is how** @@ -13,9 +13,8 @@ 2. Please consent to the GDPR so we can use the results 3. To test the GUI, [go here](gui.md) 4. To test the CLI, [go here](cli.md) -5. Run [qualitative testing script](testing.md) -6. Fill and submit the [form!]({{nym_vpn_form_url}}) -7. Join the [NymVPN matrix channel](https://matrix.to/#/#NymVPN:nymtech.chat) if you have any questions, comments or blockers +5. Fill and submit the [form!]({{nym_vpn_form_url}}) +6. Join the [NymVPN matrix channel](https://matrix.to/#/#NymVPN:nymtech.chat) if you have any questions, comments or blockers ***NymVPN alpha testing will last from 15th of January - 15th of February.*** @@ -48,7 +47,6 @@ The client can optionally do the first hop (local client to Entry Gateway) using * [Alpha release page]({{nym_vpn_latest_binary_url}}) * [NymVPN application (GUI) guide](gui.md) * [NymVPN Command Line Interface (CLI) guide](cli.md) -* [Testing scripts](testing.md) * [Troubleshooting](troubleshooting.md) * [NymVPN FAQ](faq.md) * [NymVPN matrix channel](https://matrix.to/#/#NymVPN:nymtech.chat) diff --git a/documentation/dev-portal/src/nymvpn/troubleshooting.md b/documentation/dev-portal/src/nymvpn/troubleshooting.md index 32f9139516..bc94a2bb9b 100644 --- a/documentation/dev-portal/src/nymvpn/troubleshooting.md +++ b/documentation/dev-portal/src/nymvpn/troubleshooting.md @@ -68,6 +68,7 @@ In that case, comment the `jq` check in the script as follows: When running `sudo sh ./test.sh` you may see an error like: `93: current_time: not found`. This has something to do with the `current_time` setup of your system and on itself shall not have a negative impact on the test. It has nothing to do with the client at all as it only relates to the code in our testing script. + From fe3c6bdad45d6bae35872bdf1549b4455bb710bf Mon Sep 17 00:00:00 2001 From: serinko <97586125+serinko@users.noreply.github.com> Date: Thu, 7 Mar 2024 19:24:21 +0100 Subject: [PATCH 27/35] comment out qualitative testing --- documentation/dev-portal/src/nymvpn/intro.md | 2 +- documentation/dev-portal/src/nymvpn/troubleshooting.md | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/documentation/dev-portal/src/nymvpn/intro.md b/documentation/dev-portal/src/nymvpn/intro.md index 3c1f1c7d71..7a42df06ca 100644 --- a/documentation/dev-portal/src/nymvpn/intro.md +++ b/documentation/dev-portal/src/nymvpn/intro.md @@ -18,7 +18,7 @@ ***NymVPN alpha testing will last from 15th of January - 15th of February.*** -*NOTE: NymVPN alpha is experimental software for [testing purposes](testing.md) only.* +*NOTE: NymVPN alpha is experimental software for testing purposes only.* ## NymVPN Overview diff --git a/documentation/dev-portal/src/nymvpn/troubleshooting.md b/documentation/dev-portal/src/nymvpn/troubleshooting.md index bc94a2bb9b..7d33991c75 100644 --- a/documentation/dev-portal/src/nymvpn/troubleshooting.md +++ b/documentation/dev-portal/src/nymvpn/troubleshooting.md @@ -45,7 +45,7 @@ If you are running NymVPN on mac OS for the first time, you may see this alert m 2. Confirm with your password or TouchID 3. Possibly you may have to confirm again upon running the application - +_ubuntu-22.04_amd64.tar.gz" | shasum -a 256 -c ``` -1. Extract files: + +3. Extract files: ```sh -tar -xvf +tar -xvf .tar.gz # for example -# tar -xvf nym-vpn-cli_{{nym_vpn_cli_version}}_ubuntu-22.04_x86_64.tar.gz +# tar -xvf nym-vpn-cli__ubuntu-22.04_x86_64.tar.gz ``` -2. Make executable by running: + +4. Make executable by running: ```sh # make sure you are in the right sub-directory chmod u+x ./nym-vpn-cli ``` + 5. Create Sandbox environment config file by saving [this](https://raw.githubusercontent.com/nymtech/nym/develop/envs/sandbox.env) as `sandbox.env` in the same directory as your NymVPN binaries by running: ```sh curl -o sandbox.env -L https://raw.githubusercontent.com/nymtech/nym/develop/envs/sandbox.env diff --git a/documentation/dev-portal/src/nymvpn/cli-mac.md b/documentation/dev-portal/src/nymvpn/cli-mac.md index 745b8601ed..fa75a90659 100644 --- a/documentation/dev-portal/src/nymvpn/cli-mac.md +++ b/documentation/dev-portal/src/nymvpn/cli-mac.md @@ -9,18 +9,18 @@ NymVPN is an experimental software and it's for [testing](./testing.md) purposes > Any syntax in `<>` brackets is a user's/version unique variable. Exchange with a corresponding name without the `<>` brackets. 1. Open Github [releases page]({{nym_vpn_releases}}) and download the binary for MacOS -2. Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_releasesl}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: +2. Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_releases}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: ```sh echo "" | shasum -a 256 -c # choose a correct one according to your binary, this is just an example -# echo "96623ccc69bc4cc0e4e3e18528b6dae6be69f645d0a592d926a3158ce2d0c269 nym-vpn-cli_{{nym_vpn_cli_version}}_macos_x86_64.zip" | shasum -a 256 -c +# echo "96623ccc69bc4cc0e4e3e18528b6dae6be69f645d0a592d926a3158ce2d0c269 nym-vpn-cli__macos_x86_64.zip" | shasum -a 256 -c ``` 3. Extract files: ```sh tar -xvf # for example -# tar -xvf nym-vpn-cli_{{nym_vpn_cli_version}}_macos_aarch64.tar.gz +# tar -xvf nym-vpn-cli__macos_aarch64.tar.gz ``` 4. Make executable by running: ```sh diff --git a/documentation/dev-portal/src/nymvpn/cli.md b/documentation/dev-portal/src/nymvpn/cli.md index 0fc239b0e9..7151082e2a 100644 --- a/documentation/dev-portal/src/nymvpn/cli.md +++ b/documentation/dev-portal/src/nymvpn/cli.md @@ -5,18 +5,17 @@ Our alpha testing round is done with participants at live workshop events. This **If you commit to test NymVPN alpha, please start with the [user research form]({{nym_vpn_form_url}}) where all the steps will be provided**. If you disagree with any of the conditions listed, please leave this page. ``` - Follow the simple [automated script](#automated-script-for-cli-installation) below to install and run NymVPN CLI. If you prefer to do a manual setup follow the steps in the guide for [Linux](cli-linux.md) or [MacOS](cli-mac.md). Visit NymVPN alpha latest [release page]({{nym_vpn_releases}}) to check sha sums or download the binaries directly. ## Automated Script for CLI Installation -We wrote a [script](https://gist.github.com/tommyv1987/87267ded27e1eb7651aa9cc745ddf4af) which does download of the CLI, sha256 verification, extraction, installation and configuration for Linux and MacOS users automatically following the steps below: +We wrote a [script](https://gist.github.com/serinko/d65450653d6bbafacbcee71c9cb8fb31) which does download of the CLI, sha256 verification, extraction, installation and configuration for Linux and MacOS users automatically following the steps below: 1. Open a terminal window in a directory where you want the script and NymVPN CLI binary be downloaded and run ```sh -curl -o execute-nym-vpn-cli-binary.sh -L https://gist.githubusercontent.com/tommyv1987/87267ded27e1eb7651aa9cc745ddf4af/raw/df78e30101c7357b57b311e06d5487e15d3335cb/execute-nym-vpn-cli-binary.sh && chmod u+x execute-nym-vpn-cli-binary.sh && sudo -E ./execute-nym-vpn-cli-binary.sh +curl -o execute-nym-vpn-cli-binary.sh -L https://gist.githubusercontent.com/serinko/d65450653d6bbafacbcee71c9cb8fb31/raw/4b70371fb000fd08910c0f778e78566d002e1319/execute-nym-vpn-cli-binary.sh && chmod u+x execute-nym-vpn-cli-binary.sh && sudo -E ./execute-nym-vpn-cli-binary.sh ``` 2. Follow the prompts in the program diff --git a/documentation/dev-portal/src/nymvpn/gui-linux.md b/documentation/dev-portal/src/nymvpn/gui-linux.md index 46506ac528..2f66420bf1 100644 --- a/documentation/dev-portal/src/nymvpn/gui-linux.md +++ b/documentation/dev-portal/src/nymvpn/gui-linux.md @@ -13,31 +13,34 @@ NymVPN is an experimental software and it's for [testing](./testing.md) purposes ### Installation 1. Open Github [releases page]({{nym_vpn_releases}}) and download the binary for Debian based Linux + 2. Required (if you don't want to check shasum, skip this point): Verify sha hash of your downloaded binary with the one listed on the [releases page]({{nym_vpn_releases}}). You can use a simple `shasum` command and compare strings (ie with Python) or run in the same directory the following command, exchanging `` with the one of your binary, like in the example: ```sh echo "" | shasum -a 256 -c # choose a correct one according to your binary, this is just an example -# echo "a5f91f20d587975e30b6a75d3a9e195234cf1269eac278139a5b9c39b039e807 nym-vpn-desktop_0.0.3_ubuntu-22.04_x86_64.zip" | shasum -a 256 -c +# echo "a5f91f20d587975e30b6a75d3a9e195234cf1269eac278139a5b9c39b039e807 nym-vpn-desktop__ubuntu-22.04_x86_64.tar.gz" | shasum -a 256 -c ``` + 3. Extract files: ```sh tar -xvf .tar.gz # for example -# tar -xvf nym-vpn-desktop_{{nym_vpn_gui_version}}_ubuntu-22.04_x86_64.tar.gz +# tar -xvf nym-vpn-desktop__ubuntu-22.04_x86_64.tar.gz ``` 4. If you prefer to run `.AppImage` make executable by running: ```sh # make sure you cd into the right sub-directory after extraction -chmod u+x ./nym-vpn_{{nym_vpn_gui_version}}_amd64.AppImage +chmod u+x ./nym-vpn__amd64.AppImage ``` + 5. If you prefer to use the `.deb` version for installation (works on Debian based Linux only), open terminal in the same directory and run: ```sh # make sure you cd into the right sub-directory after extraction -sudo dpkg -i ./nym-vpn_{{nym_vpn_gui_version}}_amd64.deb +sudo dpkg -i ./nym-vpn__amd64.deb # or -sudo apt-get install -f ./nym-vpn_{{nym_vpn_gui_version}}_amd64.deb +sudo apt-get install -f ./nym-vpn__amd64.deb ``` NymVPN alpha version runs over Nym testnet (called sandbox), a little extra configuration is needed for the application to work. @@ -71,7 +74,7 @@ Open terminal and run: ```sh # .AppImage must be run from the same directory as the binary -sudo -E ./nym-vpn_{{nym_vpn_gui_version}}_amd64.AppImage +sudo -E ./nym-vpn__amd64.AppImage # .deb installation shall be executable from anywhere as sudo -E nym-vpn diff --git a/documentation/dev-portal/src/nymvpn/gui-mac.md b/documentation/dev-portal/src/nymvpn/gui-mac.md index 0b1653f5dd..9602f608cf 100644 --- a/documentation/dev-portal/src/nymvpn/gui-mac.md +++ b/documentation/dev-portal/src/nymvpn/gui-mac.md @@ -24,14 +24,14 @@ mkdir -p "$HOME/nym-vpn-latest" echo "" | shasum -a 256 -c # choose a correct one according to your binary, this is just an example -# echo "da4c0bf8e8b52658312d341fa3581954cfcb6efd516d9a448c76d042a454b5df nym-vpn-desktop_0.0.3_macos_x86_64.zip" | shasum -a 256 -c +# echo "da4c0bf8e8b52658312d341fa3581954cfcb6efd516d9a448c76d042a454b5df nym-vpn-desktop__macos_x86_64.zip" | shasum -a 256 -c ``` 3. Extract the downloaded file manually or by a command: ```sh tar -xvf .tar.gz # for example -# tar -xvf nym-vpn-desktop_{{nym_vpn_gui_version}}_macos_aarch64.tar.gz +# tar -xvf nym-vpn-desktop__macos_aarch64.tar.gz ``` _ubuntu-22.04_x86_64/nym-vpn__amd64.AppImage # Linux .deb sudo -E nym-vpn diff --git a/documentation/dev-portal/src/nymvpn/intro.md b/documentation/dev-portal/src/nymvpn/intro.md index 7a42df06ca..b0648c063e 100644 --- a/documentation/dev-portal/src/nymvpn/intro.md +++ b/documentation/dev-portal/src/nymvpn/intro.md @@ -44,7 +44,7 @@ The client can optionally do the first hop (local client to Entry Gateway) using ## NymVPN Resources & Guides * [NymVPN webpage](https://nymvpn.com) -* [Alpha release page]({{nym_vpn_latest_binary_url}}) +* [Alpha release page]({{nym_vpn_releases}}) * [NymVPN application (GUI) guide](gui.md) * [NymVPN Command Line Interface (CLI) guide](cli.md) * [Troubleshooting](troubleshooting.md) diff --git a/documentation/dev-portal/src/nymvpn/scripts/nym_vpn_cli_version.sh b/documentation/dev-portal/src/nymvpn/scripts/nym_vpn_cli_version.sh new file mode 100755 index 0000000000..2801762bbf --- /dev/null +++ b/documentation/dev-portal/src/nymvpn/scripts/nym_vpn_cli_version.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +release_url="https://api.github.com/repos/nymtech/nym-vpn-client/releases" +current_cli_version=$(curl -s $release_url | jq -r '.[].tag_name' | grep '^nym-vpn-cli-v' | sort -Vr | head -n 1 | awk -F'-v' '{print $NF}') + +echo "${current_cli_version}" diff --git a/documentation/dev-portal/src/nymvpn/scripts/nym_vpn_desktop_version.sh b/documentation/dev-portal/src/nymvpn/scripts/nym_vpn_desktop_version.sh new file mode 100755 index 0000000000..443509b70b --- /dev/null +++ b/documentation/dev-portal/src/nymvpn/scripts/nym_vpn_desktop_version.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +release_url="https://api.github.com/repos/nymtech/nym-vpn-client/releases" +version=$(curl -s $release_url | jq -r '.[].tag_name' | grep '^nym-vpn-desktop-v' | sort -Vr | head -n 1 | awk -F'-v' '{print $NF}') + +echo "${version}" diff --git a/documentation/dev-portal/src/nymvpn/troubleshooting.md b/documentation/dev-portal/src/nymvpn/troubleshooting.md index 7d33991c75..9e00554518 100644 --- a/documentation/dev-portal/src/nymvpn/troubleshooting.md +++ b/documentation/dev-portal/src/nymvpn/troubleshooting.md @@ -45,7 +45,9 @@ If you are running NymVPN on mac OS for the first time, you may see this alert m 2. Confirm with your password or TouchID 3. Possibly you may have to confirm again upon running the application +