Update all dependencies to the latest versions
Signed-off-by: Jacob Kiers <code@kiers.eu>
This commit is contained in:
parent
54cec9ac04
commit
4d347a657c
10
Cargo.toml
10
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"
|
||||
|
@ -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)]
|
||||
|
16
src/lib.rs
16
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<T: DeserializeOwned>(r: &str) -> Result<Response<
|
||||
}
|
||||
|
||||
fn sign(body: &str, key: &RsaPrivateKey) -> Result<String> {
|
||||
use base64::prelude::{BASE64_STANDARD, Engine};
|
||||
|
||||
let signing_key = SigningKey::<Sha256>::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()))
|
||||
}
|
||||
|
@ -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<Vec<MonetaryAccount>> {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user