Skip to main content

token_fingerprint

Token fingerprint for safe logging (no token value).

Module

Functions

token_fingerprint

def token_fingerprint(token: str | None)> str:

Short fingerprint of a token for log correlation without exposing it.

Returns the first 8 hex chars of SHA-256 of the token, or "none" if token is None or empty. Use when logging EHR/OAuth token usage (e.g. on request issue or when a new token is received).