-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstate.py
More file actions
30 lines (21 loc) · 1 KB
/
Copy pathstate.py
File metadata and controls
30 lines (21 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Runtime state containers used by the Secure QR Code Tool."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Optional, Dict, Any
@dataclass(slots=True)
class AppState:
"""Mutable state shared between UI components."""
master_password: Optional["SecureString"] = None
current_encrypted_payload: Optional[Dict[str, str]] = None
current_encrypted_payload_bytes: Optional[bytes] = None
is_online: bool = False
camera_available: bool = False
qr_available: bool = False
# The SecureString type is defined in ``security`` but importing it at module
# level would pull in the cryptography dependency for consumers that only wish
# to read configuration data. We therefore use a ``TYPE_CHECKING`` guard to
# avoid circular imports while still providing type information for tooling.
from typing import TYPE_CHECKING
if TYPE_CHECKING: # pragma: no cover - imported for static type checking only
from .security import SecureString
__all__ = ["AppState"]