You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RSA-PSS / MGF1 / SHA256 config allocated per signature instead of module-level constants #345
Every call to KalshiAuth.sign_request constructs four stateless cryptography configuration objects: a fresh hashes.SHA256() inside MGF1, a fresh padding.MGF1(...), a fresh padding.PSS(...), and a second hashes.SHA256() passed as the algorithm parameter. These are pure immutable algorithm descriptors — a well-known idiom is to hoist them to module-level constants for high-RPS code.
The per-call cost is small (~Python-object allocation + GC churn) versus the ~1–3 ms RSA-PSS sign, but it is paid on every REST request and every WS reconnect, and scripts/bench_request_hot_path.py is set up to measure exactly that kind of SDK overhead.
The cryptography library treats PSS/MGF1/SHA256 instances as configuration values and explicitly supports reuse across operations. Extend scripts/bench_sign_offload.py (or bench_request_hot_path.py) to lock in the per-sign throughput delta.
Activity
fix(auth): sign_request strips URL fragment + PSS config module-cache (…