Skip to content

Commit

Permalink
upgraded dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbaque committed Aug 13, 2024
1 parent ead23fa commit 9e79f0a
Show file tree
Hide file tree
Showing 12 changed files with 1,089 additions and 601 deletions.
1,445 changes: 980 additions & 465 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions bloock-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ thiserror = "1.0.31"
serde_json = "1.0.82"
hex = "0.4.3"
bitvec = "1"
base64 = "0.13.0"
base64 = "0.22.1"
async-std = "1.12.0"
hmac = "0.12.1"
sha2 = "0.10.6"
Expand All @@ -27,12 +27,11 @@ bloock-web3 = { path = "../bloock-libs/web3" }
bloock-identity-rs = { path = "../bloock-libs/identity" }

[dev-dependencies]
mockall = "0.11.2"
tokio = { version = "1.20.1", features = ["rt", "macros"] }
mockall = "0.13.0"
tokio = { version = "1.39.2", features = ["rt", "macros"] }

[dev-dependencies.bloock-http]
path = "../bloock-libs/http"
version = "=0.1.0"
features = ["testing"]

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down
18 changes: 9 additions & 9 deletions bloock-libs/encrypter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ bench = false
[dependencies]
bloock-keys = { path = "../keys" }
bloock-http = { path = "../http" }
async-trait = "0.1.57"
serde = { version = "1.0.123", features = ["std", "derive"] }
thiserror = "1.0.31"
aes-gcm = "0.10"
rsa = "0.7.2"
getrandom = { version = "0.2.7", features = ["js"] }
async-trait = "0.1.81"
serde = { version = "1.0.207", features = ["std", "derive"] }
thiserror = "1.0.63"
aes-gcm = "0.10.3"
rsa = "0.9.6"
getrandom = { version = "0.2.15", features = ["js"] }
rand = "0.8.5"
base64-url = "1.4.13"
pbkdf2 = "0.11.0"
base64-url = "3.0.0"
pbkdf2 = "0.12.2"
hmac = "0.12.1"
sha2 = "0.10.6"
sha2 = "0.10.8"
hex = "0.4.3"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
Expand Down
84 changes: 29 additions & 55 deletions bloock-libs/encrypter/src/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use bloock_keys::{
};
use rsa::{
pkcs8::{DecodePrivateKey, DecodePublicKey},
PaddingScheme, PublicKey, RsaPrivateKey, RsaPublicKey,
Oaep, RsaPrivateKey, RsaPublicKey,
};

pub struct RsaEncrypter {
Expand All @@ -29,10 +29,7 @@ pub struct RsaEncrypter {

impl RsaEncrypter {
pub fn new(api_host: String, api_key: String) -> Self {
Self {
api_host,
api_key,
}
Self { api_host, api_key }
}

pub fn new_boxed(api_host: String, api_key: String) -> Box<Self> {
Expand All @@ -49,22 +46,17 @@ impl Encrypter for RsaEncrypter {
};

let subject = key
.get_certificate(
self.api_host.clone(),
self.api_key.clone(),
)
.get_certificate(self.api_host.clone(), self.api_key.clone())
.await
.map(|c| c.tbs_certificate.subject.to_string()).ok();
.map(|c| c.tbs_certificate.subject.to_string())
.ok();

let aes_key = LocalKey::new(&LocalKeyParams {
key_type: bloock_keys::KeyType::Aes256,
})
.map_err(|err| EncrypterError::InvalidKey(err.to_string()))?;

let aes_encrypter = AesEncrypter::new(
self.api_host.clone(),
self.api_key.clone(),
);
let aes_encrypter = AesEncrypter::new(self.api_host.clone(), self.api_key.clone());

let ciphertext = aes_encrypter
.encrypt_local(payload, &aes_key.clone().into())
Expand Down Expand Up @@ -97,22 +89,17 @@ impl Encrypter for RsaEncrypter {
};

let subject = key
.get_certificate(
self.api_host.clone(),
self.api_key.clone(),
)
.get_certificate(self.api_host.clone(), self.api_key.clone())
.await
.map(|c| c.tbs_certificate.subject.to_string()).ok();
.map(|c| c.tbs_certificate.subject.to_string())
.ok();

let aes_key = LocalKey::new(&LocalKeyParams {
key_type: bloock_keys::KeyType::Aes256,
})
.map_err(|err| EncrypterError::InvalidKey(err.to_string()))?;

let aes_encrypter = AesEncrypter::new(
self.api_host.clone(),
self.api_key.clone(),
);
let aes_encrypter = AesEncrypter::new(self.api_host.clone(), self.api_key.clone());

let ciphertext = aes_encrypter
.encrypt_local(payload, &aes_key.clone().into())
Expand Down Expand Up @@ -154,10 +141,7 @@ impl Encrypter for RsaEncrypter {
EncrypterError::InvalidKey("Invalid encryption metadata provided".to_string())
})?;

let aes_encrypter = AesEncrypter::new(
self.api_host.clone(),
self.api_key.clone(),
);
let aes_encrypter = AesEncrypter::new(self.api_host.clone(), self.api_key.clone());

aes_encrypter
.decrypt_local(payload, None, &aes_key.into())
Expand Down Expand Up @@ -188,10 +172,7 @@ impl Encrypter for RsaEncrypter {
EncrypterError::InvalidKey("Invalid encryption metadata provided".to_string())
})?;

let aes_encrypter = AesEncrypter::new(
self.api_host.clone(),
self.api_key.clone(),
);
let aes_encrypter = AesEncrypter::new(self.api_host.clone(), self.api_key.clone());

aes_encrypter
.decrypt_local(payload, None, &aes_key.into())
Expand All @@ -207,19 +188,17 @@ impl RsaEncrypter {
};

let subject = key
.get_certificate(
self.api_host.clone(),
self.api_key.clone(),
)
.get_certificate(self.api_host.clone(), self.api_key.clone())
.await
.map(|c| c.tbs_certificate.subject.to_string()).ok();
.map(|c| c.tbs_certificate.subject.to_string())
.ok();

let mut rng = rand::thread_rng();

let public_key = RsaPublicKey::from_public_key_pem(&local.key.to_string())
.map_err(|err| EncrypterError::InvalidKey(err.to_string()))?;

let padding = PaddingScheme::new_oaep::<sha2::Sha256>();
let padding = Oaep::new::<sha2::Sha256>();

let ciphertext = public_key
.encrypt(&mut rng, padding, payload)
Expand Down Expand Up @@ -248,12 +227,10 @@ impl RsaEncrypter {
};

let subject = key
.get_certificate(
self.api_host.clone(),
self.api_key.clone(),
)
.get_certificate(self.api_host.clone(), self.api_key.clone())
.await
.map(|c| c.tbs_certificate.subject.to_string()).ok();
.map(|c| c.tbs_certificate.subject.to_string())
.ok();

let http = BloockHttpClient::new(self.api_key.clone(), None);

Expand Down Expand Up @@ -292,7 +269,7 @@ impl RsaEncrypter {
.ok_or_else(|| EncrypterError::InvalidKey("No private key provided".to_string()))?;
let private_key = RsaPrivateKey::from_pkcs8_pem(&secret_key.to_string())
.map_err(|err| EncrypterError::InvalidKey(err.to_string()))?;
let padding = PaddingScheme::new_oaep::<sha2::Sha256>();
let padding = Oaep::new::<sha2::Sha256>();
private_key
.decrypt(padding, payload)
.map_err(|err| EncrypterError::FailedToDecrypt(err.to_string()))
Expand Down Expand Up @@ -462,10 +439,9 @@ mod tests {
protection: bloock_keys::entity::protection_level::ProtectionLevel::SOFTWARE,
expiration: None,
};
let managed_key =
ManagedKey::new(&managed_key_params, api_host.clone(), api_key.clone())
.await
.unwrap();
let managed_key = ManagedKey::new(&managed_key_params, api_host.clone(), api_key.clone())
.await
.unwrap();

sleep(Duration::from_secs(5));

Expand Down Expand Up @@ -531,10 +507,9 @@ mod tests {
protection: bloock_keys::entity::protection_level::ProtectionLevel::SOFTWARE,
expiration: None,
};
let managed_key =
ManagedKey::new(&managed_key_params, api_host.clone(), api_key.clone())
.await
.unwrap();
let managed_key = ManagedKey::new(&managed_key_params, api_host.clone(), api_key.clone())
.await
.unwrap();

sleep(Duration::from_secs(10));

Expand Down Expand Up @@ -579,10 +554,9 @@ mod tests {
protection: bloock_keys::entity::protection_level::ProtectionLevel::SOFTWARE,
expiration: None,
};
let managed_key =
ManagedKey::new(&managed_key_params, api_host.clone(), api_key.clone())
.await
.unwrap();
let managed_key = ManagedKey::new(&managed_key_params, api_host.clone(), api_key.clone())
.await
.unwrap();

let signer = RsaEncrypter::new(api_host, api_key);

Expand Down
6 changes: 3 additions & 3 deletions bloock-libs/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ edition = "2021"
bench = false

[dependencies]
serde = { version = "1.0.123", features = ["std", "derive"] }
thiserror = "1.0.31"
tokio = { version = "1.19.2", features = ["rt-multi-thread"] }
serde = { version = "1.0.207", features = ["std", "derive"] }
thiserror = "1.0.63"
tokio = { version = "1.39.2", features = ["rt-multi-thread"] }

[[test]]
name = "default"
Expand Down
10 changes: 5 additions & 5 deletions bloock-libs/hasher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ edition = "2021"
bench = false

[dependencies]
serde = { version = "1.0.123", features = ["std", "derive"] }
serde = { version = "1.0.207", features = ["std", "derive"] }
hex = "0.4.3"
thiserror = "1.0.31"
thiserror = "1.0.63"
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
sha2 = "0.10.6"
sha2 = "0.10.8"
bloock-poseidon-rs = "0.1.5"
num-bigint = "0.4.3"
num-traits = "0.2.15"
num-bigint = "0.4.6"
num-traits = "0.2.19"
18 changes: 9 additions & 9 deletions bloock-libs/http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ edition = "2021"
bench = false

[dependencies]
serde = { version = "1.0.123", features = ["std", "derive"] }
serde_json = "1.0.82"
serde = { version = "1.0.207", features = ["std", "derive"] }
serde_json = "1.0.124"
thiserror = "1.0.31"
async-trait = "0.1.57"
mockall = { version = "0.11.2", optional = true }
infer = "0.9.0"
mime = "0.3.16"
async-trait = "0.1.81"
mockall = { version = "0.13.0", optional = true }
infer = "0.16.0"
mime = "0.3.17"
multipart = { version = "0.18.0", default-features = false, features = [
"client",
] }
uuid = { version = "1.4.1", features = ["v4"] }
uuid = { version = "1.10.0", features = ["v4"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
ureq = "2.9.5"
Expand All @@ -26,7 +26,7 @@ ureq = "2.9.5"
js-sys = "0.3.59"
wasm-bindgen = { version = "0.2.82" }
wasm-bindgen-futures = "0.4.32"
serde-wasm-bindgen = "0.4.5"
serde-wasm-bindgen = "0.6.5"
web-sys = { version = "0.3.59", features = [
"Headers",
"console",
Expand All @@ -37,7 +37,7 @@ web-sys = { version = "0.3.59", features = [
] }

[dev-dependencies]
mockall = "0.11.2"
mockall = "0.13.0"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { version = "1.19.2", features = ["rt", "macros"] }
Expand Down
4 changes: 2 additions & 2 deletions bloock-libs/identity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ssi = "0.7.0"
serde_json = "1.0.82"
rand = "0.8.5"
lazy_static = "1.4.0"
base58 = "0.1.0"
base58 = "0.2.0"
chrono = "0.4.26"
uuid = { version = "1.4.1", features = ["v4"] }
jsonschema = { version = "0.17.1", features = [
Expand All @@ -40,7 +40,7 @@ regex = "1.9.1"
serde = { version = "1.0.139", features = ["std", "derive"] }
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
url = "2.3.1"
cid = "0.10.1"
cid = "0.11.1"
bloock-http = { path = "../http" }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
38 changes: 19 additions & 19 deletions bloock-libs/keys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@ edition = "2021"
bench = false

[dependencies]
thiserror = "1.0.31"
serde = { version = "1.0.123", features = ["std", "derive"] }
thiserror = "1.0.63"
serde = { version = "1.0.207", features = ["std", "derive"] }
bloock-http = { path = "../http" }
bloock-hasher = { path = "../hasher" }
getrandom = { version = "0.2.7", features = ["js"] }
getrandom = { version = "0.2.15", features = ["js"] }
rand = "0.8.5"
hex = "0.4.3"
libsecp256k1 = "0.7.1"
tiny-bip39 = "1.0.0"
bip32 = "0.4.0"
bip32 = "0.5.2"
tiny-hderive = "0.3.0"
rsa = { version = "0.9.2", features = ["sha2"] }
sha2 = { version = "0.10", features = ["oid"] }
x509-cert = { version = "0.2.4", features = ["builder"] }
rsa = { version = "0.9.6", features = ["sha2"] }
sha2 = { version = "0.10.8", features = ["oid"] }
x509-cert = { version = "0.2.5", features = ["builder"] }
bloock-babyjubjub-rs = "0.0.11"
num-bigint = { version = "0.4", features = ["rand"] }
async-trait = "0.1.57"
regex = "1.9.1"
num-bigint = { version = "0.4.6", features = ["rand"] }
async-trait = "0.1.81"
regex = "1.10.6"

# P12
des = "^0.8"
hmac = "^0.12"
lazy_static = "^1.4"
rc2 = "^0.8"
sha1 = "^0.10"
cbc = { version = "^0.1", features = ["block-padding"] }
cipher = { version = "^0.4.2", features = ["alloc", "block-padding"] }
yasna = { version = "^0.5", features = ["std"] }
des = "^0.8.1"
hmac = "^0.12.1"
lazy_static = "^1.5.0"
rc2 = "^0.8.1"
sha1 = "^0.10.6"
cbc = { version = "^0.1.2", features = ["block-padding"] }
cipher = { version = "^0.4.4", features = ["alloc", "block-padding"] }
yasna = { version = "^0.5.2", features = ["std"] }
pkcs5 = { version = "0.7.1", features = ["alloc", "pbes2"] }
der = "0.7.8"
der = "0.7.9"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { version = "1.19.2", features = ["rt", "macros"] }
Expand Down
Loading

0 comments on commit 9e79f0a

Please sign in to comment.