summaryrefslogtreecommitdiff
path: root/src/base64.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/base64.hh')
-rw-r--r--src/base64.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/base64.hh b/src/base64.hh
new file mode 100644
index 0000000..491755c
--- /dev/null
+++ b/src/base64.hh
@@ -0,0 +1,25 @@
+#ifndef BASE64_HH
+#define BASE64_HH
+
+#include <cstdint>
+#include <optional>
+#include <span>
+#include <string>
+#include <vector>
+
+namespace base64 {
+
+[[nodiscard]]
+std::string encode(std::span<uint8_t const> data);
+
+void encode(std::span<uint8_t const> in, std::string& out);
+
+[[nodiscard]]
+std::optional<std::vector<uint8_t>> decode(std::string_view value);
+
+[[nodiscard]]
+bool decode(std::string_view in, std::vector<uint8_t>& out);
+
+} // namespace base64
+
+#endif // BASE64_HH