Skip to content

Commit

Permalink
Add serial open
Browse files Browse the repository at this point in the history
  • Loading branch information
obelisk committed Aug 12, 2021
1 parent f288675 commit 4b7746d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sshcerts"
version = "0.6.0"
version = "0.6.1"
authors = ["Mitchell Grenier <[email protected]>"]
edition = "2018"
license-file = "LICENSE"
Expand Down
10 changes: 10 additions & 0 deletions src/yubikey/management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ impl crate::yubikey::Yubikey {
})
}

/// Open a Yubikey from a serial
pub fn open(serial: u32) -> Result<Self> {
match YubiKey::open_by_serial(serial.into()){
Ok(yk) => Ok(Self {
yk,
}),
Err(_) => Err(Error::NoSuchYubikey),
}
}

/// Reconnet to the Yubikey (if possible, if it's disconnected)
pub fn reconnect(&mut self) -> Result <()> {
match self.yk.reconnect() {
Expand Down

0 comments on commit 4b7746d

Please sign in to comment.