Skip to content

Commit 684a202

Browse files
committed
Add SecretFactory::make_secret(), review non-serde serialization methods
1 parent 06066e9 commit 684a202

File tree

13 files changed

+231
-210
lines changed

13 files changed

+231
-210
lines changed

umbral-pre-python/umbral_pre/__init__.pyi

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,10 @@ class SecretKey:
1010
def public_key(self) -> PublicKey:
1111
...
1212

13-
def to_secret_bytes(self) -> bytes:
14-
...
15-
1613
@staticmethod
1714
def from_bytes(data: bytes) -> SecretKey:
1815
...
1916

20-
@staticmethod
21-
def serialized_size() -> int:
22-
...
23-
2417

2518
class SecretKeyFactory:
2619

@@ -36,35 +29,27 @@ class SecretKeyFactory:
3629
def from_secure_randomness(seed: bytes) -> SecretKeyFactory:
3730
...
3831

39-
def make_key(self, label: bytes) -> SecretKey:
32+
def make_secret(self, label: bytes) -> bytes:
4033
...
4134

42-
def make_factory(self, label: bytes) -> SecretKeyFactory:
43-
...
44-
45-
def to_secret_bytes(self) -> bytes:
35+
def make_key(self, label: bytes) -> SecretKey:
4636
...
4737

48-
@staticmethod
49-
def from_bytes(data: bytes) -> SecretKeyFactory:
38+
def make_factory(self, label: bytes) -> SecretKeyFactory:
5039
...
5140

5241
@staticmethod
53-
def serialized_size() -> int:
42+
def from_secure_randomness(data: bytes) -> SecretKeyFactory:
5443
...
5544

5645

5746
class PublicKey:
5847

5948
@staticmethod
60-
def from_bytes(data: bytes) -> PublicKey:
61-
...
62-
63-
def __bytes__(self) -> bytes:
49+
def from_compressed_bytes(data: bytes) -> PublicKey:
6450
...
6551

66-
@staticmethod
67-
def serialized_size() -> int:
52+
def to_compressed_bytes(self) -> bytes:
6853
...
6954

7055

@@ -86,23 +71,15 @@ class Signature:
8671
...
8772

8873
@staticmethod
89-
def from_bytes(data: bytes) -> Signature:
74+
def from_der_bytes(data: bytes) -> Signature:
9075
...
9176

92-
def __bytes__(self) -> bytes:
93-
...
94-
95-
@staticmethod
96-
def serialized_size() -> int:
77+
def to_der_bytes(self) -> bytes:
9778
...
9879

9980

10081
class Capsule:
10182

102-
@staticmethod
103-
def serialized_size() -> int:
104-
...
105-
10683
@staticmethod
10784
def from_bytes(data: bytes) -> Capsule:
10885
...
@@ -139,26 +116,15 @@ class KeyFrag:
139116
def __bytes__(self) -> bytes:
140117
...
141118

142-
@staticmethod
143-
def serialized_size() -> int:
144-
...
145-
146119

147120
class VerifiedKeyFrag:
148121

149-
def from_verified_bytes(self, data: bytes) -> VerifiedKeyFrag:
150-
...
151-
152122
def __bytes__(self) -> bytes:
153123
...
154124

155125
def unverify(self) -> KeyFrag:
156126
...
157127

158-
@staticmethod
159-
def serialized_size() -> int:
160-
...
161-
162128

163129
def generate_kfrags(
164130
delegating_sk: SecretKey,
@@ -193,27 +159,15 @@ class CapsuleFrag:
193159
def __bytes__(self) -> bytes:
194160
...
195161

196-
@staticmethod
197-
def serialized_size() -> int:
198-
...
199-
200162

201163
class VerifiedCapsuleFrag:
202164

203-
@staticmethod
204-
def from_verified_bytes(data: bytes) -> VerifiedCapsuleFrag:
205-
...
206-
207165
def __bytes__(self) -> bytes:
208166
...
209167

210168
def unverify(self) -> CapsuleFrag:
211169
...
212170

213-
@staticmethod
214-
def serialized_size() -> int:
215-
...
216-
217171

218172
def reencrypt(capsule: Capsule, kfrag: VerifiedKeyFrag) -> VerifiedCapsuleFrag:
219173
...

umbral-pre/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ rmp-serde = "0.15"
4646
[features]
4747
default = ["default-rng"]
4848
bench-internals = ["default-rng"]
49-
bindings-python = ["pyo3", "std", "derive_more", "serde-support", "rmp-serde"]
50-
bindings-wasm = ["js-sys", "serde-support", "rmp-serde", "wasm-bindgen", "derive_more", "wasm-bindgen-derive"]
49+
bindings-python = ["pyo3", "std", "derive_more", "default-serialization"]
50+
bindings-wasm = ["js-sys", "default-serialization", "wasm-bindgen", "derive_more", "wasm-bindgen-derive"]
5151
default-rng = ["getrandom", "rand_core/getrandom"]
52+
default-serialization = ["serde-support", "rmp-serde"]
5253
serde-support = ["serde"]
5354
std = []
5455

0 commit comments

Comments
 (0)