bitwarden_uniffi/tool/
ssh.rs

1use bitwarden_vault::SshKeyView;
2
3use crate::Result;
4
5#[derive(uniffi::Object)]
6pub struct SshClient();
7
8#[uniffi::export]
9impl SshClient {
10    pub fn generate_ssh_key(
11        &self,
12        key_algorithm: bitwarden_ssh::generator::KeyAlgorithm,
13    ) -> Result<SshKeyView> {
14        bitwarden_ssh::generator::generate_sshkey(key_algorithm).map_err(Into::into)
15    }
16
17    pub fn import_ssh_key(
18        &self,
19        imported_key: String,
20        password: Option<String>,
21    ) -> Result<SshKeyView> {
22        bitwarden_ssh::import::import_key(imported_key, password).map_err(Into::into)
23    }
24}