Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit::utils Namespace Reference

Namespaces

namespace  file
 
namespace  log_levels
 

Classes

struct  CaseInsensitiveEqual
 
struct  CaseInsensitiveHash
 
class  Logger
 
class  MetricsTimer
 
class  PrometheusRegistry
 

Typedefs

using LogFields = std::vector< std::pair< std::string, std::string > >
 

Enumerations

enum class  LogLevel { DEBUG = 0 , INFO = 1 , WARN = 2 , ERROR = 3 }
 
enum class  LogFormat { Text , Json }
 

Functions

std::string secure_random_hex (size_t num_bytes)
 Returns num_bytes of cryptographically secure randomness, hex-encoded.
 
bool constant_time_equals (std::string_view a, std::string_view b)
 Compares two secrets in time independent of where they differ.
 

Typedef Documentation

◆ LogFields

using orbit::utils::LogFields = typedef std::vector<std::pair<std::string, std::string> >

Enumeration Type Documentation

◆ LogFormat

enum class orbit::utils::LogFormat
strong

Text: human-readable lines (colored on a terminal). Json: one JSON object per line, for log collectors (Loki, ELK, CloudWatch, ...).

Enumerator
Text 
Json 

◆ LogLevel

enum class orbit::utils::LogLevel
strong
Enumerator
DEBUG 
INFO 
WARN 
ERROR 

Function Documentation

◆ constant_time_equals()

bool orbit::utils::constant_time_equals ( std::string_view  a,
std::string_view  b 
)
inline

Compares two secrets in time independent of where they differ.

◆ secure_random_hex()

std::string orbit::utils::secure_random_hex ( size_t  num_bytes)
inline

Returns num_bytes of cryptographically secure randomness, hex-encoded.

Use this for anything an attacker must not guess: session identifiers, CSRF tokens, OAuth state values. std::random_device / std::mt19937 are not suitable for these.

Exceptions
std::runtime_errorif the system CSPRNG fails.