chore(ecies): replace reth-primitives with alloy-primitives (#8812)

This commit is contained in:
Matthias Seitz
2024-06-13 23:19:49 +02:00
committed by GitHub
parent a568535b85
commit a96884d670
8 changed files with 16 additions and 15 deletions

2
Cargo.lock generated
View File

@ -6834,6 +6834,7 @@ name = "reth-ecies"
version = "1.0.0-rc.1"
dependencies = [
"aes 0.8.4",
"alloy-primitives",
"alloy-rlp",
"block-padding",
"byteorder",
@ -6847,7 +6848,6 @@ dependencies = [
"pin-project",
"rand 0.8.5",
"reth-network-peers",
"reth-primitives",
"secp256k1 0.28.2",
"sha2 0.10.8",
"sha3",

View File

@ -11,13 +11,14 @@ repository.workspace = true
workspace = true
[dependencies]
reth-primitives.workspace = true
reth-network-peers = { workspace = true, features = ["secp256k1"] }
alloy-rlp = { workspace = true, features = ["derive"] }
alloy-primitives = { workspace = true, features = ["rand", "rlp"] }
alloy-rlp = { workspace = true, features = ["derive", "arrayvec"] }
futures.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["full"] }
tokio = { workspace = true, features = ["time"] }
tokio-stream.workspace = true
tokio-util = { workspace = true, features = ["codec"] }
pin-project.workspace = true

View File

@ -7,16 +7,16 @@ use crate::{
ECIESError,
};
use aes::{cipher::StreamCipher, Aes128, Aes256};
use alloy_primitives::{
bytes::{BufMut, Bytes, BytesMut},
B128, B256, B512 as PeerId,
};
use alloy_rlp::{Encodable, Rlp, RlpEncodable, RlpMaxEncodedLen};
use byteorder::{BigEndian, ByteOrder, ReadBytesExt};
use ctr::Ctr64BE;
use digest::{crypto_common::KeyIvInit, Digest};
use rand::{thread_rng, Rng};
use reth_network_peers::{id2pk, pk2id};
use reth_primitives::{
bytes::{BufMut, Bytes, BytesMut},
B128, B256, B512 as PeerId,
};
use secp256k1::{
ecdsa::{RecoverableSignature, RecoveryId},
PublicKey, SecretKey, SECP256K1,
@ -735,7 +735,7 @@ impl ECIES {
#[cfg(test)]
mod tests {
use super::*;
use reth_primitives::{b256, hex};
use alloy_primitives::{b256, hex};
#[test]
fn ecdh() {

View File

@ -1,5 +1,5 @@
use crate::{algorithm::ECIES, ECIESError, EgressECIESValue, IngressECIESValue};
use reth_primitives::{BytesMut, B512 as PeerId};
use alloy_primitives::{bytes::BytesMut, B512 as PeerId};
use secp256k1::SecretKey;
use std::{fmt::Debug, io};
use tokio_util::codec::{Decoder, Encoder};

View File

@ -18,7 +18,7 @@ pub use error::ECIESError;
mod codec;
use reth_primitives::{
use alloy_primitives::{
bytes::{Bytes, BytesMut},
B512 as PeerId,
};

View File

@ -10,11 +10,11 @@
//! For more information, refer to the [Ethereum MAC specification](https://github.com/ethereum/devp2p/blob/master/rlpx.md#mac).
use aes::Aes256Enc;
use alloy_primitives::{B128, B256};
use block_padding::NoPadding;
use cipher::BlockEncrypt;
use digest::KeyInit;
use generic_array::GenericArray;
use reth_primitives::{B128, B256};
use sha3::{Digest, Keccak256};
use typenum::U16;

View File

@ -3,11 +3,11 @@
use crate::{
codec::ECIESCodec, error::ECIESErrorImpl, ECIESError, EgressECIESValue, IngressECIESValue,
};
use futures::{ready, Sink, SinkExt};
use reth_primitives::{
use alloy_primitives::{
bytes::{Bytes, BytesMut},
B512 as PeerId,
};
use futures::{ready, Sink, SinkExt};
use secp256k1::SecretKey;
use std::{
fmt::Debug,

View File

@ -1,7 +1,7 @@
//! Utility functions for hashing and encoding.
use alloy_primitives::B256;
use hmac::{Hmac, Mac};
use reth_primitives::B256;
use sha2::{Digest, Sha256};
/// Hashes the input data with SHA256.