Add a helper method to construct a CardUploadableKey from a ValidErasedKeyAmalgamation

This commit is contained in:
Heiko Schaefer 2021-07-14 18:02:11 +02:00
parent 42c4f14d57
commit 38fb6bd970

View file

@ -58,6 +58,14 @@ impl SequoiaKey {
} }
} }
pub fn vka_as_uploadable_key(
vka: ValidErasedKeyAmalgamation<SecretParts>,
password: Option<String>,
) -> Box<dyn CardUploadableKey> {
let sqk = SequoiaKey::new(vka, password);
Box::new(sqk)
}
/// Implement the `CardUploadableKey` trait that openpgp-card uses to /// Implement the `CardUploadableKey` trait that openpgp-card uses to
/// upload (sub)keys to a card. /// upload (sub)keys to a card.
impl CardUploadableKey for SequoiaKey { impl CardUploadableKey for SequoiaKey {