(&self, config: &Config)
| 178 | } |
| 179 | |
| 180 | pub fn write_config(&self, config: &Config) -> io::Result<()> { |
| 181 | let toml_string = toml::to_string(config).expect("Failed to serialize config"); |
| 182 | let mut file = OpenOptions::new() |
| 183 | .create(true) |
| 184 | .write(true) |
| 185 | .truncate(true) |
| 186 | .open(&self.config_path)?; |
| 187 | file.write_all(toml_string.as_bytes()) |
| 188 | } |
| 189 | |
| 190 | fn validate_key(&self, key: &str) -> bool { |
| 191 | key.len() == 64 && key.chars().all(|c| c.is_ascii_hexdigit()) |