oc_chat
Loading...
Searching...
No Matches
oc_chat.registry.auth.bootstrap Namespace Reference

Classes

class  BundleResult

Functions

BundleResult export_bundle (object registry, *, str|Path out, str|Path secrets_path, str|None slot=None, str|None encrypt_command=None)
BundleResult bootstrap_machine (object registry, *, str|Path bundle_path, str|Path secrets_path, str|None decrypt_command=None)
str _registry_id (object registry)
SecretBlock|None _block_from_json (str slot, str phase, dict[str, object] value)

Variables

int BUNDLE_VERSION = 1

Detailed Description

Actor secret export and machine bootstrap helpers.

Purpose
-------
Move local actor HMAC secret blocks between machines without storing raw
secrets in the registry database.

Responsibilities
----------------
- Export selected ``agent_secrets.json`` blocks into a JSON bundle.
- Verify the bundle registry id before bootstrap.
- Install bundle blocks idempotently into the local secrets file.

Diagnostics
-----------
Domain: OC_CHAT.MAIN
Levels:
    L2 - lifecycle events
    L3 - semantic details
    L4 - deep tracing

Contracts
---------
- Bundle JSON may contain secret material and is written with 0600 mode.
- Registry id mismatches abort before local secrets are changed.
- Encryption command hooks are deferred; callers get an explicit error.

Dependencies
------------
- json (read and write the bundle file)
- pathlib (bundle and secrets file paths)
- oc_chat.registry.auth.secrets_store (load, build and write the local secret blocks)
- oc_diagnostics (structured debug logging via _dbg)

Function Documentation

◆ _block_from_json()

SecretBlock | None oc_chat.registry.auth.bootstrap._block_from_json ( str slot,
str phase,
dict[str, object] value )
protected

Definition at line 155 of file bootstrap.py.

Here is the caller graph for this function:

◆ _registry_id()

str oc_chat.registry.auth.bootstrap._registry_id ( object registry)
protected

Definition at line 145 of file bootstrap.py.

Here is the caller graph for this function:

◆ bootstrap_machine()

BundleResult oc_chat.registry.auth.bootstrap.bootstrap_machine ( object registry,
* ,
str | Path bundle_path,
str | Path secrets_path,
str | None decrypt_command = None )
Install secret blocks from a JSON bundle.

Definition at line 104 of file bootstrap.py.

Here is the call graph for this function:

◆ export_bundle()

BundleResult oc_chat.registry.auth.bootstrap.export_bundle ( object registry,
* ,
str | Path out,
str | Path secrets_path,
str | None slot = None,
str | None encrypt_command = None )
Write a JSON bundle of local secret blocks.

Definition at line 65 of file bootstrap.py.

Here is the call graph for this function:

Variable Documentation

◆ BUNDLE_VERSION

int oc_chat.registry.auth.bootstrap.BUNDLE_VERSION = 1

Definition at line 54 of file bootstrap.py.