diff --git a/src/wormhole/blocking/transcribe.py b/src/wormhole/blocking/transcribe.py index f19c18c..09292f6 100644 --- a/src/wormhole/blocking/transcribe.py +++ b/src/wormhole/blocking/transcribe.py @@ -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) diff --git a/src/wormhole/twisted/transcribe.py b/src/wormhole/twisted/transcribe.py index c8e7f9b..9d4be6a 100644 --- a/src/wormhole/twisted/transcribe.py +++ b/src/wormhole/twisted/transcribe.py @@ -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):