getlocksmith 1.2.3

Official async Rust client for the Locksmith public authentication API (JWT, OAuth, magic links).
Documentation

getlocksmith

Official Rust client for the Locksmith public auth API (async, reqwest).

Crate: getlocksmith (the name locksmith is already taken on crates.io).

Install

Add to Cargo.toml:

getlocksmith = "0.1"

Requirements

  • Rust 1.70+ (edition 2021)
  • API key prefix lsm_live_ or lsm_sbx_.

Quick start

use getlocksmith::LocksmithClient;

#[tokio::main]
async fn main() -> Result<(), getlocksmith::Error> {
    let c = LocksmithClient::new(std::env::var("LOCKSMITH_API_KEY").unwrap(), None)?;
    let r = c.sign_in("user@example.com", "secret-here").await?;
    println!("{}", r.user.base.email);
    Ok(())
}

Local JWT verification

let payload = LocksmithClient::verify_token(&access_token, public_key_pem)?;

License

MIT