MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / sandbox_token_path

Function sandbox_token_path

crates/openshell-core/src/driver_utils.rs:85–97  ·  view source on GitHub ↗

Return the XDG state path for a driver's sandbox JWT token file. The resulting path is `$XDG_STATE_HOME/openshell/ [/ ]/ /sandbox.jwt`. `driver_subdir` is driver-specific, e.g. `"docker-sandbox-tokens"` or `"podman-sandbox-tokens"`. When `namespace` is `Some`, it is appended as an additional path component (with `/` and `\` replaced by `-`). # Errors Returns

(
    driver_subdir: &str,
    namespace: Option<&str>,
    sandbox_id: &str,
)

Source from the content-addressed store, hash-verified

83/// # Errors
84/// Returns an error if the XDG state directory cannot be resolved.
85pub fn sandbox_token_path(
86 driver_subdir: &str,
87 namespace: Option<&str>,
88 sandbox_id: &str,
89) -> miette::Result<PathBuf> {
90 let mut path = crate::paths::xdg_state_dir()?
91 .join("openshell")
92 .join(driver_subdir);
93 if let Some(ns) = namespace {
94 path = path.join(ns.replace(['/', '\\'], "-"));
95 }
96 Ok(path.join(sandbox_id).join("sandbox.jwt"))
97}
98
99/// Build a [`GetCapabilitiesResponse`] from the common driver capability fields.
100///

Callers 2

sandbox_token_host_pathFunction · 0.85

Calls 1

xdg_state_dirFunction · 0.85

Tested by

no test coverage detected