Skip to main content

Crate sefy_core

Crate sefy_core 

Source
Expand description

Core library behind sefy: a personal secret store that lives in one unremarkable file.

A vault is a SQLite database sealed whole with XChaCha20-Poly1305 under a key derived from a master password with Argon2id. The file on disk is salt ‖ nonce ‖ ciphertext — no magic bytes, no header, no extension convention, nothing to mark it as a secret store.

§Threat model

sefy is inconspicuous, not deniable. It hides secrets from a passing glance, a curious file listing and a cloud-side scanner looking for known formats. It does not claim to withstand forensic analysis — a high-entropy headerless file is recognizable as some container to an examiner — nor to protect anyone compelled to give up a password.

§Example

use sefy_core::{ItemKind, NewItem, Payload, Query, Vault};

let mut vault = Vault::create(&path, b"master password")?;
let id = vault.add(
    NewItem::new("bank", Payload::Note { text: "vault code 1234".into() })
        .with_tags(["money"]),
)?;
vault.save()?;

let reopened = Vault::open(&path, b"master password")?;
let found = reopened.search(&Query::all().text("bank").kind(ItemKind::Note))?;
assert_eq!(found[0].id, id);

Re-exports§

pub use audit::Due;
pub use audit::Old;
pub use audit::Place;
pub use audit::Report;
pub use audit::Unreadable;
pub use audit::Weak;
pub use audit::audit;
pub use error::Error;
pub use error::Result;
pub use exchange::EXPORT_VERSION;
pub use exchange::Export;
pub use exchange::ExportField;
pub use exchange::ExportItem;
pub use exchange::ExportReport;
pub use exchange::ExportStamp;
pub use exchange::ExportVersion;
pub use exchange::Exported;
pub use exchange::Format;
pub use exchange::ImportReport;
pub use exchange::Notice;
pub use exchange::Outcome;
pub use exchange::Target;
pub use expiry::Expiry;
pub use format::FORMAT_VERSION;
pub use format::SEALING;
pub use format::Sealing;
pub use generate::Classes;
pub use generate::Generated;
pub use generate::Language;
pub use generate::Recipe;
pub use generate::generate;
pub use history::Change;
pub use history::ChangeKind;
pub use history::Line;
pub use history::Version;
pub use keys::FreshKey;
pub use keys::KeySource;
pub use keys::Opener;
pub use merge::Conflict;
pub use merge::MergeReport;
pub use merge::MergedItem;
pub use merge::Side;
pub use merge::merge;
pub use model::AuditAs;
pub use model::Field;
pub use model::FieldSpec;
pub use model::Item;
pub use model::ItemKind;
pub use model::ItemSummary;
pub use model::LEGACY_LOGIN_NAME;
pub use model::NewItem;
pub use model::Payload;
pub use model::Query;
pub use model::Template;
pub use otp::Totp;
pub use plugin::PROTOCOL_VERSION;
pub use plugin::Plugin;
pub use policy::Policy;
pub use strength::Strength;
pub use strength::estimate;
pub use strength::estimate_generated;
pub use sync::Fetched;
pub use sync::PullReport;
pub use sync::SyncPreview;
pub use sync::SyncReport;
pub use sync::fetch;
pub use sync::pull;
pub use sync::push;
pub use sync::sync;
pub use vault::PasswordChange;
pub use vault::Stats;
pub use vault::Status;
pub use vault::SyncStamp;
pub use vault::Vault;
pub use wipe::Wiped;

Modules§

audit
What in a vault deserves a second look: passwords that are weak, reused or unchanged for years, secrets kept twice, and records past or near the day they stop working.
clipboard
How a secret goes onto the clipboard, and how long it stays there.
copies
Copies of a vault kept beside it before a change brought in from elsewhere.
crypto
Password-based authenticated encryption for the vault blob.
db
The database living inside the encrypted blob.
device
The name of the machine sefy runs on, for the versions it writes.
error
What can go wrong, phrased so that no message carries secret material.
exchange
Moving a vault’s contents in and out: sefy’s own JSON, and the files other password managers and browsers read and write.
expiry
When a record stops working: the expires field.
format
On-disk layout of a vault file.
generate
Generating new secrets: random passwords, pronounceable ones and passphrases.
history
Earlier contents of an item, and what changed between two of them.
keys
Who turns a salt into a key.
merge
Folding one vault into another.
model
What a vault holds: notes, structured records and file attachments, each tagged.
otp
One-time passwords (RFC 6238): the key a site hands over when two-factor sign-in is turned on, and the short code it asks for afterwards.
plugin
Transports that move a vault file between this machine and somewhere else.
policy
How long what a vault lets out stays out: how long it stays unlocked with nobody using it, and how long a copied secret stays on the clipboard.
strength
How hard a password would be to guess, estimated offline with zxcvbn.
sync
Moving a vault between this machine and a remote, through a transport.
time
Calendar arithmetic: Unix seconds to a date and back.
vault
The vault: an encrypted file, its in-memory database, and the operations that move data between them.
wipe
Destroying a vault on purpose: its file, the copies kept beside it, and any write a crash left unfinished.