Utilities for base64 and base64url encoding and decoding.
More...
#include <base64.h>
|
| static std::string | Encode (std::string_view data) |
| | Base64 encode a string (standard alphabet: +/).
|
| |
| static Result< std::string > | Decode (std::string_view encoded) |
| | Base64 decode a string (standard alphabet: +/).
|
| |
| static std::string | UrlEncode (std::string_view data) |
| | Base64url encode a string (URL-safe alphabet: -_).
|
| |
| static Result< std::string > | UrlDecode (std::string_view encoded) |
| | Base64url decode a string (URL-safe alphabet: -_).
|
| |
Utilities for base64 and base64url encoding and decoding.
◆ Decode()
| Result< std::string > iceberg::Base64::Decode |
( |
std::string_view |
encoded | ) |
|
|
static |
Base64 decode a string (standard alphabet: +/).
Handles optional padding ('=').
- Parameters
-
| encoded | The base64-encoded string. |
- Returns
- Decoded string, or an error if the input contains invalid characters.
◆ Encode()
| std::string iceberg::Base64::Encode |
( |
std::string_view |
data | ) |
|
|
static |
Base64 encode a string (standard alphabet: +/).
The output is padded with '=' to a multiple of 4 characters.
- Parameters
-
| data | The string to encode. |
- Returns
- The base64-encoded string.
◆ UrlDecode()
| Result< std::string > iceberg::Base64::UrlDecode |
( |
std::string_view |
encoded | ) |
|
|
static |
Base64url decode a string (URL-safe alphabet: -_).
Handles optional padding ('='). This variant uses '-' and '_' instead of '+' and '/' per RFC 4648 §5.
- Parameters
-
| encoded | The base64url-encoded string. |
- Returns
- Decoded string, or an error if the input contains invalid characters.
◆ UrlEncode()
| std::string iceberg::Base64::UrlEncode |
( |
std::string_view |
data | ) |
|
|
static |
Base64url encode a string (URL-safe alphabet: -_).
This variant uses '-' and '_' instead of '+' and '/' per RFC 4648 §5 and emits no '=' padding, matching the encoding commonly used by JWTs.
- Parameters
-
| data | The string to encode. |
- Returns
- The base64url-encoded string (without padding).
The documentation for this class was generated from the following files:
- iceberg/util/base64.h
- iceberg/util/base64.cc