MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / _compute_file_hmac

Function _compute_file_hmac

web/pgadmin/utils/session.py:65–71  ·  view source on GitHub ↗

Compute the hex-encoded HMAC over a session-file body. Flask's SECRET_KEY may be str or bytes; both are accepted.

(secret, body)

Source from the content-addressed store, hash-verified

63
64
65def _compute_file_hmac(secret, body):
66 """Compute the hex-encoded HMAC over a session-file body.
67
68 Flask's SECRET_KEY may be str or bytes; both are accepted.
69 """
70 key = secret.encode() if isinstance(secret, str) else secret
71 return hmac.new(key, body, _FILE_HMAC).hexdigest().encode()
72
73
74# HKDF salt + info for the session-body Fernet key. Both fixed and version-

Callers 2

getMethod · 0.85
putMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected