From 736199a8ded018dab9156c551bf4843af74ce579 Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Sun, 3 Sep 2023 22:38:19 +0200 Subject: [PATCH] openpgp-card-sequoia: move all uif_* getters into uif() --- openpgp-card-sequoia/src/lib.rs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/openpgp-card-sequoia/src/lib.rs b/openpgp-card-sequoia/src/lib.rs index 360c661..dea3da7 100644 --- a/openpgp-card-sequoia/src/lib.rs +++ b/openpgp-card-sequoia/src/lib.rs @@ -539,20 +539,17 @@ impl<'a> Card> { self.state.ard.key_information() } - pub fn uif_signing(&self) -> Result, Error> { - self.state.ard.uif_pso_cds() - } - - pub fn uif_decryption(&self) -> Result, Error> { - self.state.ard.uif_pso_dec() - } - - pub fn uif_authentication(&self) -> Result, Error> { - self.state.ard.uif_pso_aut() - } - - pub fn uif_attestation(&self) -> Result, Error> { - self.state.ard.uif_attestation() + pub fn uif(&self, key_type: KeyType) -> Result, Error> { + match key_type { + KeyType::Signing => self.state.ard.uif_pso_cds(), + KeyType::Decryption => self.state.ard.uif_pso_dec(), + KeyType::Authentication => self.state.ard.uif_pso_aut(), + KeyType::Attestation => self.state.ard.uif_attestation(), + _ => Err(Error::UnsupportedFeature(format!( + "Can't get UIF for key_type {:?}", + key_type, + ))), + } } // --- optional private DOs (0101 - 0104) ---