summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-13 11:55:59 -0600
committert <t@tjp.lol>2026-06-15 15:08:32 -0600
commitfe2bfe443dfcf3251ebe39002325f604634dfa1f (patch)
tree83cc6673f85b85f5c49f8b1c5195e2ad68ca9002 /src
parent9308feabc045a3afd7eeb304a2324d17d03246df (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/panto_home.zig9
1 files changed, 9 insertions, 0 deletions
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
+ /// `<auth-name>.json` per OAuth session. Files are written owner-only;
+ /// treat them like passwords.
+ auth_dir: []u8,
/// `$PANTO_HOME/rocks/lua-<lua_version>/` — the versioned tree.
tree: []u8,
/// `<tree>/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);
+
// `<home>/rocks/lua-<lua_version>`
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,