22#include <boost/json.hpp>
23#include <boost/json/object.hpp>
45 std::ranges::transform(str, std::begin(str), [](
unsigned char c) {
return std::tolower(c); });
58 std::ranges::transform(str, std::begin(str), [](
unsigned char c) {
return std::toupper(c); });
68inline boost::json::object
71 auto newObject = object;
72 auto const secretFields = {
"secret",
"seed",
"seed_hex",
"passphrase"};
74 if (newObject.contains(
"params") and newObject.at(
"params").is_array() and
75 not newObject.at(
"params").as_array().empty() and newObject.at(
"params").as_array()[0].is_object()) {
76 for (
auto const& secretField : secretFields) {
77 if (newObject.at(
"params").as_array()[0].as_object().contains(secretField))
78 newObject.at(
"params").as_array()[0].as_object()[secretField] =
"*";
83 for (
auto const& secretField : secretFields) {
84 if (newObject.contains(secretField))
85 newObject[secretField] =
"*";
100template <std::
integral Type>
104 if (value.is_uint64())
105 return static_cast<Type
>(value.as_uint64());
107 if (value.is_int64())
108 return static_cast<Type
>(value.as_int64());
110 throw std::logic_error(
"Value neither uint64 nor int64");
This namespace contains various utilities.
Definition AccountUtils.hpp:30
Type integralValueAs(boost::json::value const &value)
Detects the type of number stored in value and casts it back to the requested Type.
Definition JsonUtils.hpp:102
std::string toUpper(std::string str)
Convert a string to uppercase.
Definition JsonUtils.hpp:56
boost::json::object removeSecret(boost::json::object const &object)
Removes any detected secret information from a response JSON object.
Definition JsonUtils.hpp:69
std::string toLower(std::string str)
Convert a string to lowercase.
Definition JsonUtils.hpp:43