base64_rfc4648.hpp 512 B

123456789101112131415161718192021
  1. #pragma once
  2. #include <string>
  3. #include <vector>
  4. #include "exception.hpp"
  5. namespace nkg {
  6. struct base64_rfc4648 {
  7. class backend_error : public ::nkg::exception {
  8. public:
  9. backend_error(std::string_view file, int line, std::string_view message) noexcept :
  10. ::nkg::exception(file, line, message) {}
  11. };
  12. static std::string encode(const std::vector<std::uint8_t>& data);
  13. static std::vector<uint8_t> decode(std::string_view str_b64);
  14. };
  15. }