From fbb97be59d991a263233a0b876da982143b2cbf2 Mon Sep 17 00:00:00 2001 From: Piotr Roslaniec Date: Tue, 11 Jul 2023 14:46:57 +0200 Subject: [PATCH] add api conversion method to FerveoVariant --- ferveo/src/bindings_python.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ferveo/src/bindings_python.rs b/ferveo/src/bindings_python.rs index d746fd1c..0c5db521 100644 --- a/ferveo/src/bindings_python.rs +++ b/ferveo/src/bindings_python.rs @@ -268,7 +268,7 @@ pub fn decrypt_with_shared_secret( } #[pyclass(module = "ferveo")] -struct FerveoVariant {} +pub struct FerveoVariant {} #[pymethods] impl FerveoVariant { @@ -283,6 +283,13 @@ impl FerveoVariant { } } +impl FerveoVariant { + pub fn inner_form_string(variant: &str) -> PyResult { + api::FerveoVariant::from_string(variant) + .map_err(|err| FerveoPythonError::FerveoError(err).into()) + } +} + #[pyclass(module = "ferveo")] #[derive(derive_more::AsRef)] pub struct SharedSecret(api::SharedSecret);