improve typechecking, nacl.utils.EncryptedMessage is not a bytestring
but it derives from one
This commit is contained in:
parent
a46a405487
commit
77b80495c9
|
@ -135,7 +135,7 @@ class Wormhole:
|
|||
return channel_id
|
||||
|
||||
def derive_key(self, purpose, length=SecretBox.KEY_SIZE):
|
||||
if type(purpose) is not type(b""): raise UsageError
|
||||
if not isinstance(purpose, type(b"")): raise UsageError
|
||||
return HKDF(self.key, length, CTXinfo=purpose)
|
||||
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ class SymmetricWormhole:
|
|||
if self.key is None:
|
||||
# call after get_verifier() or get_data()
|
||||
raise UsageError
|
||||
if type(purpose) is not type(b""): raise UsageError
|
||||
if not isinstance(purpose, type(b"")): raise UsageError
|
||||
return HKDF(self.key, length, CTXinfo=purpose)
|
||||
|
||||
def _encrypt_data(self, key, data):
|
||||
|
|
Loading…
Reference in New Issue
Block a user