This commit is contained in:
parent
d4094b8a6a
commit
985f6f664b
21
src/lib.rs
21
src/lib.rs
@ -79,13 +79,16 @@ impl PamFido2Luks {
|
|||||||
.collect();
|
.collect();
|
||||||
let credentials: Vec<&FidoCredential> = credentials.iter().collect();
|
let credentials: Vec<&FidoCredential> = credentials.iter().collect();
|
||||||
if !credentials.is_empty() {
|
if !credentials.is_empty() {
|
||||||
let secret = util::sha256(&[&perform_challenge(
|
let secret = util::sha256(&[
|
||||||
&credentials[..],
|
password.as_bytes(),
|
||||||
&util::sha256(&[password.as_bytes()]),
|
&perform_challenge(
|
||||||
Duration::from_secs(15),
|
&credentials[..],
|
||||||
pin.map(AsRef::as_ref),
|
&util::sha256(&[password.as_bytes()]),
|
||||||
)?
|
Duration::from_secs(15),
|
||||||
.0[..]]);
|
pin.map(AsRef::as_ref),
|
||||||
|
)?
|
||||||
|
.0[..],
|
||||||
|
]);
|
||||||
device.activate(name.as_str(), &secret[..], None)?;
|
device.activate(name.as_str(), &secret[..], None)?;
|
||||||
} else {
|
} else {
|
||||||
unimplemented!("custom error")
|
unimplemented!("custom error")
|
||||||
@ -112,11 +115,11 @@ impl PamServiceModule for PamFido2Luks {
|
|||||||
Ok(_) => PamError::SUCCESS,
|
Ok(_) => PamError::SUCCESS,
|
||||||
Err(e) => match e {
|
Err(e) => match e {
|
||||||
//TODO: output more detailed error
|
//TODO: output more detailed error
|
||||||
_ => dbg!(PamError::AUTH_ERR),
|
_ => PamError::AUTH_ERR,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbg!(PamError::AUTH_ERR)
|
PamError::AUTH_ERR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user