Remove a stored edge authentication token.
(gateway_name: &str)
| 70 | |
| 71 | /// Remove a stored edge authentication token. |
| 72 | pub fn remove_edge_token(gateway_name: &str) -> Result<()> { |
| 73 | // Remove both new and legacy paths. |
| 74 | for path in [ |
| 75 | edge_token_path(gateway_name)?, |
| 76 | legacy_token_path(gateway_name)?, |
| 77 | ] { |
| 78 | if path.exists() { |
| 79 | std::fs::remove_file(&path) |
| 80 | .into_diagnostic() |
| 81 | .wrap_err_with(|| format!("failed to remove {}", path.display()))?; |
| 82 | } |
| 83 | } |
| 84 | Ok(()) |
| 85 | } |
| 86 | |
| 87 | #[cfg(test)] |
| 88 | mod tests { |