feat(gateway): add gateway domain primitives

This commit is contained in:
Anish Sarkar 2026-05-27 23:37:54 +05:30
parent ae3ce91465
commit c9b7d7b572
13 changed files with 481 additions and 0 deletions

View file

@ -0,0 +1,19 @@
"""Gateway identity helpers."""
from __future__ import annotations
import hashlib
def normalize_external_peer_id(value: str | int | None) -> str | None:
if value is None:
return None
return str(value).strip()
def hash_external_id(value: str | int | None) -> str | None:
normalized = normalize_external_peer_id(value)
if not normalized:
return None
return hashlib.sha256(normalized.encode("utf-8")).hexdigest()