S14: NPE fail-closed adapter; npe mode never falls back to lab-xor
Some checks are pending
ci / python (push) Waiting to run
ci / go (push) Waiting to run

This commit is contained in:
George Lambert 2026-09-15 22:22:56 -04:00
parent d67509e470
commit 9eed0b1942
4 changed files with 112 additions and 2 deletions

View file

@ -75,8 +75,10 @@ def seal(
raise ValueError("lab_key required for lab-xor")
key = hashlib.sha256(lab_key).digest() # 32-byte key
ct = _xor(key, raw).hex() # hex ct
elif mode == "npe": # production — sidecar not in this module
raise NotImplementedError("npe: attach NPE sidecar; do not HPKE here")
elif mode == "npe": # production — sidecar only
from .npe_adapter import seal_npe # fail-closed import
ct = seal_npe(to, body) # never lab-xor here
else: # unknown
raise ValueError("unknown crypto.mode " + mode)
token = hashlib.sha256(nonce + b"error-token").hexdigest()[:32] # return-path token stub