Skip to content

Leave serde as the only serialization method #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 8 additions & 54 deletions umbral-pre-python/umbral_pre/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,10 @@ class SecretKey:
def public_key(self) -> PublicKey:
...

def to_secret_bytes(self) -> bytes:
...

@staticmethod
def from_bytes(data: bytes) -> SecretKey:
...

@staticmethod
def serialized_size() -> int:
...


class SecretKeyFactory:

Expand All @@ -36,35 +29,27 @@ class SecretKeyFactory:
def from_secure_randomness(seed: bytes) -> SecretKeyFactory:
...

def make_key(self, label: bytes) -> SecretKey:
def make_secret(self, label: bytes) -> bytes:
...

def make_factory(self, label: bytes) -> SecretKeyFactory:
...

def to_secret_bytes(self) -> bytes:
def make_key(self, label: bytes) -> SecretKey:
...

@staticmethod
def from_bytes(data: bytes) -> SecretKeyFactory:
def make_factory(self, label: bytes) -> SecretKeyFactory:
...

@staticmethod
def serialized_size() -> int:
def from_secure_randomness(data: bytes) -> SecretKeyFactory:
...


class PublicKey:

@staticmethod
def from_bytes(data: bytes) -> PublicKey:
...

def __bytes__(self) -> bytes:
def from_compressed_bytes(data: bytes) -> PublicKey:
...

@staticmethod
def serialized_size() -> int:
def to_compressed_bytes(self) -> bytes:
...


Expand All @@ -86,23 +71,15 @@ class Signature:
...

@staticmethod
def from_bytes(data: bytes) -> Signature:
def from_der_bytes(data: bytes) -> Signature:
...

def __bytes__(self) -> bytes:
...

@staticmethod
def serialized_size() -> int:
def to_der_bytes(self) -> bytes:
...


class Capsule:

@staticmethod
def serialized_size() -> int:
...

@staticmethod
def from_bytes(data: bytes) -> Capsule:
...
Expand Down Expand Up @@ -139,26 +116,15 @@ class KeyFrag:
def __bytes__(self) -> bytes:
...

@staticmethod
def serialized_size() -> int:
...


class VerifiedKeyFrag:

def from_verified_bytes(self, data: bytes) -> VerifiedKeyFrag:
...

def __bytes__(self) -> bytes:
...

def unverify(self) -> KeyFrag:
...

@staticmethod
def serialized_size() -> int:
...


def generate_kfrags(
delegating_sk: SecretKey,
Expand Down Expand Up @@ -193,27 +159,15 @@ class CapsuleFrag:
def __bytes__(self) -> bytes:
...

@staticmethod
def serialized_size() -> int:
...


class VerifiedCapsuleFrag:

@staticmethod
def from_verified_bytes(data: bytes) -> VerifiedCapsuleFrag:
...

def __bytes__(self) -> bytes:
...

def unverify(self) -> CapsuleFrag:
...

@staticmethod
def serialized_size() -> int:
...


def reencrypt(capsule: Capsule, kfrag: VerifiedKeyFrag) -> VerifiedCapsuleFrag:
...
Expand Down
6 changes: 4 additions & 2 deletions umbral-pre/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ typenum = "1.13" # typenum is a 2018-edition crate starting from 1.13
getrandom = { version = "0.2", optional = true, default-features = false, features = ["js"] }
subtle = { version = "2.4", default-features = false }
zeroize = { version = "1.5", default-features = false, features = ["derive"] }
rmp-serde = { version = "0.15", optional = true }

[dev-dependencies]
criterion = { version = "0.3", features = ["html_reports"] }
Expand All @@ -45,9 +46,10 @@ rmp-serde = "0.15"
[features]
default = ["default-rng"]
bench-internals = ["default-rng"]
bindings-python = ["pyo3", "std", "derive_more"]
bindings-wasm = ["js-sys", "wasm-bindgen", "derive_more", "wasm-bindgen-derive"]
bindings-python = ["pyo3", "std", "derive_more", "default-serialization"]
bindings-wasm = ["js-sys", "default-serialization", "wasm-bindgen", "derive_more", "wasm-bindgen-derive"]
default-rng = ["getrandom", "rand_core/getrandom"]
default-serialization = ["serde-support", "rmp-serde"]
serde-support = ["serde"]
std = []

Expand Down
Loading