Skip to main content

Local-first immutable document vault engine for the Hearth ecosystem

Project description

Vaultkeep

Vaultkeep is a local-first immutable document vault engine for the Hearth ecosystem. It provides infrastructure for storing files, indexing metadata, verifying integrity, and versioning documents without UI, cloud storage, authentication, or business logic.

Vaultkeep integrates with Ember records via linked_record_id references. It does not depend on Ember internals.

Philosophy

Documents are immutable. Vaultkeep never overwrites stored files. When content changes, a new version is created and linked to its parent. Every document carries metadata and a SHA-256 checksum. The filesystem layer is abstracted behind a pluggable backend; encryption is hook-based and optional.

Vaultkeep is infrastructure: reusable, modular, and oriented toward embedding in higher-level applications.

Responsibilities

Concern Module
Local file storage storage/
Metadata index (SQLite) metadata/
SHA-256 integrity integrity/
Immutable versioning versioning/
Encryption hooks hooks/
HTTP retrieval API api/

Storage Layout

vault/
  documents/
    {circle_id}/
      {linked_record_id}/
        {document_id}/
          filename.ext
  metadata.db          # SQLite index (default path)

Metadata Fields

Each indexed document includes:

  • document_id, original_filename, mime_type, file_size
  • checksum_sha256
  • linked_record_id, circle_id
  • version, parent_document_id
  • storage_path, created_at

Requirements

  • Python 3.12+
  • uv (recommended)

Installation

uv sync --all-extras

Usage

Programmatic ingestion

from pathlib import Path
from vaultkeep import VaultConfig, VaultService
from vaultkeep.schemas.document import DocumentCreate

service = VaultService(VaultConfig())
result = service.ingest_file(
    Path("contract.pdf"),
    DocumentCreate(
        linked_record_id="ember-record-uuid",
        circle_id="circle-uuid",
        original_filename="contract.pdf",
    ),
)
print(result.document.document_id)

HTTP API

uv run vaultkeep
# or
uv run python examples/run_api.py
Method Path Description
POST /api/v1/documents/upload Ingest file (linked_record_id, circle_id form fields)
GET /api/v1/documents/{document_id} Metadata
GET /api/v1/documents/{document_id}/content File bytes (checksum verified)
GET /api/v1/documents/linked/{linked_record_id} List by Ember record
POST /api/v1/documents/versions New immutable version

Configuration

Environment variables (prefix VAULTKEEP_):

Variable Default
VAULTKEEP_VAULT_ROOT vault
VAULTKEEP_DATABASE_URL sqlite:///vault/metadata.db
VAULTKEEP_LOG_LEVEL INFO

Encryption Hooks

Encryption is not implemented by default. Register a custom hook:

from vaultkeep.hooks.encryption import EncryptionHook, set_encryption_hook

class MyEncryption(EncryptionHook):
    def encrypt(self, source, *, document_id: str) -> bytes: ...
    def decrypt(self, data: bytes, *, document_id: str) -> bytes: ...

set_encryption_hook(MyEncryption())

Entry points: encrypt_document() and decrypt_document().

Testing

uv run pytest

Project Layout

src/vaultkeep/
  storage/      # Filesystem backends
  metadata/     # SQLAlchemy repository
  integrity/    # Checksums, duplicates, corruption detection
  versioning/   # Version lineage
  hooks/        # Pluggable encryption
  models/       # ORM models
  schemas/      # Pydantic v2 models
  api/          # FastAPI routes
  utils/        # Logging, ID generation
tests/
examples/
docs/
vault/          # Runtime data directory

Design Constraints

Vaultkeep intentionally excludes:

  • User authentication and authorization
  • Cloud object storage providers
  • Frontend/UI components
  • OCR, AI, or realtime sync
  • Direct Ember package dependencies

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vaultkeep-0.1.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vaultkeep-0.1.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file vaultkeep-0.1.0.tar.gz.

File metadata

  • Download URL: vaultkeep-0.1.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for vaultkeep-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56f83ef666b05326d05e00ccc64561f0f2f8177af1883f04610eb020c30ed61c
MD5 ca8350cba08660634b33e2528b71298d
BLAKE2b-256 b013ca169a2697a8162d38dd4236801dfc94b72a5a7003c1be6fb20399eb3d8d

See more details on using hashes here.

File details

Details for the file vaultkeep-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vaultkeep-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for vaultkeep-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b82f9aef7a9a0a1a8998bccaaf22477fbe447e66d1522b5441c25e5bf11e0316
MD5 34deb6a19bd4ece5a4963d593d7f4ee5
BLAKE2b-256 6b2a069bd4a42b24716dbb18e338988e547a8160b560050adeabaf64409e1ba4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page