iceberg-cpp
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
iceberg::Base64 Class Reference

Utilities for base64 and base64url encoding and decoding. More...

#include <base64.h>

Static Public Member Functions

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: -_).
 

Detailed Description

Utilities for base64 and base64url encoding and decoding.

Member Function Documentation

◆ Decode()

Result< std::string > iceberg::Base64::Decode ( std::string_view  encoded)
static

Base64 decode a string (standard alphabet: +/).

Handles optional padding ('=').

Parameters
encodedThe 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
dataThe 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
encodedThe 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
dataThe string to encode.
Returns
The base64url-encoded string (without padding).

The documentation for this class was generated from the following files: