2 releases (1 stable)
1.0.0 | Nov 8, 2019 |
---|---|
0.1.0 | Oct 7, 2019 |
#832 in Cryptography
41KB
729 lines
Runkr
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
Installation
Add the dependency to your Cargo.toml
[dependencies]
runkr = { version = "0.1.*"}
Usage
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"]);
}
Available operations
The Bunkr operations currently supported by this client:
- new-text-secret
- new-ssh-key
- new-file-secret
- new-group
- import-ssh-key
- list-secrets
- list-devices
- list-groups
- send-device
- receive-device
- remove-device
- remove-local
- rename
- create
- write
- access
- grant
- revoke
- delete
- receive-capability
- reset-triples
- noop-test
- secret-info
- sign-ecdsa
- ssh-public-data
- signin
- confirm-signin
Dependencies
~1.2–2.2MB
~43K SLoC