From e34285dc685062660184ace02dd1732af0fe579d Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Fri, 16 Jul 2021 17:23:47 +0200 Subject: [PATCH] Add helper fn vka_as_uploadable_key() --- openpgp-card-sequoia/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openpgp-card-sequoia/src/lib.rs b/openpgp-card-sequoia/src/lib.rs index 6d825f1..049c34c 100644 --- a/openpgp-card-sequoia/src/lib.rs +++ b/openpgp-card-sequoia/src/lib.rs @@ -57,6 +57,15 @@ impl SequoiaKey { } } +/// Helper fn: get a CardUploadableKey for a ValidErasedKeyAmalgamation +pub fn vka_as_uploadable_key( + vka: ValidErasedKeyAmalgamation, + password: Option, +) -> Box { + let sqk = SequoiaKey::new(vka, password); + Box::new(sqk) +} + /// Implement the `CardUploadableKey` trait that openpgp-card uses to /// upload (sub)keys to a card. impl CardUploadableKey for SequoiaKey {