MessageKit now casts strictly to ciphertext. Moved previous serialization to to_bytes, which we'll start to implement as a component-style interface.

pull/165/head
jMyles 2018-02-14 00:16:26 -08:00
parent 9325222885
commit 112746363b
1 changed files with 4 additions and 2 deletions

View File

@ -31,13 +31,15 @@ class MessageKit(CryptoKit):
self.alice_pubkey
)
def __bytes__(self):
def to_bytes(self, include_alice_pubkey=True):
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 += self.ciphertext
return as_bytes
def __bytes__(self):
return self.ciphertext
class MapKit(MessageKit):
def __init__(self, ciphertext, capsule, treasure_map, alice_pubkey=None):