refactor: name auth security flags, log JSON parse failures

- auth_handler: define kSecurityFlagPin/MatrixCard/Authenticator
  constants (0x01/0x02/0x04) with why-comment explaining WoW login
  challenge securityFlags byte, replace all bare hex literals
- expansion_profile: log warning on jsonInt() parse failure instead
  of silently returning default — makes malformed expansion.json
  diagnosable without debugger
This commit is contained in:
Kelsi 2026-03-30 14:43:50 -07:00
parent 74f0ba010a
commit a940859e6a
2 changed files with 22 additions and 9 deletions

View file

@ -58,7 +58,14 @@ std::string jsonValue(const std::string& json, const std::string& key) {
int jsonInt(const std::string& json, const std::string& key, int def = 0) {
std::string v = jsonValue(json, key);
if (v.empty()) return def;
try { return std::stoi(v); } catch (...) { return def; }
try {
return std::stoi(v);
} catch (...) {
// Non-numeric value for an integer field — fall back to default rather than
// crashing, but log it so malformed expansion.json files are diagnosable.
wowee::core::Logger::getInstance().warning("jsonInt: failed to parse '", key, "' value '", v, "', using default ", def);
return def;
}
}
std::vector<uint32_t> jsonUintArray(const std::string& json, const std::string& key) {