From 112746363b454b7abee059c1f5370f86b4dbd2cc Mon Sep 17 00:00:00 2001 From: jMyles Date: Wed, 14 Feb 2018 00:16:26 -0800 Subject: [PATCH] MessageKit now casts strictly to ciphertext. Moved previous serialization to to_bytes, which we'll start to implement as a component-style interface. --- nkms/crypto/kits.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nkms/crypto/kits.py b/nkms/crypto/kits.py index 70c4ca7a0..81e010b2e 100644 --- a/nkms/crypto/kits.py +++ b/nkms/crypto/kits.py @@ -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):