4
This commit is contained in:
parent
99a536f2d4
commit
88b9677e7a
@ -33,6 +33,9 @@ fn derive_secret(
|
|||||||
timeout: u64,
|
timeout: u64,
|
||||||
pin: Option<&str>,
|
pin: Option<&str>,
|
||||||
) -> Fido2LuksResult<([u8; 32], FidoCredential)> {
|
) -> Fido2LuksResult<([u8; 32], FidoCredential)> {
|
||||||
|
if credentials.len() == 0 {
|
||||||
|
return Err(Fido2LuksError::InsufficientCredentials);
|
||||||
|
}
|
||||||
let timeout = Duration::from_secs(timeout);
|
let timeout = Duration::from_secs(timeout);
|
||||||
let start = SystemTime::now();
|
let start = SystemTime::now();
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ pub enum Fido2LuksError {
|
|||||||
StringEncodingError { cause: FromUtf8Error },
|
StringEncodingError { cause: FromUtf8Error },
|
||||||
#[fail(display = "not an hex string: {}", string)]
|
#[fail(display = "not an hex string: {}", string)]
|
||||||
HexEncodingError { string: String },
|
HexEncodingError { string: String },
|
||||||
|
#[fail(display = "couldn't obtain at least one credential")]
|
||||||
|
InsufficientCredentials,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Fido2LuksError {
|
impl Fido2LuksError {
|
||||||
|
@ -103,10 +103,6 @@ impl LuksDevice {
|
|||||||
Ok(())
|
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<()> {
|
pub fn remove_token(&mut self, token: u32) -> Fido2LuksResult<()> {
|
||||||
self.require_luks2()?;
|
self.require_luks2()?;
|
||||||
self.device
|
self.device
|
||||||
|
Loading…
x
Reference in New Issue
Block a user