dalek and rand crate update
This commit is contained in:
@@ -25,7 +25,7 @@ bs58 = { workspace = true }
|
||||
clap = { workspace = true, features = ["cargo", "derive"] }
|
||||
dirs = "4.0"
|
||||
log = { workspace = true } # self explanatory
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] } # rng-related traits + some rng implementation to use
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] } # for config serialization/deserialization
|
||||
serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
@@ -16,7 +16,7 @@ serde_json = { workspace = true }
|
||||
tap = "1.0.1"
|
||||
thiserror = { workspace = true }
|
||||
tokio = { version = "1.24.1", features = ["rt-multi-thread", "net", "signal"] }
|
||||
rand = "0.7.3"
|
||||
rand = { workspace = true }
|
||||
time = { workspace = true }
|
||||
url = { workspace = true }
|
||||
zeroize = { workspace = true }
|
||||
|
||||
@@ -9,7 +9,7 @@ license.workspace = true
|
||||
[dependencies]
|
||||
bip39 = { workspace = true }
|
||||
log = { workspace = true }
|
||||
rand = "0.7.3"
|
||||
rand = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
url = { workspace = true }
|
||||
zeroize = { workspace = true }
|
||||
|
||||
@@ -17,7 +17,7 @@ clap = { workspace = true, optional = true }
|
||||
futures = { workspace = true }
|
||||
humantime-serde = { workspace = true }
|
||||
log = { workspace = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
sha2 = "0.10.6"
|
||||
|
||||
@@ -14,7 +14,7 @@ futures = { workspace = true }
|
||||
log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
url = { workspace = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
tokio = { version = "1.24.1", features = ["macros"] }
|
||||
si-scale = "0.2.2"
|
||||
time.workspace = true
|
||||
|
||||
@@ -23,5 +23,5 @@ nym-api-requests = { path = "../../nym-api/nym-api-requests" }
|
||||
nym-validator-client = { path = "../client-libs/validator-client", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.7.3"
|
||||
rand = "0.8.5"
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ generic-array = { workspace = true, optional = true }
|
||||
hkdf = { version = "0.12.3", optional = true }
|
||||
hmac = { version = "0.12.1", optional = true }
|
||||
cipher = { version = "0.4.3", optional = true }
|
||||
x25519-dalek = { version = "1.1", optional = true }
|
||||
ed25519-dalek = { version = "1.0", optional = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"], optional = true }
|
||||
x25519-dalek = { version = "2.0.0", optional = true }
|
||||
ed25519-dalek = { version = "2.1", features = ["rand_core"], optional = true }
|
||||
rand = { version = "0.8.5", optional = true }
|
||||
serde_bytes = { version = "0.11.6", optional = true }
|
||||
serde_crate = { version = "1.0", optional = true, default_features = false, features = ["derive"], package = "serde" }
|
||||
subtle-encoding = { version = "0.5", features = ["bech32-preview"]}
|
||||
@@ -31,7 +31,7 @@ nym-sphinx-types = { path = "../nymsphinx/types", version = "0.2.0", default-fea
|
||||
nym-pemstore = { path = "../../common/pemstore", version = "0.3.0" }
|
||||
|
||||
[dev-dependencies]
|
||||
rand_chacha = "0.2"
|
||||
rand_chacha = "0.3"
|
||||
|
||||
[features]
|
||||
default = ["sphinx"]
|
||||
|
||||
@@ -56,7 +56,7 @@ pub struct KeyPair {
|
||||
impl KeyPair {
|
||||
#[cfg(feature = "rand")]
|
||||
pub fn new<R: RngCore + CryptoRng>(rng: &mut R) -> Self {
|
||||
let private_key = x25519_dalek::StaticSecret::new(rng);
|
||||
let private_key = x25519_dalek::StaticSecret::random_from_rng(rng);
|
||||
let public_key = (&private_key).into();
|
||||
|
||||
KeyPair {
|
||||
@@ -203,7 +203,7 @@ impl<'a> From<&'a PrivateKey> for PublicKey {
|
||||
impl PrivateKey {
|
||||
#[cfg(feature = "rand")]
|
||||
pub fn new<R: RngCore + CryptoRng>(rng: &mut R) -> Self {
|
||||
let x25519_secret = x25519_dalek::StaticSecret::new(rng);
|
||||
let x25519_secret = x25519_dalek::StaticSecret::random_from_rng(rng);
|
||||
|
||||
PrivateKey(x25519_secret)
|
||||
}
|
||||
@@ -322,9 +322,7 @@ impl<'a> From<&'a PrivateKey> for nym_sphinx_types::PrivateKey {
|
||||
#[cfg(feature = "sphinx")]
|
||||
impl From<nym_sphinx_types::PrivateKey> for PrivateKey {
|
||||
fn from(private_key: nym_sphinx_types::PrivateKey) -> Self {
|
||||
let private_key_bytes = private_key.to_bytes();
|
||||
assert_eq!(private_key_bytes.len(), PRIVATE_KEY_SIZE);
|
||||
Self::from_bytes(&private_key_bytes).unwrap()
|
||||
Self(private_key)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +364,7 @@ mod sphinx_key_conversion {
|
||||
#[test]
|
||||
fn works_for_backward_conversion() {
|
||||
for _ in 0..NUM_ITERATIONS {
|
||||
let (sphinx_private, sphinx_public) = nym_sphinx_types::crypto::keygen();
|
||||
let (sphinx_private, sphinx_public) = nym_sphinx_types::test_utils::fixtures::keygen();
|
||||
|
||||
let private_bytes = sphinx_private.to_bytes();
|
||||
let public_bytes = sphinx_public.as_bytes();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2021-2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
pub use ed25519_dalek::ed25519::signature::Signature as SignatureTrait;
|
||||
pub use ed25519_dalek::SignatureError;
|
||||
use ed25519_dalek::{Signer, SigningKey};
|
||||
pub use ed25519_dalek::{Verifier, PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH, SIGNATURE_LENGTH};
|
||||
use nym_pemstore::traits::{PemStorableKey, PemStorableKeyPair};
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
@@ -30,6 +30,9 @@ pub enum Ed25519RecoveryError {
|
||||
#[error(transparent)]
|
||||
MalformedBytes(#[from] SignatureError),
|
||||
|
||||
#[error(transparent)]
|
||||
BytesLengthError(#[from] std::array::TryFromSliceError),
|
||||
|
||||
#[error("the base58 representation of the public key was malformed - {source}")]
|
||||
MalformedPublicKeyString {
|
||||
#[source]
|
||||
@@ -64,11 +67,11 @@ pub struct KeyPair {
|
||||
impl KeyPair {
|
||||
#[cfg(feature = "rand")]
|
||||
pub fn new<R: RngCore + CryptoRng>(rng: &mut R) -> Self {
|
||||
let ed25519_keypair = ed25519_dalek::Keypair::generate(rng);
|
||||
let ed25519_signing_key = ed25519_dalek::SigningKey::generate(rng);
|
||||
|
||||
KeyPair {
|
||||
private_key: PrivateKey(ed25519_keypair.secret),
|
||||
public_key: PublicKey(ed25519_keypair.public),
|
||||
private_key: PrivateKey(ed25519_signing_key.to_bytes()),
|
||||
public_key: PublicKey(ed25519_signing_key.verifying_key()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +112,7 @@ impl PemStorableKeyPair for KeyPair {
|
||||
|
||||
/// ed25519 EdDSA Public Key
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
pub struct PublicKey(ed25519_dalek::PublicKey);
|
||||
pub struct PublicKey(ed25519_dalek::VerifyingKey);
|
||||
|
||||
impl Display for PublicKey {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
@@ -135,7 +138,9 @@ impl PublicKey {
|
||||
}
|
||||
|
||||
pub fn from_bytes(b: &[u8]) -> Result<Self, Ed25519RecoveryError> {
|
||||
Ok(PublicKey(ed25519_dalek::PublicKey::from_bytes(b)?))
|
||||
Ok(PublicKey(ed25519_dalek::VerifyingKey::from_bytes(
|
||||
b.try_into()?,
|
||||
)?))
|
||||
}
|
||||
|
||||
pub fn to_base58_string(self) -> String {
|
||||
@@ -189,7 +194,7 @@ impl<'d> Deserialize<'d> for PublicKey {
|
||||
where
|
||||
D: Deserializer<'d>,
|
||||
{
|
||||
Ok(PublicKey(ed25519_dalek::PublicKey::deserialize(
|
||||
Ok(PublicKey(ed25519_dalek::VerifyingKey::deserialize(
|
||||
deserializer,
|
||||
)?))
|
||||
}
|
||||
@@ -223,14 +228,14 @@ impl Display for PrivateKey {
|
||||
|
||||
impl<'a> From<&'a PrivateKey> for PublicKey {
|
||||
fn from(pk: &'a PrivateKey) -> Self {
|
||||
PublicKey((&pk.0).into())
|
||||
PublicKey(SigningKey::from_bytes(&pk.0).verifying_key())
|
||||
}
|
||||
}
|
||||
|
||||
impl PrivateKey {
|
||||
#[cfg(feature = "rand")]
|
||||
pub fn new<R: RngCore + CryptoRng>(rng: &mut R) -> Self {
|
||||
let ed25519_secret = ed25519_dalek::SecretKey::generate(rng);
|
||||
let ed25519_secret = ed25519_dalek::SigningKey::generate(rng).to_bytes();
|
||||
|
||||
PrivateKey(ed25519_secret)
|
||||
}
|
||||
@@ -240,11 +245,11 @@ impl PrivateKey {
|
||||
}
|
||||
|
||||
pub fn to_bytes(&self) -> [u8; SECRET_KEY_LENGTH] {
|
||||
self.0.to_bytes()
|
||||
self.0
|
||||
}
|
||||
|
||||
pub fn from_bytes(b: &[u8]) -> Result<Self, Ed25519RecoveryError> {
|
||||
Ok(PrivateKey(ed25519_dalek::SecretKey::from_bytes(b)?))
|
||||
Ok(PrivateKey(b.try_into()?))
|
||||
}
|
||||
|
||||
pub fn to_base58_string(&self) -> String {
|
||||
@@ -259,9 +264,8 @@ impl PrivateKey {
|
||||
}
|
||||
|
||||
pub fn sign<M: AsRef<[u8]>>(&self, message: M) -> Signature {
|
||||
let expanded_secret_key = ed25519_dalek::ExpandedSecretKey::from(&self.0);
|
||||
let public_key: PublicKey = self.into();
|
||||
let sig = expanded_secret_key.sign(message.as_ref(), &public_key.0);
|
||||
let signing_key: SigningKey = self.0.into();
|
||||
let sig = signing_key.sign(message.as_ref());
|
||||
Signature(sig)
|
||||
}
|
||||
|
||||
@@ -330,7 +334,9 @@ impl Signature {
|
||||
}
|
||||
|
||||
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Ed25519RecoveryError> {
|
||||
Ok(Signature(ed25519_dalek::Signature::from_bytes(bytes)?))
|
||||
Ok(Signature(ed25519_dalek::Signature::from_bytes(
|
||||
bytes.try_into()?,
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
use crate::asymmetric::encryption;
|
||||
use crate::hkdf;
|
||||
#[cfg(feature = "rand")]
|
||||
use cipher::crypto_common::rand_core::{CryptoRng, RngCore};
|
||||
use cipher::{Key, KeyIvInit, StreamCipher};
|
||||
use digest::crypto_common::BlockSizeUser;
|
||||
use digest::Digest;
|
||||
#[cfg(feature = "rand")]
|
||||
use rand::{CryptoRng, RngCore};
|
||||
|
||||
/// Generate an ephemeral encryption keypair and perform diffie-hellman to establish
|
||||
/// shared key with the remote.
|
||||
|
||||
@@ -242,7 +242,7 @@ impl SphinxPacketProcessor {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use nym_sphinx_types::crypto::keygen;
|
||||
use nym_sphinx_types::test_utils::fixtures::keygen;
|
||||
|
||||
fn fixture() -> SphinxPacketProcessor {
|
||||
let local_keys = keygen();
|
||||
|
||||
@@ -8,7 +8,7 @@ license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
futures = { workspace = true }
|
||||
rand = "0.7.3"
|
||||
rand = { workspace = true }
|
||||
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
@@ -9,8 +9,8 @@ repository = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
log = { workspace = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand_distr = "0.3"
|
||||
rand = { workspace = true }
|
||||
rand_distr = "0.4"
|
||||
thiserror = { workspace = true }
|
||||
|
||||
nym-sphinx-acknowledgements = { path = "acknowledgements" }
|
||||
|
||||
@@ -8,7 +8,7 @@ license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
serde_crate = { version = "1.0", optional = true, default_features = false, features = ["derive"], package = "serde" }
|
||||
generic-array = { workspace = true, optional = true, features = ["serde"] }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
@@ -14,5 +14,5 @@ serde = "1.0" # implementing serialization/deserialization for some types, like
|
||||
thiserror = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.7"
|
||||
rand = "0.8.5"
|
||||
nym-crypto = { path = "../../crypto", features = ["rand"] }
|
||||
@@ -8,7 +8,7 @@ license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
bs58 = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
@@ -24,4 +24,4 @@ nym-topology = { path = "../../topology" }
|
||||
version = "0.2.83"
|
||||
|
||||
[dev-dependencies]
|
||||
rand_chacha = "0.2"
|
||||
rand_chacha = "0.3"
|
||||
|
||||
@@ -570,7 +570,7 @@ mod tests {
|
||||
let mut address_bytes = [0; NODE_ADDRESS_LENGTH];
|
||||
rng.fill_bytes(&mut address_bytes);
|
||||
|
||||
let dummy_private = PrivateKey::new_with_rng(rng);
|
||||
let dummy_private = PrivateKey::random_from_rng(rng);
|
||||
let pub_key = (&dummy_private).into();
|
||||
Node {
|
||||
address: NodeAddressBytes::from_bytes(address_bytes),
|
||||
|
||||
@@ -11,7 +11,7 @@ repository = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
log = { workspace = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
nym-sphinx-addressing = { path = "../addressing" }
|
||||
|
||||
@@ -8,7 +8,7 @@ license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
nym-crypto = { path = "../../crypto" }
|
||||
|
||||
@@ -130,28 +130,28 @@ impl Decoder for NymCodec {
|
||||
mod packet_encoding {
|
||||
use super::*;
|
||||
use nym_sphinx_types::{
|
||||
crypto, Delay as SphinxDelay, Destination, DestinationAddressBytes, Node, NodeAddressBytes,
|
||||
DESTINATION_ADDRESS_LENGTH, IDENTIFIER_LENGTH, NODE_ADDRESS_LENGTH,
|
||||
test_utils, Delay as SphinxDelay, Destination, DestinationAddressBytes, Node,
|
||||
NodeAddressBytes, DESTINATION_ADDRESS_LENGTH, IDENTIFIER_LENGTH, NODE_ADDRESS_LENGTH,
|
||||
};
|
||||
|
||||
fn make_valid_outfox_packet(size: PacketSize) -> NymPacket {
|
||||
let (_, node1_pk) = crypto::keygen();
|
||||
let (_, node1_pk) = test_utils::fixtures::keygen();
|
||||
let node1 = Node::new(
|
||||
NodeAddressBytes::from_bytes([5u8; NODE_ADDRESS_LENGTH]),
|
||||
node1_pk,
|
||||
);
|
||||
let (_, node2_pk) = crypto::keygen();
|
||||
let (_, node2_pk) = test_utils::fixtures::keygen();
|
||||
let node2 = Node::new(
|
||||
NodeAddressBytes::from_bytes([4u8; NODE_ADDRESS_LENGTH]),
|
||||
node2_pk,
|
||||
);
|
||||
let (_, node3_pk) = crypto::keygen();
|
||||
let (_, node3_pk) = test_utils::fixtures::keygen();
|
||||
let node3 = Node::new(
|
||||
NodeAddressBytes::from_bytes([2u8; NODE_ADDRESS_LENGTH]),
|
||||
node3_pk,
|
||||
);
|
||||
|
||||
let (_, node4_pk) = crypto::keygen();
|
||||
let (_, node4_pk) = test_utils::fixtures::keygen();
|
||||
let node4 = Node::new(
|
||||
NodeAddressBytes::from_bytes([2u8; NODE_ADDRESS_LENGTH]),
|
||||
node4_pk,
|
||||
@@ -170,17 +170,17 @@ mod packet_encoding {
|
||||
}
|
||||
|
||||
fn make_valid_sphinx_packet(size: PacketSize) -> NymPacket {
|
||||
let (_, node1_pk) = crypto::keygen();
|
||||
let (_, node1_pk) = test_utils::fixtures::keygen();
|
||||
let node1 = Node::new(
|
||||
NodeAddressBytes::from_bytes([5u8; NODE_ADDRESS_LENGTH]),
|
||||
node1_pk,
|
||||
);
|
||||
let (_, node2_pk) = crypto::keygen();
|
||||
let (_, node2_pk) = test_utils::fixtures::keygen();
|
||||
let node2 = Node::new(
|
||||
NodeAddressBytes::from_bytes([4u8; NODE_ADDRESS_LENGTH]),
|
||||
node2_pk,
|
||||
);
|
||||
let (_, node3_pk) = crypto::keygen();
|
||||
let (_, node3_pk) = test_utils::fixtures::keygen();
|
||||
let node3 = Node::new(
|
||||
NodeAddressBytes::from_bytes([2u8; NODE_ADDRESS_LENGTH]),
|
||||
node3_pk,
|
||||
|
||||
@@ -8,7 +8,7 @@ license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
sphinx-packet = { version = "0.1.0", optional = true }
|
||||
sphinx-packet = { git = "https://github.com/nymtech/sphinx.git", branch = "simon/x25519", optional = true }
|
||||
nym-outfox = { path = "../../../nym-outfox", optional = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ pub use sphinx_packet::{
|
||||
payload::{Payload, PAYLOAD_OVERHEAD_SIZE},
|
||||
route::{Destination, DestinationAddressBytes, Node, NodeAddressBytes, SURBIdentifier},
|
||||
surb::{SURBMaterial, SURB},
|
||||
Error as SphinxError, ProcessedPacket,
|
||||
test_utils, Error as SphinxError, ProcessedPacket,
|
||||
};
|
||||
#[cfg(feature = "sphinx")]
|
||||
use sphinx_packet::{SphinxPacket, SphinxPacketBuilder};
|
||||
|
||||
@@ -12,7 +12,7 @@ dirs = "4.0"
|
||||
futures = { workspace = true }
|
||||
log = { workspace = true }
|
||||
pin-project = "1.0"
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
schemars = { workspace = true, features = ["preserve_order"] }
|
||||
serde = { workspace = true, features = ["derive"] } # for config serialization/deserialization
|
||||
|
||||
@@ -14,7 +14,7 @@ documentation = { workspace = true }
|
||||
[dependencies]
|
||||
bs58 = { workspace = true }
|
||||
log = { workspace = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
async-trait = { workspace = true, optional = true }
|
||||
semver = "0.11"
|
||||
|
||||
@@ -11,7 +11,7 @@ repository = "https://github.com/nymtech/nym"
|
||||
[dependencies]
|
||||
async-trait = { workspace = true }
|
||||
js-sys = { workspace = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde-wasm-bindgen = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
@@ -32,7 +32,7 @@ serde_json = { workspace = true, optional = true }
|
||||
x25519-dalek = { version = "2.0.0", features = ["static_secrets"] }
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.7.3"
|
||||
rand = "0.8.5"
|
||||
nym-crypto = { path = "../crypto", features = ["rand"]}
|
||||
|
||||
|
||||
|
||||
Generated
+265
-195
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,7 @@ cw-multi-test = { workspace = true }
|
||||
cw3-flex-multisig = { path = "../multisig/cw3-flex-multisig" }
|
||||
cw4-group = { path = "../multisig/cw4-group" }
|
||||
|
||||
rand_chacha = "0.2"
|
||||
rand_chacha = "0.3"
|
||||
|
||||
[[test]]
|
||||
name = "coconut-test"
|
||||
|
||||
@@ -25,7 +25,7 @@ nym-vesting-contract = { path = "../vesting" }
|
||||
nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "rand"] }
|
||||
|
||||
# external dependencies
|
||||
rand_chacha = "0.2"
|
||||
rand_chacha = "0.3"
|
||||
|
||||
[[test]]
|
||||
name = "mixnet-vesting-test"
|
||||
|
||||
@@ -44,7 +44,7 @@ time = { version = "0.3", features = ["macros"] }
|
||||
semver = { workspace = true, default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
rand_chacha = "0.2"
|
||||
rand_chacha = "0.3"
|
||||
nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "rand"] }
|
||||
|
||||
[build-dependencies]
|
||||
|
||||
@@ -33,7 +33,7 @@ cw-multi-test = { workspace = true }
|
||||
nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "rand"] }
|
||||
nym-sphinx-addressing = { path = "../../common/nymsphinx/addressing" }
|
||||
rand = "0.8.5"
|
||||
rand_chacha = "0.2"
|
||||
rand_chacha = "0.3"
|
||||
rstest = "0.17.0"
|
||||
|
||||
[features]
|
||||
|
||||
@@ -31,7 +31,7 @@ vergen = { version = "=7.4.3", default-features = false, features = ["build", "g
|
||||
anyhow = "1.0.40"
|
||||
cw-multi-test = { workspace = true }
|
||||
nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "rand"] }
|
||||
rand_chacha = "0.2"
|
||||
rand_chacha = "0.3"
|
||||
rstest = "0.17.0"
|
||||
|
||||
[features]
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ humantime-serde = { workspace = true }
|
||||
ipnetwork = "0.16"
|
||||
log = { workspace = true }
|
||||
once_cell = "1.7.2"
|
||||
rand = "0.7"
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
sqlx = { workspace = true, features = [
|
||||
|
||||
@@ -15,7 +15,7 @@ bs58 = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
generic-array = { workspace = true, features = ["serde"] }
|
||||
log = { workspace = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
@@ -82,8 +82,10 @@ impl SharedKeys {
|
||||
)
|
||||
}
|
||||
};
|
||||
let mac =
|
||||
compute_keyed_hmac::<GatewayIntegrityHmacAlgorithm>(self.mac_key(), &encrypted_data);
|
||||
let mac = compute_keyed_hmac::<GatewayIntegrityHmacAlgorithm>(
|
||||
self.mac_key().as_slice(),
|
||||
&encrypted_data,
|
||||
);
|
||||
|
||||
mac.into_bytes().into_iter().chain(encrypted_data).collect()
|
||||
}
|
||||
@@ -102,7 +104,7 @@ impl SharedKeys {
|
||||
let message_bytes = &enc_data[mac_size..];
|
||||
|
||||
if !recompute_keyed_hmac_and_verify_tag::<GatewayIntegrityHmacAlgorithm>(
|
||||
self.mac_key(),
|
||||
self.mac_key().as_slice(),
|
||||
message_bytes,
|
||||
mac_tag,
|
||||
) {
|
||||
|
||||
@@ -421,7 +421,7 @@ impl BinaryResponse {
|
||||
let message_bytes = &raw_req[mac_size..];
|
||||
|
||||
if !recompute_keyed_hmac_and_verify_tag::<GatewayIntegrityHmacAlgorithm>(
|
||||
shared_keys.mac_key(),
|
||||
shared_keys.mac_key().as_slice(),
|
||||
message_bytes,
|
||||
mac_tag,
|
||||
) {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ futures = { workspace = true }
|
||||
humantime-serde = { workspace = true }
|
||||
lazy_static = "1.4"
|
||||
log = { workspace = true }
|
||||
rand = "0.7.3"
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
sysinfo = "0.27.7"
|
||||
|
||||
@@ -141,8 +141,8 @@ mod tests {
|
||||
use nym_sphinx_params::packet_sizes::PacketSize;
|
||||
use nym_sphinx_params::PacketType;
|
||||
use nym_sphinx_types::{
|
||||
crypto, Delay as SphinxDelay, Destination, DestinationAddressBytes, Node, NodeAddressBytes,
|
||||
DESTINATION_ADDRESS_LENGTH, IDENTIFIER_LENGTH, NODE_ADDRESS_LENGTH,
|
||||
test_utils, Delay as SphinxDelay, Destination, DestinationAddressBytes, Node,
|
||||
NodeAddressBytes, DESTINATION_ADDRESS_LENGTH, IDENTIFIER_LENGTH, NODE_ADDRESS_LENGTH,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -166,17 +166,17 @@ mod tests {
|
||||
}
|
||||
|
||||
fn make_valid_sphinx_packet(size: PacketSize) -> NymPacket {
|
||||
let (_, node1_pk) = crypto::keygen();
|
||||
let (_, node1_pk) = test_utils::fixtures::keygen();
|
||||
let node1 = Node::new(
|
||||
NodeAddressBytes::from_bytes([5u8; NODE_ADDRESS_LENGTH]),
|
||||
node1_pk,
|
||||
);
|
||||
let (_, node2_pk) = crypto::keygen();
|
||||
let (_, node2_pk) = test_utils::fixtures::keygen();
|
||||
let node2 = Node::new(
|
||||
NodeAddressBytes::from_bytes([4u8; NODE_ADDRESS_LENGTH]),
|
||||
node2_pk,
|
||||
);
|
||||
let (_, node3_pk) = crypto::keygen();
|
||||
let (_, node3_pk) = test_utils::fixtures::keygen();
|
||||
let node3 = Node::new(
|
||||
NodeAddressBytes::from_bytes([2u8; NODE_ADDRESS_LENGTH]),
|
||||
node3_pk,
|
||||
@@ -197,23 +197,23 @@ mod tests {
|
||||
}
|
||||
|
||||
fn make_valid_outfox_packet(size: PacketSize) -> NymPacket {
|
||||
let (_, node1_pk) = crypto::keygen();
|
||||
let (_, node1_pk) = test_utils::fixtures::keygen();
|
||||
let node1 = Node::new(
|
||||
NodeAddressBytes::from_bytes([5u8; NODE_ADDRESS_LENGTH]),
|
||||
node1_pk,
|
||||
);
|
||||
let (_, node2_pk) = crypto::keygen();
|
||||
let (_, node2_pk) = test_utils::fixtures::keygen();
|
||||
let node2 = Node::new(
|
||||
NodeAddressBytes::from_bytes([4u8; NODE_ADDRESS_LENGTH]),
|
||||
node2_pk,
|
||||
);
|
||||
let (_, node3_pk) = crypto::keygen();
|
||||
let (_, node3_pk) = test_utils::fixtures::keygen();
|
||||
let node3 = Node::new(
|
||||
NodeAddressBytes::from_bytes([2u8; NODE_ADDRESS_LENGTH]),
|
||||
node3_pk,
|
||||
);
|
||||
|
||||
let (_, node4_pk) = crypto::keygen();
|
||||
let (_, node4_pk) = test_utils::fixtures::keygen();
|
||||
let node4 = Node::new(
|
||||
NodeAddressBytes::from_bytes([2u8; NODE_ADDRESS_LENGTH]),
|
||||
node4_pk,
|
||||
|
||||
+1
-3
@@ -29,8 +29,7 @@ humantime-serde = { workspace = true }
|
||||
k256 = { version = "*", features = ["ecdsa-core"] } # needed for the Verifier trait; pull whatever version is used by other dependencies
|
||||
log = { workspace = true }
|
||||
pin-project = "1.0"
|
||||
rand = "0.8.5"
|
||||
rand-07 = { package = "rand", version = "0.7.3" } # required for compatibility
|
||||
rand = { workspace = true }
|
||||
reqwest = { workspace = true, features = ["json"] }
|
||||
rocket = { version = "0.5.0", features = ["json"] }
|
||||
rocket_cors = { version = "0.6.0" }
|
||||
@@ -125,6 +124,5 @@ tempfile = "3.3.0"
|
||||
cw3 = { workspace = true }
|
||||
cw-utils = { workspace = true }
|
||||
rand_chacha = "0.3"
|
||||
rand_chacha_02 = { package = "rand_chacha", version = "0.2" }
|
||||
sha2 = "0.9"
|
||||
|
||||
|
||||
@@ -27,11 +27,6 @@ pub fn test_rng(seed: [u8; 32]) -> ChaCha20Rng {
|
||||
ChaCha20Rng::from_seed(seed)
|
||||
}
|
||||
|
||||
pub fn test_rng_07(seed: [u8; 32]) -> rand_chacha_02::ChaCha20Rng {
|
||||
use rand_chacha_02::rand_core::SeedableRng;
|
||||
rand_chacha_02::ChaCha20Rng::from_seed(seed)
|
||||
}
|
||||
|
||||
pub fn pseudorandom_account(rng: &mut ChaCha20Rng) -> AccountId {
|
||||
let mut dummy_account_key_hash = [0u8; 32];
|
||||
rng.fill_bytes(&mut dummy_account_key_hash);
|
||||
@@ -48,7 +43,7 @@ pub fn dealer_fixture(mut rng: &mut ChaCha20Rng, id: NodeIndex) -> DealerDetails
|
||||
rng.fill_bytes(&mut secondary_seed);
|
||||
|
||||
let addr = pseudorandom_account(rng);
|
||||
let identity_keypair = identity::KeyPair::new(&mut test_rng_07(secondary_seed));
|
||||
let identity_keypair = identity::KeyPair::new(&mut test_rng(secondary_seed));
|
||||
let bte_public_key_with_proof = bs58::encode(&keypair.public_key().to_bytes()).into_string();
|
||||
|
||||
let port = 8080 + id;
|
||||
@@ -156,7 +151,7 @@ impl TestingDkgControllerBuilder {
|
||||
let mut secondary_seed = [0u8; 32];
|
||||
rng.fill_bytes(&mut secondary_seed);
|
||||
|
||||
let identity_keypair = identity::KeyPair::new(&mut test_rng_07(secondary_seed));
|
||||
let identity_keypair = identity::KeyPair::new(&mut test_rng(secondary_seed));
|
||||
|
||||
DealerDetails {
|
||||
address: Addr::unchecked(address.as_ref()),
|
||||
|
||||
@@ -49,8 +49,8 @@ use nym_validator_client::nyxd::Coin;
|
||||
use nym_validator_client::nyxd::{
|
||||
AccountId, Algorithm, Event, EventAttribute, ExecTxResult, Fee, Hash, TxResponse,
|
||||
};
|
||||
use rand_07::rngs::OsRng;
|
||||
use rand_07::RngCore;
|
||||
use rand::rngs::OsRng;
|
||||
use rand::RngCore;
|
||||
use rocket::http::Status;
|
||||
use rocket::local::asynchronous::Client;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
@@ -1336,7 +1336,7 @@ struct TestFixture {
|
||||
|
||||
impl TestFixture {
|
||||
async fn new() -> Self {
|
||||
let mut rng = crate::coconut::tests::fixtures::test_rng_07([69u8; 32]);
|
||||
let mut rng = crate::coconut::tests::fixtures::test_rng([69u8; 32]);
|
||||
let params = Parameters::new(4).unwrap();
|
||||
let coconut_keypair = nym_coconut::ttp_keygen(¶ms, 1, 1).unwrap().remove(0);
|
||||
let identity = identity::KeyPair::new(&mut rng);
|
||||
|
||||
@@ -8,7 +8,7 @@ use nym_sphinx::{
|
||||
acknowledgements::AckKey, addressing::clients::Recipient, preparer::MessagePreparer,
|
||||
};
|
||||
use nym_topology::NymTopology;
|
||||
use rand_07::rngs::OsRng;
|
||||
use rand::rngs::OsRng;
|
||||
use std::time::Duration;
|
||||
|
||||
const DEFAULT_AVERAGE_PACKET_DELAY: Duration = Duration::from_millis(200);
|
||||
|
||||
@@ -73,7 +73,7 @@ impl<'a> NetworkMonitorBuilder<'a> {
|
||||
// TODO: those keys change constant throughout the whole execution of the monitor.
|
||||
// and on top of that, they are used with ALL the gateways -> presumably this should change
|
||||
// in the future
|
||||
let mut rng = rand_07::rngs::OsRng;
|
||||
let mut rng = rand::rngs::OsRng;
|
||||
|
||||
let identity_keypair = Arc::new(identity::KeyPair::new(&mut rng));
|
||||
let encryption_keypair = Arc::new(encryption::KeyPair::new(&mut rng));
|
||||
|
||||
@@ -14,7 +14,7 @@ use nym_sphinx::addressing::clients::Recipient;
|
||||
use nym_sphinx::forwarding::packet::MixPacket;
|
||||
use nym_sphinx::params::{PacketSize, PacketType};
|
||||
use nym_topology::{gateway, mix};
|
||||
use rand_07::{rngs::ThreadRng, seq::SliceRandom, thread_rng, Rng};
|
||||
use rand::{rngs::ThreadRng, seq::SliceRandom, thread_rng, Rng};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
|
||||
@@ -9,7 +9,6 @@ use crate::support::config::{
|
||||
use anyhow::{Context, Result};
|
||||
use nym_crypto::asymmetric::identity;
|
||||
use rand::rngs::OsRng;
|
||||
use rand_07::rngs::OsRng as OsRng07;
|
||||
use std::{fs, io};
|
||||
|
||||
// TODO: once we upgrade ed25519 library, we could use the same rand library and use proper
|
||||
@@ -20,7 +19,7 @@ fn init_identity_keys(config: &config::NymApiPaths) -> Result<()> {
|
||||
&config.public_identity_key_file,
|
||||
);
|
||||
|
||||
let mut rng = OsRng07;
|
||||
let mut rng = OsRng;
|
||||
let keypair = identity::KeyPair::new(&mut rng);
|
||||
nym_pemstore::store_keypair(&keypair, &keypaths)
|
||||
.context("failed to store identity keys of the nym api")?;
|
||||
|
||||
@@ -30,15 +30,24 @@ itertools = "0.10.5"
|
||||
log = { version = "0.4", features = ["serde"] }
|
||||
pretty_env_logger = "0.4.0"
|
||||
rand = "0.8"
|
||||
rand-07 = { package = "rand", version = "0.7.3" }
|
||||
reqwest = { version = "0.12.4", features = ["json", "socks"] }
|
||||
reqwest = { version = "0.11.22", features = ["json", "socks"] }
|
||||
rust-embed = { version = "6.4.2", features = ["include-exclude"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
serde_repr = "0.1"
|
||||
tap = "1.0.1"
|
||||
# 07.07.23: JS: I changed the version from ^1.2.2 to fix up indirect import of web-sys
|
||||
tauri = { version = "1.4.1", features = ["clipboard-write-text", "macos-private-api", "notification-all", "shell-open", "system-tray", "updater", "window-close", "window-minimize", "window-start-dragging"] }
|
||||
tauri = { version = "1.4.1", features = [
|
||||
"clipboard-write-text",
|
||||
"macos-private-api",
|
||||
"notification-all",
|
||||
"shell-open",
|
||||
"system-tray",
|
||||
"updater",
|
||||
"window-close",
|
||||
"window-minimize",
|
||||
"window-start-dragging",
|
||||
] }
|
||||
#tendermint-rpc = "0.23.0"
|
||||
thiserror = "1.0"
|
||||
time = { version = "0.3.17", features = ["local-offset"] }
|
||||
|
||||
@@ -20,7 +20,7 @@ use nym_config::{
|
||||
};
|
||||
use nym_crypto::asymmetric::identity;
|
||||
use nym_socks5_client_core::config::Config as Socks5CoreConfig;
|
||||
use rand_07::rngs::OsRng;
|
||||
use rand::rngs::OsRng;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{fs, io};
|
||||
@@ -214,7 +214,7 @@ pub async fn init_socks5_config(provider_address: String, chosen_gateway_id: Str
|
||||
let gateway_setup = if !already_init {
|
||||
let selection_spec =
|
||||
GatewaySelectionSpecification::new(Some(chosen_gateway_id), None, false);
|
||||
let mut rng = rand_07::thread_rng();
|
||||
let mut rng = rand::thread_rng();
|
||||
let available_gateways =
|
||||
current_gateways(&mut rng, &config.core.base.client.nym_api_urls).await?;
|
||||
GatewaySetup::New {
|
||||
|
||||
@@ -87,7 +87,7 @@ async fn select_gateway_by_latency(gateways: Vec<GatewayBondAnnotated>) -> Resul
|
||||
.filter_map(|g| g.gateway_bond.try_into().ok())
|
||||
.collect();
|
||||
|
||||
let mut rng = rand_07::rngs::OsRng;
|
||||
let mut rng = rand::rngs::OsRng;
|
||||
let selected_gateway = nym_client_core::init::helpers::choose_gateway_by_latency(
|
||||
&mut rng,
|
||||
&gateways_as_nodes,
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ colored = "2"
|
||||
clap = { workspace = true, features = ["cargo", "env"] }
|
||||
humantime-serde = { workspace = true }
|
||||
ipnetwork = "0.16.0"
|
||||
rand = "0.7.3"
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
|
||||
@@ -23,7 +23,7 @@ utoipa-swagger-ui = { workspace = true, features = ["axum"] }
|
||||
|
||||
colored = "2"
|
||||
ipnetwork = "0.16"
|
||||
rand = "0.7.3"
|
||||
rand = { workspace = true }
|
||||
|
||||
# Wireguard:
|
||||
fastrand = "2"
|
||||
|
||||
@@ -36,7 +36,7 @@ nym-bin-common = { path = "../../common/bin-common", features = ["bin_info_schem
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
rand_chacha = "0.2"
|
||||
rand_chacha = "0.3"
|
||||
nym-crypto = { path = "../../common/crypto", features = ["rand"] }
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ nym-store-cipher = { path = "../../common/store-cipher", features = ["json"] }
|
||||
|
||||
[dev-dependencies]
|
||||
nym-crypto = { path = "../../common/crypto", features = ["rand"] }
|
||||
rand_chacha = "0.2"
|
||||
rand_chacha = "0.3"
|
||||
tempfile = "3.3.0"
|
||||
ts-rs = "7.0.0"
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use nym_contracts_common::signing::SigningAlgorithm;
|
||||
use nym_crypto::asymmetric::identity;
|
||||
use nym_crypto::asymmetric::identity::Ed25519RecoveryError;
|
||||
use nym_types::error::TypesError;
|
||||
use nym_validator_client::nym_api::error::NymAPIError;
|
||||
@@ -150,9 +149,6 @@ pub enum BackendError {
|
||||
#[error(transparent)]
|
||||
Ed25519Recovery(#[from] Ed25519RecoveryError),
|
||||
|
||||
#[error("failed to verify ed25519 signature: {0}")]
|
||||
Ed25519SignatureError(#[from] identity::SignatureError),
|
||||
|
||||
#[error("This command ({name}) has been removed. Please try to use {alternative} instead.")]
|
||||
RemovedCommand { name: String, alternative: String },
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ nym-socks5-client-core = { path = "../../../common/socks5-client-core", default-
|
||||
serde = { workspace = true }
|
||||
tokio = { workspace = true, features = ["sync", "time"] }
|
||||
log = "0.4.17"
|
||||
rand = "0.7.3"
|
||||
rand = { workspace = true }
|
||||
|
||||
safer-ffi = { version = "0.1.4" }
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ http = "0.2.9"
|
||||
|
||||
futures = { workspace = true }
|
||||
log = { workspace = true }
|
||||
rand = { version = "0.7.3" }
|
||||
rand = { workspace = true }
|
||||
tap = "1.0.1"
|
||||
thiserror = { workspace = true }
|
||||
url = { workspace = true }
|
||||
|
||||
@@ -28,7 +28,7 @@ ipnetwork = "0.20.0"
|
||||
log = { workspace = true }
|
||||
pretty_env_logger = "0.4.0"
|
||||
publicsuffix = "2.2.3"
|
||||
rand = "0.7.3"
|
||||
rand = { workspace = true }
|
||||
regex = "1.8.4"
|
||||
reqwest = { workspace = true, features = ["json"] }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
|
||||
@@ -16,7 +16,7 @@ crate-type = ["cdylib", "rlib"]
|
||||
anyhow = "1.0"
|
||||
futures = { workspace = true }
|
||||
js-sys = { workspace = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
serde-wasm-bindgen = { workspace = true }
|
||||
|
||||
@@ -17,7 +17,7 @@ crate-type = ["cdylib", "rlib"]
|
||||
async-trait = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
js-sys = { workspace = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde-wasm-bindgen = { workspace = true }
|
||||
tokio = { workspace = true, features = ["sync"] }
|
||||
|
||||
@@ -16,7 +16,7 @@ crate-type = ["cdylib", "rlib"]
|
||||
[dependencies]
|
||||
futures = { workspace = true }
|
||||
js-sys = { workspace = true }
|
||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde-wasm-bindgen = { workspace = true }
|
||||
tokio = { workspace = true, features = ["sync"] }
|
||||
|
||||
Reference in New Issue
Block a user