Truncate a base32 key for display (matches the `identity list` style).
(key: &str)
| 216 | |
| 217 | /// Truncate a base32 key for display (matches the `identity list` style). |
| 218 | fn short_key(key: &str) -> String { |
| 219 | if key.len() > 16 { |
| 220 | format!("{}...", &key[..16]) |
| 221 | } else { |
| 222 | key.to_string() |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | #[cfg(test)] |
| 227 | mod tests { |