Skip to main content

Crate cyphr_storage

Crate cyphr_storage 

Source
Expand description

§Cyphr Storage

Storage backends for the Cyphr identity protocol.

This crate provides a backend-agnostic storage API for persisting Cyphr principals, cozies, and actions. The core Store trait defines the minimal interface that any storage backend must implement.

§Design Principles

  • Storage is dumb: The storage layer only handles bytes. All semantic operations (verification, state computation) are handled by cyphr.
  • Immutable history: Entries are append-only; past entries are never modified.
  • Order via pre chain: Canonical order is derived from coz pre field chaining, not storage order.
  • Bit-perfect preservation: Entries store original JSON bytes to ensure correct czd computation. See Entry for details.

§Included Backends

  • FileStore: File-based storage using JSONL format (one file per principal).

Structs§

Checkpoint
Trusted checkpoint for partial replay.
CommitEntry
A stored commit bundle for the commit-based JSONL format.
Entry
A stored entry preserving bit-perfect JSON bytes.
FileStore
File-based storage backend.
KeyEntry
Key material for a commit (SPEC §6).
QueryOpts
Query options for filtered retrieval.

Enums§

EntryError
Errors that can occur when working with entries.
ExportError
Errors that can occur during export.
FileStoreError
Errors from the file-based storage backend.
Genesis
How the principal was created (genesis mode).
LoadError
Errors that can occur during import.
PersistError
Errors from persist_entries (combines export and store errors).

Traits§

Store
Storage backend trait.

Functions§

export_commits
Export commits from a Principal for commit-based storage.
export_entries
Export all entries from a Principal for storage (legacy flat format).
load_from_checkpoint
Load a principal from a trusted checkpoint.
load_principal
Load a principal by replaying entries from genesis.
load_principal_from_commits
Load a principal by replaying commit bundles from genesis.
persist_entries
Export entries and persist them to storage.