build(agent): molt-y#23e5c8 iteration

This commit is contained in:
agent-23e5c897f40fd19e 2026-04-16 22:32:51 +02:00
parent 0fe08f9698
commit fe6d2263e5
2 changed files with 34 additions and 2 deletions

View File

@ -10,6 +10,12 @@ Whats included in this MVP:
- Secure Transport: basic channel abstraction with key rotation stubs.
- Tamper-Evident Governance Ledger: append-only log with signatures and optional public anchoring (simulated).
- Delta-Sync: state reconciliation with proof checks.
- EnergiBridge: canonical, vendor-agnostic bridge mapping GridGuard primitives to a CatOpt-inspired representation (Objects, Morphisms, PlanDelta). Enables cross-vendor interoperability.
- Graph-of-Contracts registry: versioned schemas for adapters and data models; replay protection and auditability.
- Attestation enhancements: DID-based identities and hardware-backed attestation binding to contract permissions.
- Privacy-by-design primitives: secure aggregation and pluggable zero-knowledge proof stubs for verifiable compliance.
- Post-quantum readiness: crypto-hygiene considerations and key rotation strategies.
- Tamper-evident governance ledger: anchoring options to public ledgers for cross-organization auditability.
- Adapters Marketplace: registry for pre-vetted adapters and their metadata.
- Simulation Harness: lightweight digital twin scaffolding for validation.

View File

@ -1,17 +1,43 @@
from typing import Any, Dict
from typing import Any, Dict, List
class SecurityContractsRegistry:
"""Simple in-memory security contracts registry.
Stores versioned contracts that describe data-exposure rules and attestation policies.
This registry now also exposes convenient helpers to enumerate available
contract versions and to retrieve the full contracts map. Each registered
contract is annotated with its version for easier auditing and replay
protection in downstream components.
"""
def __init__(self) -> None:
# Mapping: version -> contract dictionary (augmented with version field)
self._contracts: Dict[str, Dict[str, Any]] = {}
def register_contract(self, version: str, contract: Dict[str, Any]) -> None:
self._contracts[version] = contract
"""Register or update a contract for a given version.
- Validates input type to be a mapping.
- Normalizes the contract by injecting the version into the payload
to make auditing easier and to support downstream verification.
"""
if not isinstance(contract, dict):
raise TypeError("contract must be a dict")
contract_copy = dict(contract)
contract_copy["version"] = version
self._contracts[version] = contract_copy
def get_contract(self, version: str) -> Dict[str, Any]:
"""Return the contract for the given version or an empty dict if missing."""
return self._contracts.get(version, {})
# Convenience API: introspection helpers
def list_versions(self) -> List[str]:
"""Return a list of all registered contract versions, in insertion order."""
return list(self._contracts.keys())
def get_all_contracts(self) -> Dict[str, Dict[str, Any]]:
"""Return a shallow copy of all registered contracts."""
return dict(self._contracts)