Struct
Filesystem
pub struct Filesystem { /* private fields */ }Filesystem capability configuration of named scopes and the grants that bind origins to them.
use kurogane::Origin;
use kurogane::capability::{Filesystem, FsAccess};
let mut builder = Filesystem::builder();
let notes = builder.scope("notes", |scope| {
scope.allow_directory_recursive("/path/to/notes");
scope.deny_path("/path/to/notes/secrets");
scope.deny_glob("**/.git");
});
builder.grant(Origin::parse("app://app")?, notes, FsAccess::READ | FsAccess::LIST);
let fs = builder.build()?;
Associated constants
#const DEFAULT_MAX_FILE_SIZE: u64 = _
Default of FilesystemBuilder::max_file_size (64 MiB).
Methods
#pub fn builder() -> FilesystemBuilder
#pub fn authorize(&self, origin: &Origin) -> Option<AuthorizedFs<'_>>
Mints the typed authority for origin, or None when it holds no
grant. This is the only origin-dependent decision in the layer.