Skip to content

Commit

Permalink
Add SecretFactory::make_secret(), review non-serde serialization methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fjarri committed Jan 7, 2023
1 parent 06066e9 commit 684a202
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 210 deletions.
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
5 changes: 3 additions & 2 deletions umbral-pre/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ rmp-serde = "0.15"
[features]
default = ["default-rng"]
bench-internals = ["default-rng"]
bindings-python = ["pyo3", "std", "derive_more", "serde-support", "rmp-serde"]
bindings-wasm = ["js-sys", "serde-support", "rmp-serde", "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

0 comments on commit 684a202

Please sign in to comment.