From fe2bfe443dfcf3251ebe39002325f604634dfa1f Mon Sep 17 00:00:00 2001 From: t Date: Sat, 13 Jun 2026 11:55:59 -0600 Subject: auth: HTTP helper + token storage (C3, C4) Add libpanto http_helper (non-streaming request/response over the global client, plus dotted-JSON-path readers) and token persistence in auth.zig (load/save/delete TokenSet under an embedder-chosen auth dir, owner-only files). Add $PANTO_HOME/auth to the panto_home layout. --- src/panto_home.zig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/panto_home.zig b/src/panto_home.zig index e75d14b..5d111d6 100644 --- a/src/panto_home.zig +++ b/src/panto_home.zig @@ -35,6 +35,10 @@ pub const Layout = struct { /// binary. Searched after user/project layers for tools and /// extensions; project shadows user shadows base. agent_dir: []u8, + /// `$PANTO_HOME/auth/` — persisted provider auth tokens, one + /// `.json` per OAuth session. Files are written owner-only; + /// treat them like passwords. + auth_dir: []u8, /// `$PANTO_HOME/rocks/lua-/` — the versioned tree. tree: []u8, /// `/include/` — where Lua headers are staged. @@ -58,6 +62,7 @@ pub const Layout = struct { const a = self.allocator; a.free(self.home); a.free(self.agent_dir); + a.free(self.auth_dir); a.free(self.tree); a.free(self.include_dir); a.free(self.share_lua_dir); @@ -85,6 +90,9 @@ pub fn resolve( const agent_dir = try std.fs.path.join(allocator, &.{ home, "agent" }); errdefer allocator.free(agent_dir); + const auth_dir = try std.fs.path.join(allocator, &.{ home, "auth" }); + errdefer allocator.free(auth_dir); + // `/rocks/lua-` const tree_subdir = try std.fmt.allocPrint( allocator, @@ -121,6 +129,7 @@ pub fn resolve( .allocator = allocator, .home = home, .agent_dir = agent_dir, + .auth_dir = auth_dir, .tree = tree, .include_dir = include_dir, .share_lua_dir = share_lua_dir, -- cgit v1.3