Add nostr backup constants and manifest models

This commit is contained in:
thePR0M3TH3AN
2025-07-02 15:49:02 -04:00
parent c7e50f2990
commit 81552d5a0e
2 changed files with 42 additions and 1 deletions

View File

@@ -5,9 +5,24 @@
from importlib import import_module
import logging
from .backup_models import (
KIND_MANIFEST,
KIND_SNAPSHOT_CHUNK,
KIND_DELTA,
Manifest,
ChunkMeta,
)
logger = logging.getLogger(__name__)
__all__ = ["NostrClient"]
__all__ = [
"NostrClient",
"KIND_MANIFEST",
"KIND_SNAPSHOT_CHUNK",
"KIND_DELTA",
"Manifest",
"ChunkMeta",
]
def __getattr__(name: str):

View File

@@ -0,0 +1,26 @@
from dataclasses import dataclass
from typing import List, Optional
# Event kind constants used for SeedPass backups
KIND_MANIFEST = 30070
KIND_SNAPSHOT_CHUNK = 30071
KIND_DELTA = 30072
@dataclass
class ChunkMeta:
"""Metadata for an individual snapshot chunk."""
id: str
size: int
hash: str
@dataclass
class Manifest:
"""Structure of the backup manifest JSON."""
ver: int
algo: str
chunks: List[ChunkMeta]
delta_since: Optional[str] = None