// Copyright (C) 2024 Simon Quigley // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see #include #include #include #include size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp); std::string url_encode(const std::string& value); std::string url_decode(const std::string& value); std::string compute_hmac_sha1(const std::string& key, const std::string& data); std::string generate_nonce(); std::string generate_timestamp(); std::string build_oauth_header_impl(const std::string& consumer_key, const std::string& oauth_token, const std::string& oauth_token_secret, const std::string& http_method, const std::string& url, const std::map& additional_params); std::optional get_secret(const std::string& schema, const std::string& attribute, const std::string& value); std::string base64_encode(const unsigned char* data, size_t len); std::string base64_decode(const std::string& encoded_string); std::map parse_response(const std::string& response, std::map& params); bool open_url_impl(const std::string& url); std::string encode_service_identifier(const std::string& identifier); std::string decode_service_identifier(const std::string& encoded); extern const std::string PLAINTEXT_CREDENTIALS_FILE; #endif // UTILS_H