Files
moloapp/src/cli/ai/redactor.hpp
T

23 lines
524 B
C++
Raw Normal View History

#pragma once
#include <string>
namespace molo::ai {
// Redacts secrets before prompt construction. Keys matching *_KEY,
// *_SECRET, *_TOKEN (case-insensitive) and .env.json-style assignments
// are masked. Redaction failures abort the request (caller checks ok()).
class Redactor {
public:
struct Result {
std::string text;
unsigned long redacted = 0;
bool ok = true;
};
static Result redact(const std::string& text);
static bool key_is_secret(const std::string& key);
};
} // namespace molo::ai