Crate zbox[][src]

Expand description

ZboxFS is a zero-details, privacy-focused in-app file system.

It keeps your app files securely, privately and reliably on underlying storages. By encapsulating files and directories into an encrypted repository, it provides a virtual file system and exclusive access to the authorised application.

The most core parts of this module are Repo and File, which provides most API for file system operations and file data I/O.

init_env initialises the environment and should be called once before any other methods provided by ZboxFS.

After repository is opened by RepoOpener, all of the other functions provided by ZboxFS will be thread-safe.


Create and open a Repo using memory as underlying storage.

use zbox::{init_env, RepoOpener};

// initialise zbox environment, called first

// create and open a repository
let mut repo = RepoOpener::new()
    .open("mem://my_repo", "your password")

File content IO using Read and Write traits.

use std::io::prelude::*;
use std::io::{Seek, SeekFrom};
use zbox::OpenOptions;

// create and open a file for writing
let mut file = OpenOptions::new()
    .open(&mut repo, "/my_file.txt")

// use std::io::Write trait to write data into it
file.write_all(b"Hello, world!").unwrap();

// finish writting to make a permanent content version

// read file content using std::io::Read trait
let mut content = String::new();;
file.read_to_string(&mut content).unwrap();
assert_eq!(content, "Hello, world!");

Directory navigation can use Path and PathBuf. The path separator should always be “/”, even on Windows.

use std::path::Path;

let path = Path::new("/foo/bar");


Entries returned by the read_dir function.

Unique entity ID.

A reference to an opened file in the repository.

Metadata information about a file or a directory.

Options and flags which can be used to configure how a file is opened.

An encrypted repository contains the whole file system.

Information about a repository.

A builder used to create a repository Repo in various manners.

A representation of a permanent file content.

A reader for a specific vesion of file content.


Crypto cipher primitives.

The error type for operations with Repo and File.

A structure representing a type of file with accessors for each file type.

Password hash memory limit.

Password hash operation limit.


Initialise ZboxFS environment.

Get ZboxFS library version string.

Type Definitions

A specialized Result type for ZboxFS operations.