-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PM-16221] uniffi bindings for ssh agent and keygen #89
Merged
+62
โ1
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4d4c67a
Add uniffi bindings for ssh keygen and import
quexten 744c26c
Fix clippy errors
quexten 9d34848
Run cargo sort
quexten 60aef1c
Move ssh code to a client
quexten e7384a0
Merge branch 'main' into km/pm_16221/uniffi-ssh-bindings
quexten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[bindings.kotlin] | ||
package_name = "com.bitwarden.ssh" | ||
generate_immutable_records = true | ||
android = true | ||
|
||
[bindings.swift] | ||
ffi_module_name = "BitwardenSshFFI" | ||
module_name = "BitwardenSsh" | ||
generate_immutable_records = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::sync::Arc; | ||
|
||
use crate::{ | ||
error::{BitwardenError, Error}, | ||
Client, Result, | ||
}; | ||
|
||
#[derive(uniffi::Object)] | ||
pub struct SshClient(pub Arc<Client>); | ||
|
||
#[uniffi::export] | ||
impl SshClient { | ||
pub fn generate_ssh_key( | ||
&self, | ||
key_algorithm: bitwarden_ssh::generator::KeyAlgorithm, | ||
) -> Result<bitwarden_ssh::SshKey> { | ||
bitwarden_ssh::generator::generate_sshkey(key_algorithm) | ||
.map_err(|e| BitwardenError::E(Error::SshGeneration(e))) | ||
} | ||
|
||
pub fn import_ssh_key( | ||
&self, | ||
imported_key: String, | ||
password: Option<String>, | ||
) -> Result<bitwarden_ssh::SshKey> { | ||
bitwarden_ssh::import::import_key(imported_key, password) | ||
.map_err(|e| BitwardenError::E(Error::SshImport(e))) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
observation: We would probably benefit from taking a look at the public interface of
bitwarden_ssh
. Exposing modules is a bit clunky and the library is small enough that re-publishing everything in the root would result in a cleaner interface.