Skip to main content

Crate zarlib

Crate zarlib 

Source
Expand description

Binary framing primitives for the ZAR archive format.

Provides the ZAR wire format, validation primitives, and high-level archive operations. Use operations for public create, add, remove, join, encrypt/decrypt, check, info, list, grep, and extract APIs; the CLI is a presentation layer over them.

Modules§

operations
High-level archive operations used by applications and the zarc CLI. The CLI owns argument parsing and terminal UI; all archival logic is implemented here.

Structs§

ArchivePath
BlockFrame
BlockFrameMetadata
CommitHeader
Commit-level metadata carried in the header frame. Replaces the old CommitPrefix. The header frame is written at the end of each commit, so all sizes are known before encoding.
CommitValidationLimits
ContainerHeader
DescriptorExtension
EntryMetadata
FileEntry
HeaderBlockIndexEntry
A block’s location relative to the start of its commit’s data section.
HeaderFrame
LogicalHeader
LogicalHeaderLimits
PasswordKeyWrap
RecipientKeyWrap
Toc
ValidatedCommit
ValidatedHeader

Enums§

ArchivePathError
ContentAead
DeviceKind
EncryptionDescriptor
EncryptionScope
FileGroupKind
FramingError
HpkeSuite
LogicalHeaderError
MetadataType
TocChange
TocEntry
TocError

Constants§

AEAD_NONCE_SIZE
BLOCK_FLAG_ENCRYPTED
BLOCK_FLAG_NONCE_PRESENT
BLOCK_FLAG_UNCOMPRESSED
Payload is stored as raw, uncompressed block data.
COMMIT_HEADER_FIXED_SIZE
Size of the fixed commit-header fields (magic through header_frame_size). magic[4] + framing_version[1] + flags[1] + commit_id[4] + data_section_size[8] + header_frame_size[4] = 22 bytes.
COMMIT_MAGIC
CONTAINER_HEADER_SIZE
Size of the container header: 4-byte magic + 8-byte first_header_offset.
CONTAINER_MAGIC
DEK_SIZE
FRAMING_VERSION
HEADER_OFFSET_SIZE
Size of the next_header_offset / this_header_offset fields (u64).
MAX_ENCRYPTION_DESCRIPTOR_SIZE
UNENCRYPTED_DESCRIPTOR

Functions§

decrypt_content
Authenticates and decrypts one content payload.
derive_password_key
Derives a wrapping key using Argon2id v1.3 and the supplied bounded parameters.
encrypt_content
Encrypts one independently-nonced compressed content payload.
generate_dek
Generates a cryptographically random 256-bit data-encryption key.
generate_nonce
Generates a cryptographically random nonce for content encryption.
read_container_magic
unwrap_dek_with_password
Recovers and authenticates a password-wrapped DEK.
unwrap_dek_with_password_zeroizing
Recovers a password-wrapped DEK in a buffer that is zeroized on drop.
wrap_dek_with_password
Wraps a per-commit DEK with a password-derived key and fresh random salt/nonce.
write_container_magic