diff options
Diffstat (limited to 'libbbot')
-rw-r--r-- | libbbot/manifest.cxx | 12 | ||||
-rw-r--r-- | libbbot/manifest.hxx | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx index 06399f2..02a5b05 100644 --- a/libbbot/manifest.cxx +++ b/libbbot/manifest.cxx @@ -14,6 +14,7 @@ #include <cstdint> // uint64_t #include <stdexcept> // invalid_argument +#include <libbutl/base64.hxx> #include <libbutl/utility.hxx> // digit() #include <libbutl/tab-parser.hxx> #include <libbutl/string-parser.hxx> @@ -999,7 +1000,14 @@ namespace bbot if (v.empty ()) bad_value ("empty result request challenge"); - challenge = move (v); + try + { + challenge = base64_decode (v); + } + catch (const invalid_argument&) + { + bad_value ("invalid result request challenge"); + } } else if (!iu) bad_name ("unknown name '" + n + "' in result request manifest"); @@ -1034,7 +1042,7 @@ namespace bbot s.next ("session", session); if (challenge) - s.next ("challenge", *challenge); + s.next ("challenge", base64_encode (*challenge)); s.next ("", ""); // End of manifest. diff --git a/libbbot/manifest.hxx b/libbbot/manifest.hxx index 4ae8b26..b981ab4 100644 --- a/libbbot/manifest.hxx +++ b/libbbot/manifest.hxx @@ -296,12 +296,12 @@ namespace bbot // The answer to challenge in the task response. // - butl::optional<std::string> challenge; + butl::optional<std::vector<char>> challenge; result_manifest result; result_request_manifest (std::string s, - butl::optional<std::string> c, + butl::optional<std::vector<char>> c, result_manifest r) : session (std::move (s)), challenge (std::move (c)), |