summaryrefslogtreecommitdiff
path: root/src/base64.hh
blob: 491755c009cf73b32cb80c51a9ad2239f44c50df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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