diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-05-26 18:01:41 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-05-26 18:19:59 +0300 |
commit | fa00e853d17b40d9112cb856ca1f08dfe8500f20 (patch) | |
tree | da7e677b3e33299ace4aefeda6470fd2e84e5f2c /libbbot | |
parent | 48fcedb09820aa8d99f1c051627a4f1335dbed6f (diff) |
Store result request challenge as binary value
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)), |