diff --git a/include/caosdb/utils.h b/include/caosdb/utils.h index e6bfe5344bcf948df5dbca94194420cd87b5acb6..bb54e798c1fd2a3abff9f2964001445ea0157fc4 100644 --- a/include/caosdb/utils.h +++ b/include/caosdb/utils.h @@ -26,9 +26,7 @@ #include <fstream> #include <string> #include <cstdlib> -/* #include <boost/beast/core/detail/base64.hpp> -*/ namespace caosdb::utils { @@ -70,16 +68,14 @@ inline auto get_env_var(const std::string &key, const std::string &fall_back) * @brief Encode string as base64 */ inline auto base64_encode(const std::string &plain) -> std::string { - return std::string("YWRtaW46Y2Fvc2Ri"); - // TODO - // auto size_plain = plain.size(); - // auto size_encoded = boost::beast::detail::base64::encoded_size(size_plain); + auto size_plain = plain.size(); + auto size_encoded = boost::beast::detail::base64::encoded_size(size_plain); - // char encoded[size_encoded]; - // boost::beast::detail::base64::encode(&encoded, plain.c_str(), size_plain); + char encoded[size_encoded]; + boost::beast::detail::base64::encode(&encoded, plain.c_str(), size_plain); - //// the encoded char[] is not null terminated, so explicitely set the length - // return std::string(encoded, encoded + size_encoded); + // the encoded char[] is not null terminated, so explicitely set the length + return std::string(encoded, encoded + size_encoded); } } // namespace caosdb::utils diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6af44ef0d68cf0e3816e8789ef0368a6e26ffef0..a402a113aa7e9ece9d99b5e581a6793c22ab8c0e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,7 +21,7 @@ # append all the test cases here (file name without the ".cpp" suffix) set(test_cases test_connection - #test_utils + test_utils ) # download gtest library