Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Quick start

This page gets you from an installed binary to a working vault and an encrypted file. For the full command set, see the CLI reference.

Encrypt a single file

$ keres encrypt report.pdf
Encrypted to: 7d3a9c1e...f04.krs

Without an output argument, the CLI writes a hash-derived .krs name in the current directory. The original filename is encrypted inside the container, not stored on disk.

Decrypt it:

$ keres decrypt 7d3a9c1e...f04.krs report.pdf
Decrypted 'report.pdf' to: report.pdf

decrypt refuses to overwrite an existing destination unless you pass --force.

Create and use a vault

$ keres init personal
Vault 'personal' created at /home/you/.keres/vaults/personal

$ keres add personal ./photos --name photos
Added successfully!

$ keres add personal ./notes.txt
Added successfully!

$ keres list personal
NAME                                              SIZE TYPE
------------------------------------------------------------
notes.txt                                          4.2 KB file
photos                                                  - dir

$ keres extract personal photos ./restored
Extracted to: ./restored

$ keres verify personal
Vault integrity check:
  Entries total:   42
  Entries verified: 42
  Status: OK — all files present and authenticated

Vaults store both files and directory trees. list shows top-level entries; children are addressed by their full parent/child path in commands that take an entry name.

Change the password

$ keres change-password personal
Current password:
New password:
Confirm new password:
Password changed successfully!

This re-wraps the vault’s master key. Stored ciphertext is not rewritten. To change the data key itself, use keres rotate; see Recovery, rotation, and migration.

Use the library

#![allow(unused)]
fn main() {
use keres::{decrypt_file, encrypt_file, Vault};
use std::path::Path;

let container = encrypt_file("correct horse", Path::new("report.pdf"), None)?;
let name = decrypt_file("correct horse", &container, Path::new("report.pdf"))?;
assert_eq!(name, "report.pdf");

let mut vault = Vault::new("personal".into());
vault.init("correct horse")?;
vault.add(Path::new("photos"), Some("photos"))?;

// Bytes already in memory can be stored and read without temp files.
let note = b"a note from the application";
vault.add_from_reader("notes.txt", &note[..], Some(note.len() as u64))?;
let mut restored = Vec::new();
vault.extract_to_writer("notes.txt", &mut restored)?;
assert_eq!(restored, note);

vault.extract("photos", Path::new("./restored"))?;
vault.lock();
Ok::<(), keres::Error>(())
}

Vault::init leaves the vault unlocked. For an existing vault, call vault.unlock(password) before operations, and vault.lock() when finished.

Where to go next