Skip to content

Commit

Permalink
Prepare for v0.2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
apognu committed Apr 2, 2019
1 parent 935a127 commit 9968282
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ As a library, you can add this stanza to your `Cargo.yaml`:

```
[dependencies]
libknox = "^0.1.1"
libknox = "^0.2.0"
```

## Create the vault
Expand Down
4 changes: 2 additions & 2 deletions knox/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "knox"
version = "0.1.3"
version = "0.2.0"
description = "structured secret vault encrypted through GPG"
authors = ["Antoine POPINEAU <antoine.popineau@appscho.com>"]
repository = "https://github.com/apognu/knox"
Expand All @@ -18,7 +18,7 @@ path = "src/main.rs"
knox_testing = { path = "../knox-testing" }

[dependencies]
libknox = { version = "^0.1", path = "../libknox" }
libknox = { version = "^0.2", path = "../libknox" }
log = "^0.4"
pretty_env_logger = "^0.2"
clap = { version = "^2.0", features = ["yaml"] }
Expand Down
2 changes: 1 addition & 1 deletion libknox/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libknox"
version = "0.1.1"
version = "0.2.0"
description = "secret vault encrypted with GPG"
authors = ["Antoine POPINEAU <antoine.popineau@appscho.com>"]
repository = "https://github.com/apognu/knox"
Expand Down
44 changes: 44 additions & 0 deletions libknox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# libknox

`libknox` is the library behing the [knox](https://crates.io/crates/knox) secret manager.

You can refer to the [repository](https://github.com/apognu/knox) or the [documentation](https://docs.rs/libknox/) for usage information.

## Example

```
use libknox::*;
fn main() {
// Create a new vault with the given GPG identity
let id = vec!["vault-test@apognu.github.com".to_string()];
let mut vault = VaultContext::create("/tmp/knox-example", &id).expect("FAIL");
// Create a new entry with three attributes
let mut entry = Entry::new();
entry.add_attribute("username", "bob");
entry.add_confidential_attribute("password", "foobar");
entry.add_confidential_attribute(
"apikey",
"3OJL07P+W5zODH2J1Wv7rXh5i9UpR0mpvPW7ygIMih82J8P95krJZXyERqbi/XS",
);
// Write the entry and the metadata pointing to it
vault
.write_entry("personal/website.com", &entry)
.expect("FAIL");
// Open the previously created vault and read the written entry
let vault = VaultContext::open("/tmp/knox-example").expect("FAIL");
let entry = vault.read_entry("personal/website.com").expect("FAIL");
// Loop over the attributes and print them
for (key, attribute) in entry.get_attributes() {
if attribute.confidential {
println!("{} = {} (CONFIDENTIAL)", key, attribute.value);
} else {
println!("{} = {}", key, attribute.value);
}
}
}
```

0 comments on commit 9968282

Please sign in to comment.