Files
aevolution/include/evo/network/dev_credentials.hpp
T
dingoandClaude Opus 5.5 8e319322f4 Implement M9.7 dev region sessions with durable no-effect intentions
Run a non-blocking TLS 1.3 session server inside evo-server's loop:
environment views come from the region's own field/terrain stores with an
explicitly empty organism presentation; admitted intentions ride the next
synthetic input (content unchanged) and return a durable no-effect outcome
from the host's final acknowledgement, or not_committed when dropped.
Sessions are bound to their connection, epochs close stale sessions, and
connections have bounded output, input rate and deadlines.

SessionClient and evo-client --connect consume one single-use grant per
Hello (refusals before admission keep it), reset to a fresh baseline on
every session, keep stale views visible and report in-flight intentions as
unknown after loss. evo-dev-session generates dev credentials, grant
bundles and runs a restart probe. The dev deployment gains a drill-time,
loopback-only listener with an optional Secret, enforced by the policy
check, and tools/ops/session-drill.sh. Protocol v1 gains IntentOutcome and
the capacity close reason before any deployment. ADR-0083 records the
maintainer-confirmed decisions; M8-dev/stage remains not passed and no
cluster change was made.

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

30 lines
1.4 KiB
C++

#pragma once
#include "evo/network/dev_grant.hpp"
#include <array>
#include <chrono>
#include <cstdint>
#include <expected>
#include <string>
#include <string_view>
// Dev-only session credentials (ADR-0083): a self-signed dev CA, a server
// certificate/key for one name, and a 32-byte grant HMAC key. Generated on an
// operator machine for the dev namespace Secret; refused for stage and World0.
namespace evo::network {
struct DevCredentials {
std::string authority_pem; // Public: given to dev clients.
std::string server_certificate_pem; // Public.
std::string server_key_pem; // Secret.
std::array<std::uint8_t, dev_key_bytes> grant_key{}; // Secret.
};
[[nodiscard]] std::expected<DevCredentials, GrantError>
generate_dev_credentials(DeploymentEnvironment environment, std::string_view server_name,
std::uint32_t days, std::chrono::system_clock::time_point now);
// Lowercase hex, 64 digits; surrounding whitespace is ignored when parsing.
[[nodiscard]] std::string format_grant_key(std::span<const std::uint8_t> key);
[[nodiscard]] std::expected<std::array<std::uint8_t, dev_key_bytes>, GrantError>
parse_grant_key(std::string_view text);
// Random 64-bit nonzero grant ids from the PSA RNG.
[[nodiscard]] std::expected<std::uint64_t, GrantError> random_grant_id();
} // namespace evo::network