Skip to content

Class swarmauri_core.cipher_suites.ICipherSuite.ICipherSuite

swarmauri_core.cipher_suites.ICipherSuite.ICipherSuite

Bases: ABC

Resolution and policy contract for cipher suite descriptors.

suite_id abstractmethod

suite_id()

Return the stable identifier for the suite.

Source code in swarmauri_core/cipher_suites/ICipherSuite.py
19
20
21
@abstractmethod
def suite_id(self) -> str:
    """Return the stable identifier for the suite."""

supports abstractmethod

supports()

Return the allow-list of algorithms grouped by operation.

Source code in swarmauri_core/cipher_suites/ICipherSuite.py
23
24
25
@abstractmethod
def supports(self) -> Mapping[CipherOp, Iterable[Alg]]:
    """Return the allow-list of algorithms grouped by operation."""

default_alg abstractmethod

default_alg(op, *, for_key=None)

Return the default algorithm for op under the current policy.

Source code in swarmauri_core/cipher_suites/ICipherSuite.py
27
28
29
@abstractmethod
def default_alg(self, op: CipherOp, *, for_key: Optional[KeyRef] = None) -> Alg:
    """Return the default algorithm for ``op`` under the current policy."""

normalize abstractmethod

normalize(
    *, op, alg=None, key=None, params=None, dialect=None
)

Return a normalized descriptor for the requested operation.

Source code in swarmauri_core/cipher_suites/ICipherSuite.py
31
32
33
34
35
36
37
38
39
40
41
@abstractmethod
def normalize(
    self,
    *,
    op: CipherOp,
    alg: Optional[Alg] = None,
    key: Optional[KeyRef] = None,
    params: Optional[ParamMapping] = None,
    dialect: Optional[str] = None,
) -> NormalizedDescriptor:
    """Return a normalized descriptor for the requested operation."""

policy abstractmethod

policy()

Return the effective policy toggles for the suite.

Source code in swarmauri_core/cipher_suites/ICipherSuite.py
43
44
45
@abstractmethod
def policy(self) -> Mapping[str, Any]:
    """Return the effective policy toggles for the suite."""

features abstractmethod

features()

Return descriptive metadata describing the suite capabilities.

Source code in swarmauri_core/cipher_suites/ICipherSuite.py
47
48
49
@abstractmethod
def features(self) -> Features:
    """Return descriptive metadata describing the suite capabilities."""

lint

lint()

Return linter warnings about misconfiguration or policy conflicts.

Source code in swarmauri_core/cipher_suites/ICipherSuite.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def lint(self) -> Sequence[str]:
    """Return linter warnings about misconfiguration or policy conflicts."""

    issues: list[str] = []
    supported = self.supports()
    for op, allowed in supported.items():
        try:
            default = self.default_alg(op)
        except Exception as exc:  # pragma: no cover - defensive path
            issues.append(f"default_alg({op}) raised: {exc!r}")
            continue

        if default not in set(allowed):
            issues.append(
                f"default_alg({op})={default} not in supports()[{op}]",
            )
    return issues