First commit

This commit is contained in:
Yuri Iozzelli
2020-09-27 15:17:59 +02:00
commit e0f0279570
4 changed files with 565 additions and 0 deletions

19
src/main.rs Normal file
View File

@@ -0,0 +1,19 @@
use anyhow::Result;
use isahc::prelude::*;
use openssl::pkey::PKey;
const BASE: &str = "https://public-api.sandbox.bunq.com/v1/";
fn main() -> Result<()> {
dotenv::dotenv()?;
let api_key = std::env::var("API_KEY")?;
let pem = include_bytes!("../private.pem");
let keypair = PKey::private_key_from_pem(pem)?;
let mut response = isahc::post(format!("{}installation",BASE), format!("{{'client_public_key': '{}'}}", std::str::from_utf8(pem)?))?;
println!("{}", response.text()?);
Ok(())
}