mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 23:38:49 +00:00
Add nostr backup constants and manifest models
This commit is contained in:
@@ -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):
|
||||
|
26
src/nostr/backup_models.py
Normal file
26
src/nostr/backup_models.py
Normal 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
|
Reference in New Issue
Block a user