refactor luks code #1

Merged
shimun merged 11 commits from luks_refr into master 2020-06-22 22:47:21 +02:00
Showing only changes of commit 36dc36d454 - Show all commits

View File

@ -671,13 +671,7 @@ pub fn run_cli() -> Fido2LuksResult<()> {
token.credential = token
.credential
.into_iter()
.filter(|cred| {
!credentials
.ids
.0
.iter()
.any(|h| &h.0[..] == cred.as_bytes())
})
.filter(|cred| !credentials.ids.0.iter().any(|h| &h.to_string() == cred))
.collect();
dev.update_token(id, &token)?;
}
@ -690,7 +684,7 @@ pub fn run_cli() -> Fido2LuksResult<()> {
let mut remove = Vec::new();
for token in dev.tokens()? {
let (id, token) = token?;
if token.keyslots.is_empty() {
if token.keyslots.is_empty() || token.credential.is_empty() {
creds.extend(token.credential);
remove.push(id);
}