4
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
shimun 2020-10-11 22:23:45 +02:00
parent 99a536f2d4
commit 88b9677e7a
Signed by: shimun
GPG Key ID: E81D8382DC2F971B
3 changed files with 5 additions and 4 deletions

View File

@ -33,6 +33,9 @@ fn derive_secret(
timeout: u64,
pin: Option<&str>,
) -> Fido2LuksResult<([u8; 32], FidoCredential)> {
if credentials.len() == 0 {
return Err(Fido2LuksError::InsufficientCredentials);
}
let timeout = Duration::from_secs(timeout);
let start = SystemTime::now();

View File

@ -31,6 +31,8 @@ pub enum Fido2LuksError {
StringEncodingError { cause: FromUtf8Error },
#[fail(display = "not an hex string: {}", string)]
HexEncodingError { string: String },
#[fail(display = "couldn't obtain at least one credential")]
InsufficientCredentials,
}
impl Fido2LuksError {

View File

@ -103,10 +103,6 @@ impl LuksDevice {
Ok(())
}
pub fn add_credential(&mut self, slot: u32, credential: Vec<u8>) -> Fido2LuksResult<()> {
self.add_token(&Fido2LuksToken::with_credentials(&[credential], slot))
}
pub fn remove_token(&mut self, token: u32) -> Fido2LuksResult<()> {
self.require_luks2()?;
self.device