//! Per-connection context shared across middleware layers. Mirrors //! charmbracelet/ssh.Context — a place to stash request-scoped values that //! outlive a single middleware frame. //! //! Phase 0 keeps this minimal: just the auth state and a small kv map. //! Public-key, certificate, and cancel-channel surface land alongside the //! middleware framework in Phase 2. const Context = @This(); allocator: Allocator, authenticated: bool = false, user_name: []const u8 = "", remote_addr: []const u8 = "", client_version: []const u8 = "", values: StringHashMapUnmanaged([]const u8) = .empty, pub fn init(allocator: Allocator) Context { return .{ .allocator = allocator }; } pub fn deinit(self: *Context) void { self.values.deinit(self.allocator); self.* = undefined; } pub fn set(self: *Context, key: []const u8, value: []const u8) !void { try self.values.put(self.allocator, key, value); } pub fn get(self: *const Context, key: []const u8) ?[]const u8 { return self.values.get(key); } const std = @import("std"); const Allocator = std.mem.Allocator; const StringHashMapUnmanaged = std.StringHashMapUnmanaged;