onepassword-cli

Crates.ioonepassword-cli
lib.rsonepassword-cli
version0.3.4
sourcesrc
created_at2021-03-13 13:58:37.900954
updated_at2021-04-04 10:28:57.883255
descriptiona wrapper for 1password-cli, which focus on easy-to-use
homepage
repositoryhttps://github.com/sinyo-matu/onepassword-cli
max_upload_size
id368295
size39,098
Yang Qin (sinyo-matu)

documentation

README

onepassword-cli

crate.io

A wrapper for 1password-cli. It intent to offering a similar usage with the cli, make it easy-to-use. For using this crate, you need to setup 1password-cli first. Please see 1password-cli getting started For now, only part of the cli utility have been implemented

  • get
    • account
    • document
    • item
    • totp (one time password)
    • group
    • user
    • vault
    • template
    • group
  • list
    • documents
    • items
    • events
    • groups
    • templates
    • users
    • vaults
  • create
    • document
    • group
    • item
    • user
    • vault
  • add
    • group
    • user
  • delete
    • document
    • group
    • item
    • trash
    • user
    • vault
  • edit
    • document
    • group
    • item
    • user
    • vault
  • encode
    • encode

Installation

cargo add onepassword-cli

How to use

  • get account info
extern crate dotenv;
extern crate onepassword_cli;
use onepassword_cli::OpCLI;

dotenv::dotenv().unwrap();
let pass = dotenv::var("OP_PASS").unwrap();
let op_cli = OpCLI::new_with_pass("my", &pass)
    .await
    .unwrap();
let account = op_cli.get().account().run().await;
assert!(account.is_ok())
  • get a login item include username password
extern crate dotenv;
extern crate onepassword_cli;
use onepassword_cli::OpCLI;

dotenv::dotenv().unwrap();
let pass = dotenv::var("OP_PASS").unwrap();
let op_cli = OpCLI::new_with_pass("my", &pass).await.unwrap();
let item_lite = op_cli.get().item_lite("facebook").run().await;
assert!(item_lite.is_ok());
println!("{:?}", &item_lite.unwrap().password);
  • create a document
extern crate dotenv;
extern crate onepassword_cli;
use onepassword_cli::OpCLI;

dotenv::dotenv().unwrap();
let pass = dotenv::var("OP_PASS").unwrap();
let op_cli = OpCLI::new_with_pass("my", &pass)
    .await
    .unwrap();
let doc = op_cli.create().document("auth.log").run().await;
assert!(doc.is_ok())
  • get one time password
extern crate dotenv;
extern crate onepassword_cli;
use onepassword_cli::OpCLI;

dotenv::dotenv().unwrap();
let pass = dotenv::var("OP_PASS").unwrap();
let op_cli = OpCLI::new_with_pass("my", &pass)
    .await
    .unwrap();
let otps = op_cli.get().totp("facebook").run().await;
assert!(otps.is_ok())
Commit count: 39

cargo fmt