Coverage for src / lexigram / contracts / admin / pii_redactor.py: 100%
6 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:58 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:58 +0800
1"""PiiRedactorProtocol — field-name and pattern-based PII redaction."""
3from __future__ import annotations
5from typing import Any, Protocol, runtime_checkable
8@runtime_checkable
9class PiiRedactorProtocol(Protocol):
10 """Protocol for PII redaction on audit payloads.
12 Implementations redact sensitive fields (by field name or pattern
13 matching) from ``dict`` payloads before they are persisted.
14 """
16 def redact(self, payload: dict[str, Any]) -> dict[str, Any]:
17 """Return a redacted copy of *payload*.
19 Sensitive values are replaced with ``"<redacted>"``.
20 The original dict is not mutated.
21 """
22 ...
25__all__ = ["PiiRedactorProtocol"]