3 releases
0.1.8 | Oct 31, 2022 |
---|---|
0.1.7 | Aug 12, 2022 |
0.1.6 | Jul 6, 2022 |
0.1.2 |
|
#462 in HTTP client
25 downloads per month
24KB
352 lines
vigor_agent
Rust client library for Vigor, the JWT-based state-less HTTP authentication server. Implements methods for account management and token retrieval.
Install
Under your Cargo.toml
file, insert the following line into the dependencies
section.
[dependencies]
vigor_agent = "0.1.2"
Upon running cargo build
, the Cargo package for this library and its dependencies will be automatically downloaded and installed.
lib.rs
:
Vigor
This library contains a Vigor authentication agent to manage credentials and perform HTTP/HTTPS requests.
A note regarding Ed25519: this client library supports Ed25519 authentication, however will only accept PEM-encoded keys. Formats such as OpenSSH are not guaranteed to work. The private key is expected to adhere to RFC 7468, PKCS8 and unencrypted.
Minimal format verification is done on private key material. For all intended purposes, assume the library would foolishly accept random noise as a private key. You are responsible for implementing safety checks for inappropriate private keys.
Also keep in mind that this library is purely synchronous, for the purposes of simplicity and a less bloated dependency tree. For use cases where blocking execution is inappropriate and/or inadaquete, it should be noted that synchronous code can be executed asynchronously, however not vice versa. If all else fails, the rhetorical question "have you tried threading" should come to mind.
Usage
Use Vigor::new()
to start an agent instance, after importing.
See documentation for a full list of available methods.
use vigor_agent;
fn main() {
// you're advised to apply error handling here, instead of just recklessly using .unwrap()
let mut agent = vigor_agent::Vigor::new().unwrap();
agent.init().unwrap();
println!(agent.get("http://example.com/claims/", vigor_agent::AuthMode::Auto).unwrap());
}
Dependencies
~12MB
~266K SLoC