Skip to content

Commit

Permalink
Improve docs for encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenperera committed Jul 29, 2024
1 parent b591935 commit 4a554e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ use bip329::{Labels, encryption::EncryptedLabels};

let labels = Labels::try_from_file("tests/data/labels.jsonl").unwrap();
let encrypted = EncryptedLabels::encrypt(&labels, "passphrase").unwrap();
let decrypted: Labels = encrypted.decrypt("passphrase").unwrap();

let encrypted = EncryptedLabels::read_from_file("tests/data/encrypted_labels.age").unwrap();
let decrypted = encrypted.decrypt("passphrase").unwrap();
assert_eq!(labels, decrypted);
```

<!-- cargo-rdme end -->
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
//!
//! let labels = Labels::try_from_file("tests/data/labels.jsonl").unwrap();
//! let encrypted = EncryptedLabels::encrypt(&labels, "passphrase").unwrap();
//! let decrypted: Labels = encrypted.decrypt("passphrase").unwrap();
//!
//! let encrypted = EncryptedLabels::read_from_file("tests/data/encrypted_labels.age").unwrap();
//! let decrypted = encrypted.decrypt("passphrase").unwrap();
//! assert_eq!(labels, decrypted);
//! ```
//!
pub mod error;
Expand Down

0 comments on commit 4a554e2

Please sign in to comment.