|
kalshi-cpp 0.6.2
C++23 client for Kalshi's Predictions API
|
Signs Kalshi requests with an API key. More...
#include <kalshi/signer.hpp>
Public Member Functions | |
| Result< AuthHeaders > | sign (std::string_view method, std::string_view path) const |
| Signs a request at the current time. | |
| Result< AuthHeaders > | sign_with_timestamp (std::string_view method, std::string_view path, std::int64_t timestamp_ms) const |
| Signs a request at a fixed time. Useful for tests. | |
| std::string_view | api_key_id () const noexcept |
| KeyType | key_type () const noexcept |
Static Public Member Functions | |
| static Result< Signer > | from_pem (std::string_view api_key_id, std::string_view pem_key) |
| Loads an unencrypted PEM private key (PKCS#1 or PKCS#8). | |
| static Result< Signer > | from_pem_file (std::string_view api_key_id, std::string_view file_path) |
| Reads a PEM private key from a file. See from_pem(). | |
Signs Kalshi requests with an API key.
The signed message is timestamp + METHOD + path, where the path starts at /trade-api/... and excludes the query string. The algorithm follows the key: RSA keys use RSA-PSS/SHA-256, Ed25519 keys use Ed25519.
Copies share the same immutable key, and signing is thread-safe.
|
static |
Loads an unencrypted PEM private key (PKCS#1 or PKCS#8).
Encrypted keys and algorithms other than RSA and Ed25519 are rejected.
|
static |
Reads a PEM private key from a file. See from_pem().
| Result< AuthHeaders > kalshi::Signer::sign | ( | std::string_view | method, |
| std::string_view | path | ||
| ) | const |
Signs a request at the current time.
| Result< AuthHeaders > kalshi::Signer::sign_with_timestamp | ( | std::string_view | method, |
| std::string_view | path, | ||
| std::int64_t | timestamp_ms | ||
| ) | const |
Signs a request at a fixed time. Useful for tests.
|
noexcept |
|
noexcept |