load_and_decrtypt_key: allow function closures to readf passphrase

This commit is contained in:
Dietmar Maurer 2019-10-16 13:23:52 +02:00
parent 60ffa9649c
commit 649c5ee7b1

View File

@ -148,7 +148,7 @@ pub fn encrypt_key_with_passphrase(
})
}
pub fn load_and_decrtypt_key(path: &std::path::Path, passphrase: fn() -> Result<Vec<u8>, Error>) -> Result<([u8;32], DateTime<Local>), Error> {
pub fn load_and_decrtypt_key(path: &std::path::Path, passphrase: &dyn Fn() -> Result<Vec<u8>, Error>) -> Result<([u8;32], DateTime<Local>), Error> {
let raw = file_get_contents(&path)?;
let data = String::from_utf8(raw)?;