Crate lesspass_client

source ·
Expand description

lesspass-client is a tiny-crate for interacting with LessPass server API from Rust.

Overview

lesspass-client can interact with several implementations of LessPass server API, it is specially designed to use with Rockpass (a small and ultrasecure Lesspass database server written in Rust) and official ones.

Using the Client

use reqwest::Url;
use lesspass_client::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Define a host URL to conect to
    let host = Url::parse("https://api.lesspass.com").unwrap();

    // Create LessPass API client
    let client = Client::new(host);

    // Perform an authentication with user and password
    let token = client
        .create_token("user@example.com".to_string(), "password".to_string())
        .await?;

    // Get the password list
    let passwords = client.get_passwords(token.access).await?;

    // Print the list
    println!("{:?}", passwords);
    Ok(())
}

For details, see:

  • Client for implementation of LessPass server API client.
  • CLI for a full example of use.

Structs

To perform authentication and create new users
To change the password for a user
Client for connecting to LessPass server
To create a new password entry
To create a new passwords list
A password item in the password list
To store the password list
To perform the token refresh
To store the authentication response