Update all dependencies to the latest versions
Signed-off-by: Jacob Kiers <code@kiers.eu>
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user