Remove From<Path> for Certificate
All checks were successful
continuous-integration/drone/push Build is passing

Deserialization from a path is a heavy conversion. This should be done by
an explicit `Certificate::new_from_cbor` call.
This commit is contained in:
Armin Friedl 2020-02-08 09:56:41 +01:00
parent 74f84913c0
commit 6a22429632
Signed by: armin
GPG key ID: 48C726EEE7FBCBC8
2 changed files with 1 additions and 8 deletions

View file

@ -106,10 +106,3 @@ impl Certificate {
Ok(sealedbox::seal(message, pk)) Ok(sealedbox::seal(message, pk))
} }
} }
impl <T: AsRef<Path>> From<T> for Certificate {
fn from(path: T) -> Self {
Certificate::new_from_cbor(&path)
.expect(&format!{"Could not read certificate from {}", path.as_ref().display()})
}
}

View file

@ -53,7 +53,7 @@ impl Keyring {
where T: AsRef<Path> where T: AsRef<Path>
{ {
Keyring { Keyring {
certificate: Certificate::from(certificate_path), certificate: Certificate::new_from_cbor(certificate_path).unwrap(),
known_keys: HashMap::new() known_keys: HashMap::new()
} }
} }