pub struct DotSsh { /* private fields */ }std only.Expand description
~/.ssh directory support (or similarly structured directories).
Implementations§
source§impl DotSsh
impl DotSsh
sourcepub fn new() -> Option<Self>
pub fn new() -> Option<Self>
Open ~/.ssh if the home directory can be located.
Returns None if the home directory couldn’t be located.
sourcepub fn open(path: impl Into<PathBuf>) -> Self
pub fn open(path: impl Into<PathBuf>) -> Self
Open a ~/.ssh-structured directory.
Does not verify that the directory exists or has the right file permissions.
Attempts to canonicalize the path once opened.
sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
Get the path to the ~/.ssh directory (or whatever DotSsh::open was called with).
sourcepub fn config_path(&self) -> PathBuf
pub fn config_path(&self) -> PathBuf
Get the path to the ~/.ssh/config configuration file. Does not check if it exists.
sourcepub fn private_keys(&self) -> Result<impl Iterator<Item = PrivateKey>>
pub fn private_keys(&self) -> Result<impl Iterator<Item = PrivateKey>>
Iterate over the private keys in the ~/.ssh directory.
sourcepub fn private_key_with_fingerprint(
&self,
fingerprint: Fingerprint,
) -> Option<PrivateKey>
pub fn private_key_with_fingerprint( &self, fingerprint: Fingerprint, ) -> Option<PrivateKey>
Find a private key whose public key has the given key fingerprint.
sourcepub fn public_keys(&self) -> Result<impl Iterator<Item = PublicKey>>
pub fn public_keys(&self) -> Result<impl Iterator<Item = PublicKey>>
Iterate over the public keys in the ~/.ssh directory.
sourcepub fn public_key_with_fingerprint(
&self,
fingerprint: Fingerprint,
) -> Option<PublicKey>
pub fn public_key_with_fingerprint( &self, fingerprint: Fingerprint, ) -> Option<PublicKey>
Find a public key with the given key fingerprint.
sourcepub fn write_private_key(
&self,
filename: impl AsRef<Path>,
key: &PrivateKey,
) -> Result<()>
pub fn write_private_key( &self, filename: impl AsRef<Path>, key: &PrivateKey, ) -> Result<()>
Write a private key into ~/.ssh.
Trait Implementations§
source§impl Default for DotSsh
impl Default for DotSsh
source§fn default() -> Self
fn default() -> Self
Calls DotSsh::new and panics if the home directory could not be located.
impl Eq for DotSsh
impl StructuralPartialEq for DotSsh
Auto Trait Implementations§
impl Freeze for DotSsh
impl RefUnwindSafe for DotSsh
impl Send for DotSsh
impl Sync for DotSsh
impl Unpin for DotSsh
impl UnwindSafe for DotSsh
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)