4 releases
0.3.4 | Apr 4, 2021 |
---|---|
0.3.3 | Mar 25, 2021 |
0.2.6 |
|
0.1.0 |
|
#1504 in Development tools
37 downloads per month
28KB
708 lines
onepassword-cli
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
- Find on crates.io
- Use cargo-edit
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())
Dependencies
~4–13MB
~148K SLoC