(&self, server: Option<&str>)
| 745 | } |
| 746 | |
| 747 | pub fn server_decoding_key(&self, server: Option<&str>) -> anyhow::Result<DecodingKey> { |
| 748 | self.server_fingerprint(server).and_then(|fing| { |
| 749 | if let Some(fing) = fing { |
| 750 | DecodingKey::from_ec_pem(fing.as_bytes()).with_context(|| { |
| 751 | format!( |
| 752 | "Unable to parse invalid saved server fingerprint as ECDSA public key. |
| 753 | Update the server's fingerprint with: |
| 754 | \tspacetime server fingerprint {}", |
| 755 | server.unwrap_or("") |
| 756 | ) |
| 757 | }) |
| 758 | } else { |
| 759 | Err(anyhow::anyhow!( |
| 760 | "No fingerprint saved for server: {}", |
| 761 | self.server_nick_or_host(server)?, |
| 762 | )) |
| 763 | } |
| 764 | }) |
| 765 | } |
| 766 | |
| 767 | pub fn server_nick_or_host<'a>(&'a self, server: Option<&'a str>) -> anyhow::Result<&'a str> { |
| 768 | if let Some(server) = server { |
nothing calls this directly
no test coverage detected