Foundation / checks (ecs) (push) Successful in 2m21s
Foundation / checks (deploy) (push) Successful in 4m1s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 7m21s
Foundation / checks (network) (push) Canceled after 9m43s
Foundation / checks (checks) (push) Canceled after 9m49s
Foundation / checks (postgres) (push) Canceled after 9m43s
Foundation / checks (client) (push) Canceled after 9m48s
Sign In / Register opens the system browser (PKCE S256, loopback 127.0.0.1:47600) and keeps the refresh token in Windows Credential Manager. The client then fetches a 10-minute grant from grants.aeternalisgames.com and connects to the cellular DEV region. It renews the grant about a minute before expiry through SessionRefresh, and again after a lost connection. Sign Out closes the session and revokes the login at the broker and at Keycloak. Grant replies are cross-checked against the grant record before use. The manual grant-bundle path stays for developers. The bounded JSON reader moves to evo_json (evo::serialization), shared by the broker and the client. Adds the client-auth tests. Completes work started in another session: main.cpp wiring, refresh expiry tracking, no requests for a superseded session, and clang-tidy and Windows header-order fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.6 KiB
C++
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::serialization {
|
|
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::serialization
|