Source code for sidequest_common.models.vault

 1"""The vault's storage: opaque named byte blobs for the site owner's own tools.
 2
 3The server never decrypts or parses these bytes; it only keeps the latest copy per name along with its sha256,
 4for optimistic concurrency (``If-Match``) and caching (``ETag``/``If-None-Match``).
 5"""
 6
 7from advanced_alchemy.base import UUIDAuditBase
 8from sqlalchemy import Integer, LargeBinary, String, Text
 9from sqlalchemy.orm import Mapped, mapped_column
10
11
[docs] 12class VaultFile(UUIDAuditBase): 13 """One named file in the vault, replaced in full on every write.""" 14 15 __tablename__ = "vault_file" 16 __table_args__ = { 17 "comment": "Private encrypted file storage for the site owner's own tools; the server never reads it.", 18 } 19 20 name: Mapped[str] = mapped_column(Text, unique=True, index=True) 21 data: Mapped[bytes] = mapped_column(LargeBinary) 22 size: Mapped[int] = mapped_column(Integer) 23 sha256: Mapped[str] = mapped_column(String(64))