Crates.io | runkr |
lib.rs | runkr |
version | 1.0.0 |
source | src |
created_at | 2019-10-07 10:05:26.803361 |
updated_at | 2019-11-08 12:11:59.721504 |
description | A Rust Bunkr client |
homepage | https://github.com/danielsanchezq/runkr |
repository | https://github.com/danielsanchezq/runkr |
max_upload_size | |
id | 170545 |
size | 41,733 |
Runkr is a Rust Bunkr client. You can find all the Bunkr related information here
Notice that you need to have a Bunkr daemon running:
Run your bunkr as a daemon with :
bunkr -D
Add the dependency to your Cargo.toml
[dependencies]
runkr = { version = "0.1.*"}
The Runkr object API is really simple, you need to provide the socket address where the Bunkr daemon is listening, and then use each of the available methods to communicate with your Bunkr:
extern crate runkr;
use runkr::{Runkr, AccessMode};
fn main() {
let mut runkr = Runkr::new("/tmp/bunkr_daemon.sock");
// Test basic creat/access/delete operation
runkr.new_text_secret("mySecret", "My secret content");
let secret_content = runkr.access("mySecret", AccessMode::Text, None).unwrap();
println!("{:?}", secret_content["content"].as_str());
let del_res = runkr.delete("mySecret");
match del_res {
Ok(_) => println!("Operation success"),
Err(e) => println!("Error executing operation {}", e)
};
// Test groups and granting
runkr.new_group("ga").unwrap();
runkr.new_group("gb").unwrap();
runkr.new_group("gc").unwrap();
runkr.grant("ga", "gb", false).unwrap();
runkr.grant("gb", "gc", false).unwrap();
// Test rename and revoke
runkr.rename("ga", "gA").unwrap();
runkr.rename("gA", "ga").unwrap();
runkr.revoke("ga", "gb").unwrap();
runkr.revoke("gb", "gc").unwrap();
for &n in ["ga", "gb", "gc"].iter() {
runkr.delete(n).unwrap();
}
// Test ssh
runkr.new_ssh_key("test_ssh_key").unwrap();
let sign_res = runkr.sign_ecdsa("test_ssh_key", "Zm9v").unwrap();
println!("Signature, R: {}, S: {}", sign_res["r"], sign_res["s"]);
let ssh_public = runkr.ssh_public_data("test_ssh_key").unwrap();
println!("b64 public key: {}", ssh_public["public_data"]["public_key"]);
runkr.delete("test_ssh_key");
// Test send device
let device_result = runkr.send_device(None).unwrap();
println!("My device link: {}", device_result["url_raw"]);
}
The Bunkr operations currently supported by this client: