Files
aevolution/include/evo/server/broker/json.hpp
T
dingoandClaude Opus 5.5 68880ba3b4
Foundation / checks (checks) (push) Successful in 42m13s
Foundation / checks (deploy) (push) Successful in 4m5s
Foundation / checks (ecs) (push) Successful in 2m25s
Foundation / checks (network) (push) Successful in 19m18s
Foundation / checks (postgres) (push) Successful in 44m19s
Foundation / checks (tsan) (push) Successful in 9m48s
Foundation / checks (client) (push) Failing after 12m6s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
ADR-0131: Keycloak grant broker and schema v39 account identities
evo-grant-broker verifies realm aeternalis access tokens offline (RS256 against
the pinned JWKS; audience aevolution-grants, client aevolution-game, verified
email) and issues 10-minute session grants:
- POST /grant routes to the region holding the account's life, or the default.
- POST /logout makes every issued grant stale and expires current control.
- GET /healthz.

Schema v39 maps (issuer, subject) to stable accounts with strictly increasing
serials. The binary ships in the server image. The DEV manifests are in
deploy/kubernetes/grant-broker-dev and are not yet enabled in region/dev; that
waits for the image promotion and the out-of-band Secrets and Ingress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 10:20:27 -04:00

45 lines
1.6 KiB
C++

#pragma once
#include <cstddef>
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
// ADR-0131: a small, bounded JSON reader for access-token claims and the realm's JWKS.
// It accepts RFC 8259 JSON within the bounds below and nothing else (no comments, no
// trailing commas, no duplicate-key resolution beyond "first wins").
namespace evo::server::broker {
inline constexpr std::size_t max_json_bytes = std::size_t{16} * 1024;
inline constexpr std::size_t max_json_depth = 16;
class JsonValue {
public:
enum class Kind : std::uint8_t { null, boolean, number, string, array, object };
[[nodiscard]] Kind kind() const noexcept {
return kind_;
}
// Typed views; nullopt or nullptr when the value has another kind.
[[nodiscard]] std::optional<bool> boolean() const;
[[nodiscard]] std::optional<std::string_view> string() const;
// Integers only (no fraction or exponent), within 0..2^63-1.
[[nodiscard]] std::optional<std::uint64_t> integer() const;
[[nodiscard]] const JsonValue* member(std::string_view name) const;
[[nodiscard]] const std::vector<JsonValue>* array() const;
// Whole-document parse; nullopt for anything malformed or out of bounds.
[[nodiscard]] static std::optional<JsonValue> parse(std::string_view text);
private:
friend class JsonParser;
Kind kind_{Kind::null};
bool boolean_{};
std::string text_; // String value, or the number's literal.
std::vector<JsonValue> items_;
std::vector<std::pair<std::string, JsonValue>> members_;
};
} // namespace evo::server::broker