diff --git a/ferveo-python/ferveo/__init__.pyi b/ferveo-python/ferveo/__init__.pyi index 503bc77e..9fc82342 100644 --- a/ferveo-python/ferveo/__init__.pyi +++ b/ferveo-python/ferveo/__init__.pyi @@ -7,7 +7,7 @@ class Keypair: ... @staticmethod - def from_secure_randomness(bytes: bytes) -> Keypair: + def from_secure_randomness(secure_randomness: bytes) -> Keypair: ... @staticmethod @@ -15,7 +15,7 @@ class Keypair: ... @staticmethod - def from_bytes(bytes: bytes) -> Keypair: + def from_bytes(data: bytes) -> Keypair: ... def __bytes__(self) -> bytes: @@ -27,7 +27,7 @@ class Keypair: @final class FerveoPublicKey: @staticmethod - def from_bytes(bytes: bytes) -> FerveoPublicKey: + def from_bytes(data: bytes) -> FerveoPublicKey: ... def __bytes__(self) -> bytes: @@ -53,7 +53,7 @@ class Validator: @final class Transcript: @staticmethod - def from_bytes(bytes: bytes) -> Transcript: + def from_bytes(data: bytes) -> Transcript: ... def __bytes__(self) -> bytes: @@ -62,7 +62,7 @@ class Transcript: @final class DkgPublicKey: @staticmethod - def from_bytes(bytes: bytes) -> DkgPublicKey: + def from_bytes(data: bytes) -> DkgPublicKey: ... def __bytes__(self) -> bytes: @@ -109,7 +109,7 @@ class Dkg: @final class Ciphertext: @staticmethod - def from_bytes(bytes: bytes) -> Ciphertext: + def from_bytes(data: bytes) -> Ciphertext: ... def __bytes__(self) -> bytes: @@ -118,7 +118,7 @@ class Ciphertext: @final class DecryptionShareSimple: @staticmethod - def from_bytes(bytes: bytes) -> DecryptionShareSimple: + def from_bytes(data: bytes) -> DecryptionShareSimple: ... def __bytes__(self) -> bytes: @@ -126,7 +126,7 @@ class DecryptionShareSimple: @final class DecryptionSharePrecomputed: @staticmethod - def from_bytes(bytes: bytes) -> DecryptionSharePrecomputed: + def from_bytes(data: bytes) -> DecryptionSharePrecomputed: ... def __bytes__(self) -> bytes: @@ -160,7 +160,7 @@ class AggregatedTranscript: ... @staticmethod - def from_bytes(bytes: bytes) -> AggregatedTranscript: + def from_bytes(data: bytes) -> AggregatedTranscript: ... def __bytes__(self) -> bytes: @@ -170,7 +170,7 @@ class AggregatedTranscript: class SharedSecret: @staticmethod - def from_bytes(bytes: bytes) -> SharedSecret: + def from_bytes(data: bytes) -> SharedSecret: ... def __bytes__(self) -> bytes: diff --git a/ferveo-python/test/test_ferveo.py b/ferveo-python/test/test_ferveo.py index 38fa1f06..9406a5ae 100644 --- a/ferveo-python/test/test_ferveo.py +++ b/ferveo-python/test/test_ferveo.py @@ -131,14 +131,15 @@ def test_precomputed_tdec_doesnt_have_enough_messages(): PARAMS = [ (1, FerveoVariant.simple), + (3, FerveoVariant.simple), (4, FerveoVariant.simple), + (7, FerveoVariant.simple), (8, FerveoVariant.simple), - (32, FerveoVariant.simple), (1, FerveoVariant.precomputed), + (3, FerveoVariant.precomputed), (4, FerveoVariant.precomputed), + (7, FerveoVariant.precomputed), (8, FerveoVariant.precomputed), - (32, FerveoVariant.precomputed), - ] TEST_CASES_WITH_THRESHOLD_RANGE = [] diff --git a/ferveo/src/bindings_python.rs b/ferveo/src/bindings_python.rs index eab2a3db..d746fd1c 100644 --- a/ferveo/src/bindings_python.rs +++ b/ferveo/src/bindings_python.rs @@ -177,8 +177,9 @@ macro_rules! generate_bytes_serialization { #[pymethods] impl $struct_name { #[staticmethod] - pub fn from_bytes(bytes: &[u8]) -> PyResult { - from_py_bytes(bytes).map(Self) + #[pyo3(signature = (data))] + pub fn from_bytes(data: &[u8]) -> PyResult { + from_py_bytes(data).map(Self) } fn __bytes__(&self) -> PyResult { @@ -193,13 +194,11 @@ macro_rules! generate_boxed_bytes_serialization { #[pymethods] impl $struct_name { #[staticmethod] - #[pyo3(signature = (bytes))] - pub fn from_bytes(bytes: &[u8]) -> PyResult { - Ok($struct_name( - $inner_struct_name::from_bytes(bytes).map_err(|err| { - FerveoPythonError::Other(err.to_string()) - })?, - )) + #[pyo3(signature = (data))] + pub fn from_bytes(data: &[u8]) -> PyResult { + Ok($struct_name($inner_struct_name::from_bytes(data).map_err( + |err| FerveoPythonError::Other(err.to_string()), + )?)) } fn __bytes__(&self) -> PyResult { @@ -304,9 +303,10 @@ impl Keypair { } #[staticmethod] - pub fn from_secure_randomness(bytes: &[u8]) -> PyResult { - let keypair = api::Keypair::from_secure_randomness(bytes) - .map_err(|err| FerveoPythonError::Other(err.to_string()))?; + pub fn from_secure_randomness(secure_randomness: &[u8]) -> PyResult { + let keypair = + api::Keypair::from_secure_randomness(secure_randomness) + .map_err(|err| FerveoPythonError::Other(err.to_string()))?; Ok(Self(keypair)) }