oc_chat
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# oc_chat/registry/auth/__init__.py
4
5# OCT-LINT: disable=tests_exist reason="Covered by oc_chat/tests/registry/test_auth_*.py"
6"""
7Registry actor-auth public surface.
8
9Purpose
10-------
11Expose the M11.5 actor-auth helpers from one stable package import.
12
13Responsibilities
14----------------
15- Re-export signing and verification helpers.
16- Re-export secret-file helpers used by CLI and doctor flows.
17- Re-export role, rotation, handover, and auth-event primitives.
18
19Diagnostics
20-----------
21Domain: OC_CHAT.MAIN
22Levels:
23 L2 - lifecycle events
24 L3 - semantic details
25 L4 - deep tracing
26
27Contracts
28---------
29- Secret material remains inside explicit secret-store/signing APIs.
30- Registry writes still go through ``Registry.execute_domain_command``.
31
32Dependencies
33------------
34- oc_chat.registry.auth.signing (not imported; loaded by name on first access to re-export HmacProof, sign_command and verify_hmac)
35- oc_chat.registry.auth.secrets_store (not imported; loaded by name on first access to re-export SecretBlock, fingerprint_secret, load_secrets and write_secrets)
36- oc_chat.registry.auth.bootstrap (not imported; loaded by name on first access to re-export bootstrap_machine and export_bundle)
37- oc_chat.registry.auth.roles (not imported; loaded by name on first access to re-export RoleGuard)
38- oc_chat.registry.auth.rotation (not imported; loaded by name on first access to re-export rotate_secret and finalize_rotation)
39- oc_chat.registry.auth.handover (not imported; loaded by name on first access to re-export initiate_handover and accept_handover)
40- oc_chat.registry.auth.events_writer (not imported; loaded by name on first access to re-export AuthEventsWriter)
41- oc_diagnostics (structured debug logging via _dbg)
42"""
43from __future__ import annotations
44
45from oc_diagnostics import _dbg
46
47
48_dbg("OC_CHAT.MAIN", "module", "loaded", 4)
49
50__all__ = [
51 "AuthEventsWriter",
52 "HmacProof",
53 "RoleGuard",
54 "SecretBlock",
55 "accept_handover",
56 "bootstrap_machine",
57 "export_bundle",
58 "finalize_rotation",
59 "fingerprint_secret",
60 "initiate_handover",
61 "load_secrets",
62 "rotate_secret",
63 "sign_command",
64 "verify_hmac",
65 "write_secrets",
66]
67
68_EXPORTS = {
69 "AuthEventsWriter": ("oc_chat.registry.auth.events_writer", "AuthEventsWriter"),
70 "HmacProof": ("oc_chat.registry.auth.signing", "HmacProof"),
71 "RoleGuard": ("oc_chat.registry.auth.roles", "RoleGuard"),
72 "SecretBlock": ("oc_chat.registry.auth.secrets_store", "SecretBlock"),
73 "accept_handover": ("oc_chat.registry.auth.handover", "accept_handover"),
74 "bootstrap_machine": ("oc_chat.registry.auth.bootstrap", "bootstrap_machine"),
75 "export_bundle": ("oc_chat.registry.auth.bootstrap", "export_bundle"),
76 "finalize_rotation": ("oc_chat.registry.auth.rotation", "finalize_rotation"),
77 "fingerprint_secret": ("oc_chat.registry.auth.secrets_store", "fingerprint_secret"),
78 "initiate_handover": ("oc_chat.registry.auth.handover", "initiate_handover"),
79 "load_secrets": ("oc_chat.registry.auth.secrets_store", "load_secrets"),
80 "rotate_secret": ("oc_chat.registry.auth.rotation", "rotate_secret"),
81 "sign_command": ("oc_chat.registry.auth.signing", "sign_command"),
82 "verify_hmac": ("oc_chat.registry.auth.signing", "verify_hmac"),
83 "write_secrets": ("oc_chat.registry.auth.secrets_store", "write_secrets"),
84}
85
86
87def __getattr__(name: str) -> object:
88 if name not in _EXPORTS:
89 raise AttributeError(name)
90 module_name, attr_name = _EXPORTS[name]
91 from importlib import import_module
92
93 module = import_module(module_name)
94 value = getattr(module, attr_name)
95 globals()[name] = value
96 return value
object __getattr__(str name)
Definition __init__.py:87