Adjust openpgp-card-sequoia API to take resetting code as &[u8] instead of &str.
This commit is contained in:
parent
d3e49e0bb3
commit
fbdb9e87b2
2 changed files with 6 additions and 6 deletions
|
@ -395,12 +395,12 @@ impl Admin<'_, '_> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_resetting_code(&mut self, pin: &str) -> Result<(), Error> {
|
||||
self.oc.opt.set_resetting_code(pin.as_bytes())
|
||||
pub fn set_resetting_code(&mut self, pin: &[u8]) -> Result<(), Error> {
|
||||
self.oc.opt.set_resetting_code(pin)
|
||||
}
|
||||
|
||||
pub fn reset_user_pin(&mut self, new: &str) -> Result<(), Error> {
|
||||
self.oc.opt.reset_retry_counter_pw1(new.as_bytes(), None)
|
||||
pub fn reset_user_pin(&mut self, new: &[u8]) -> Result<(), Error> {
|
||||
self.oc.opt.reset_retry_counter_pw1(new, None)
|
||||
}
|
||||
|
||||
/// Upload a ValidErasedKeyAmalgamation to the card as a specific KeyType.
|
||||
|
|
|
@ -114,7 +114,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
rpassword::read_password_from_tty(Some("Repeat the new resetting code: "))?;
|
||||
|
||||
if newpin1 == newpin2 {
|
||||
admin.set_resetting_code(&newpin1)?;
|
||||
admin.set_resetting_code(newpin1.as_bytes())?;
|
||||
} else {
|
||||
return Err(anyhow::anyhow!("PINs do not match.").into());
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
// reset to new user pin
|
||||
open.reset_user_pin(rst.as_bytes(), newpin1.as_bytes())
|
||||
} else if let Some(mut admin) = open.admin_card() {
|
||||
admin.reset_user_pin(&newpin1)
|
||||
admin.reset_user_pin(newpin1.as_bytes())
|
||||
} else {
|
||||
return Err(anyhow::anyhow!("Failed to use card in admin-mode.").into());
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue