MCPcopy Create free account
hub / github.com/Louisym/MiniCC / write_credentials_root

Function write_credentials_root

rust/crates/runtime/src/oauth.rs:357–366  ·  view source on GitHub ↗
(path: &PathBuf, root: &Map<String, Value>)

Source from the content-addressed store, hash-verified

355}
356
357fn write_credentials_root(path: &PathBuf, root: &Map<String, Value>) -> io::Result<()> {
358 if let Some(parent) = path.parent() {
359 fs::create_dir_all(parent)?;
360 }
361 let rendered = serde_json::to_string_pretty(&Value::Object(root.clone()))
362 .map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
363 let temp_path = path.with_extension("json.tmp");
364 fs::write(&temp_path, format!("{rendered}\n"))?;
365 fs::rename(temp_path, path)
366}
367
368fn base64url_encode(bytes: &[u8]) -> String {
369 const TABLE: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";

Callers 2

save_oauth_credentialsFunction · 0.85
clear_oauth_credentialsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected