From 4d347a657cc4c50b8b7ef4407328bc8be68c691b Mon Sep 17 00:00:00 2001 From: Jacob Kiers Date: Thu, 29 Feb 2024 21:56:19 +0100 Subject: [PATCH] Update all dependencies to the latest versions Signed-off-by: Jacob Kiers --- Cargo.toml | 10 +++++----- src/config.rs | 3 ++- src/lib.rs | 16 +++++++++------- src/monetary_account.rs | 3 ++- src/payment.rs | 3 ++- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ce359fd..b812fa2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,12 +10,12 @@ edition = "2018" [dependencies] -anyhow = "1.0.32" -base64 = "0.12.3" +anyhow = "1.0.79" +base64 = "0.21.7" confy = "0.6.0" dotenv = "0.15.0" -isahc = { version = "0.9.8", features = ["json"] } +isahc = { version = "1.7.2", features = ["json"] } rand = "0.8.5" rsa = { version = "0.9.6", features = ["sha2"] } -serde = { version = "1.0.116", features = ["derive"] } -serde_json = "1.0.57" +serde = { version = "1.0.196", features = ["derive"] } +serde_json = "1.0.113" diff --git a/src/config.rs b/src/config.rs index 4c4c03e..9b9d1f9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,10 +1,11 @@ use anyhow::anyhow; -use isahc::{RequestExt, ResponseExt}; +use isahc::{ReadResponseExt, RequestExt}; use isahc::http::StatusCode; use rsa::pkcs1::{DecodeRsaPrivateKey, EncodeRsaPrivateKey, LineEnding}; use rsa::pkcs8::EncodePublicKey; use rsa::RsaPrivateKey; use serde::{Deserialize, Serialize}; + use crate::{BASE_URL, BunqClient, deserialize_retarded_response, sign}; #[derive(Serialize, Deserialize, Default)] diff --git a/src/lib.rs b/src/lib.rs index 6daaeec..1a047b4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,18 +1,18 @@ use anyhow::Result; -use rsa::RsaPrivateKey; use rsa::pkcs1v15::SigningKey; -use rsa::signature::RandomizedSigner; +use rsa::RsaPrivateKey; use rsa::sha2::Sha256; +use rsa::signature::RandomizedSigner; use serde::{de::DeserializeOwned, Deserialize}; +pub use config::BunqConfig; +pub use monetary_account::MonetaryAccount; +pub use payment::Payment; + mod config; mod monetary_account; mod payment; -pub use config::BunqConfig; -pub use crate::monetary_account::MonetaryAccount; -pub use crate::payment::Payment; - const BASE_URL: &str = "https://api.bunq.com"; pub struct BunqClient { @@ -94,8 +94,10 @@ fn deserialize_normal_response(r: &str) -> Result Result { + use base64::prelude::{BASE64_STANDARD, Engine}; + let signing_key = SigningKey::::new(key.clone()); let mut rng = rand::thread_rng(); let signature = signing_key.sign_with_rng(&mut rng, body.as_bytes()); - Ok(base64::encode(signature.to_string())) + Ok(BASE64_STANDARD.encode(signature.to_string())) } diff --git a/src/monetary_account.rs b/src/monetary_account.rs index 5b22131..08a1cda 100644 --- a/src/monetary_account.rs +++ b/src/monetary_account.rs @@ -1,5 +1,6 @@ +use isahc::{ReadResponseExt, RequestExt}; use serde::Deserialize; -use isahc::{RequestExt, ResponseExt}; + use crate::{BASE_URL, BunqClient}; pub(super) fn get(client: &BunqClient) -> anyhow::Result> { diff --git a/src/payment.rs b/src/payment.rs index c5f0459..2de2e45 100644 --- a/src/payment.rs +++ b/src/payment.rs @@ -1,6 +1,7 @@ use anyhow::Result; -use isahc::{RequestExt, ResponseExt}; +use isahc::{ReadResponseExt, RequestExt}; use serde::Deserialize; + use crate::{BASE_URL, BunqClient, MonetaryAccount, Pagination, Response}; pub(super) fn get_from_to(client: &BunqClient,