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

Function load_credentials

crates/openshell-prover/src/credentials.rs:254–273  ·  view source on GitHub ↗

Load credential descriptors from a YAML file.

(path: &Path)

Source from the content-addressed store, hash-verified

252
253/// Load credential descriptors from a YAML file.
254pub fn load_credentials(path: &Path) -> Result<Vec<Credential>> {
255 let contents = std::fs::read_to_string(path)
256 .into_diagnostic()
257 .wrap_err_with(|| format!("reading credentials file {}", path.display()))?;
258 let raw: CredentialsFile = serde_yml::from_str(&contents)
259 .into_diagnostic()
260 .wrap_err("parsing credentials YAML")?;
261
262 Ok(raw
263 .credentials
264 .into_iter()
265 .map(|c| Credential {
266 name: c.name,
267 cred_type: c.cred_type,
268 scopes: c.scopes,
269 injected_via: c.injected_via,
270 target_hosts: c.target_hosts,
271 })
272 .collect())
273}
274
275fn parse_api_registry(contents: &str, source: &str) -> Result<ApiCapability> {
276 let raw: ApiRegistryDef = serde_yml::from_str(contents)

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected