This commit is contained in:
parent
ddfd24a098
commit
5f107cd337
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -369,7 +369,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fido2luks"
|
name = "fido2luks"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ctap_hmac",
|
"ctap_hmac",
|
||||||
"failure",
|
"failure",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "fido2luks"
|
name = "fido2luks"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
authors = ["shimunn <shimun@shimun.net>"]
|
authors = ["shimunn <shimun@shimun.net>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
12
src/luks.rs
12
src/luks.rs
@ -235,11 +235,15 @@ pub fn replace_key<P: AsRef<Path>>(
|
|||||||
if let Some(id) = credential_id {
|
if let Some(id) = credential_id {
|
||||||
if check_luks2(&mut device).is_ok() {
|
if check_luks2(&mut device).is_ok() {
|
||||||
let token = find_token(&mut device, slot)?.map(|(t, _)| t);
|
let token = find_token(&mut device, slot)?.map(|(t, _)| t);
|
||||||
|
let json = serde_json::to_value(&Fido2LuksToken::new(id, slot)).unwrap();
|
||||||
if let Some(token) = token {
|
if let Some(token) = token {
|
||||||
device.token_handle().json_set(TokenInput::ReplaceToken(
|
device
|
||||||
token,
|
.token_handle()
|
||||||
&serde_json::to_value(&Fido2LuksToken::new(id, slot)).unwrap(),
|
.json_set(TokenInput::ReplaceToken(token, &json))?;
|
||||||
))?;
|
} else {
|
||||||
|
device
|
||||||
|
.token_handle()
|
||||||
|
.json_set(TokenInput::AddToken(&json))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user