|
Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
|
Signs request payloads. More...
#include <signer.hpp>
Public Member Functions | |
| SignatureGenerator (std::optional< std::string > api_secret, std::optional< PrivateKey > private_key, std::optional< std::string > private_key_passphrase) | |
| ~SignatureGenerator () | |
| SignatureGenerator (SignatureGenerator &&) noexcept | |
| SignatureGenerator & | operator= (SignatureGenerator &&) noexcept |
| SignatureGenerator (const SignatureGenerator &)=delete | |
| SignatureGenerator & | operator= (const SignatureGenerator &)=delete |
| std::string | sign (const Params &query, const Params *body=nullptr) const |
| REST: signs build_query_string(query) + build_query_string(body). | |
| std::string | sign_unencoded (const Params ¶ms) const |
| WebSocket API: signs build_plain_query_string(params) (sorted, not percent-encoded). | |
| std::string | sign_payload (std::string_view payload) const |
| void | load_key () const |
| Reads and parses the private key now instead of on the first signature. | |
Signs request payloads.
The key is read and parsed on first use (or by load_key) and then cached. The PEM text read from a file and the passphrase are wiped from memory once parsed. Thread-safe. Errors throw ConnectorClientError.
| binance::common::SignatureGenerator::SignatureGenerator | ( | std::optional< std::string > | api_secret, |
| std::optional< PrivateKey > | private_key, | ||
| std::optional< std::string > | private_key_passphrase ) |
| binance::common::SignatureGenerator::~SignatureGenerator | ( | ) |
|
noexcept |
|
delete |
|
noexcept |
|
delete |
|
nodiscard |
REST: signs build_query_string(query) + build_query_string(body).
|
nodiscard |
WebSocket API: signs build_plain_query_string(params) (sorted, not percent-encoded).
|
nodiscard |
| void binance::common::SignatureGenerator::load_key | ( | ) | const |
Reads and parses the private key now instead of on the first signature.
It does nothing without a key and throws like sign_payload. RestClient calls it on construction, so a bad key fails early, not on the first order.