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
Auth: support passphrase-protected PEMs (currently forces plaintext key on disk) #217
KalshiAuth.from_pem calls serialization.load_pem_private_key(pem_data, password=None) and translates the resulting TypeError into an error that instructs users to run:
openssl pkey -in key.pem -out key_nopass.pem
The SDK has no API to supply a passphrase. Users whose RSA private key is encrypted at rest (a common, recommended practice for trading keys) are pushed to write a plaintext key to disk to use this SDK, materially worsening their security posture. This also blocks integration with secret managers that hand off encrypted PEMs.
Location
kalshi/auth.py:94-100
Evidence
# kalshi/auth.py:94-100try:
private_key=serialization.load_pem_private_key(pem_data, password=None)
exceptTypeErrorase:
raiseKalshiAuthError(
"Passphrase-protected private keys are not supported. ""Remove the passphrase with: openssl pkey -in key.pem -out key_nopass.pem"
) frome
Recommended fix
Add an optional password parameter to from_pem, from_key_path, from_env, and try_from_env:
For env-driven flows, accept KALSHI_PRIVATE_KEY_PASSPHRASE (or a callback for interactive prompt). Document the new parameter in docs/authentication.md.
Activity
feat(transport,auth): http2 extra, per-request headers, Retry-After d…