ask password twice

This commit is contained in:
2019-09-20 00:52:04 +02:00
parent 46bcc2f52a
commit 8a9cf9019d
2 changed files with 30 additions and 4 deletions

View File

@@ -1,12 +1,12 @@
use ctap::FidoError;
use std::io;
use std::{fmt, io};
pub type Fido2LuksResult<T> = Result<T, Fido2LuksError>;
#[derive(Debug, Fail)]
pub enum Fido2LuksError {
#[fail(display = "unable to retrieve password: {}", cause)]
AskPassError { cause: io::Error },
AskPassError { cause: AskPassError },
#[fail(display = "unable to read keyfile: {}", cause)]
KeyfileError { cause: io::Error },
#[fail(display = "authenticator error: {}", cause)]
@@ -32,6 +32,14 @@ pub enum ConfigurationError {
MissingField(String),
}
#[derive(Debug, Fail)]
pub enum AskPassError {
#[fail(display = "unable to retrieve password: {}", _0)]
IO(io::Error),
#[fail(display = "provided passwords don't match")]
Mismatch,
}
impl From<serde_json::error::Error> for Fido2LuksError {
fn from(e: serde_json::error::Error) -> Self {
Fido2LuksError::ConfigurationError {