mirror of https://github.com/nucypher/nucypher.git
MessageKit now casts strictly to ciphertext. Moved previous serialization to to_bytes, which we'll start to implement as a component-style interface.
parent
9325222885
commit
112746363b
|
@ -31,13 +31,15 @@ class MessageKit(CryptoKit):
|
||||||
self.alice_pubkey
|
self.alice_pubkey
|
||||||
)
|
)
|
||||||
|
|
||||||
def __bytes__(self):
|
def to_bytes(self, include_alice_pubkey=True):
|
||||||
as_bytes = bytes(self.capsule)
|
as_bytes = bytes(self.capsule)
|
||||||
if self.alice_pubkey:
|
if include_alice_pubkey and self.alice_pubkey:
|
||||||
as_bytes += bytes(self.alice_pubkey)
|
as_bytes += bytes(self.alice_pubkey)
|
||||||
as_bytes += self.ciphertext
|
as_bytes += self.ciphertext
|
||||||
return as_bytes
|
return as_bytes
|
||||||
|
|
||||||
|
def __bytes__(self):
|
||||||
|
return self.ciphertext
|
||||||
|
|
||||||
class MapKit(MessageKit):
|
class MapKit(MessageKit):
|
||||||
def __init__(self, ciphertext, capsule, treasure_map, alice_pubkey=None):
|
def __init__(self, ciphertext, capsule, treasure_map, alice_pubkey=None):
|
||||||
|
|
Loading…
Reference in New Issue