https://github.com/davidask/bankid-rs
BankID client written in Rust
https://github.com/davidask/bankid-rs
Last synced: 4 days ago
JSON representation
BankID client written in Rust
- Host: GitHub
- URL: https://github.com/davidask/bankid-rs
- Owner: davidask
- Created: 2021-11-06T21:04:10.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-16T21:25:56.000Z (almost 4 years ago)
- Last Synced: 2024-12-27T03:25:42.757Z (10 months ago)
- Language: Rust
- Size: 39.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bankid-rs
A [BankID](https://www.bankid.com) client for Rust based on [reqwest](https://github.com/seanmonstar/reqwest).
## Example
This package is uses [Tokio](https://tokio.rs). Add `bankid` to your `Cargo.toml` dependencies.
```toml
[dependencies]
bankid = { version = "0.1.0" }
```
```rust
use bankid::{
Client, Endpoint, PersonalNumber,
request::{AuthRequest}
};
use std::net::{IpAddr, Ipv4Addr};
#[tokio::main]
async fn main() -> Result<(), Box> {
let client = Client::new(Endpoint::Test);
let auth_response = client.auth(AuthRequest {
end_user_ip: IpAddr::V4(Ipv4Addr::LOCALHOST),
personal_number: Some(PersonalNumber::parse("198710105080")?),
requirement: None
}).await?;
let collect_response = client.collect(auth_response.order_ref).await?;
client.cancel(auth_response.order_ref).await?;
Ok(())
}
```