Holds a credential, such as an LLM provider's API key.
More...
#include <secret.hpp>
|
| static std::optional< Secret > | FromEnv (const char *name) |
| | Reads the environment variable name.
|
| |
Holds a credential, such as an LLM provider's API key.
- Note
- There is no
operator<< and no conversion to std::string, so a Secret can't end up in a log line or an error message by accident: the only way to read it is reveal(), which is easy to search for. redacted() describes it without its contents. The memory holding the value is overwritten when the Secret is destroyed or assigned over.
◆ Secret() [1/4]
| pulsatrix::orch::Secret::Secret |
( |
| ) |
|
|
default |
◆ Secret() [2/4]
| pulsatrix::orch::Secret::Secret |
( |
std::string |
value | ) |
|
|
explicit |
◆ Secret() [3/4]
| pulsatrix::orch::Secret::Secret |
( |
const Secret & |
other | ) |
|
◆ Secret() [4/4]
| pulsatrix::orch::Secret::Secret |
( |
Secret && |
other | ) |
|
|
noexcept |
◆ ~Secret()
| pulsatrix::orch::Secret::~Secret |
( |
| ) |
|
◆ empty()
| bool pulsatrix::orch::Secret::empty |
( |
| ) |
const |
|
inline |
◆ FromEnv()
| static std::optional< Secret > pulsatrix::orch::Secret::FromEnv |
( |
const char * |
name | ) |
|
|
static |
Reads the environment variable name.
- Returns
- The value, or std::nullopt if the variable isn't set or is empty.
◆ operator=() [1/2]
| Secret & pulsatrix::orch::Secret::operator= |
( |
const Secret & |
other | ) |
|
◆ operator=() [2/2]
| Secret & pulsatrix::orch::Secret::operator= |
( |
Secret && |
other | ) |
|
|
noexcept |
◆ redacted()
| std::string pulsatrix::orch::Secret::redacted |
( |
| ) |
const |
A description safe to print, for example <secret, 108 characters>.
◆ reveal()
| const std::string & pulsatrix::orch::Secret::reveal |
( |
| ) |
const |
|
inline |
The value, to put in a request header. Never log it.
◆ size()
| std::size_t pulsatrix::orch::Secret::size |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following file: