From 00bb816d111c556c84787276a7d1a5b7c4b7fb83 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 19 Nov 2015 17:11:27 -0800 Subject: [PATCH] remove close-on-error from derive_key(), for now In the twisted-style code, the close_on_error() decorator forces the return value to be a Deferred, which is all wrong for internal uses of derive_key() (verification string and confirmation message). It might be useful to have a synchronous form of close_on_error(), but since the actual close() is async, that's not very straightforward. So for now, tolerate unclosed Wormhole objects when someone calls derive_key() too early, or with a non-unicode type string. --- src/wormhole/blocking/transcribe.py | 1 - src/wormhole/twisted/transcribe.py | 1 - 2 files changed, 2 deletions(-) diff --git a/src/wormhole/blocking/transcribe.py b/src/wormhole/blocking/transcribe.py index 167fd9f..bd83ea9 100644 --- a/src/wormhole/blocking/transcribe.py +++ b/src/wormhole/blocking/transcribe.py @@ -293,7 +293,6 @@ class Wormhole: idSymmetric=to_bytes(self._appid)) self.msg1 = self.sp.start() - @close_on_error def derive_key(self, purpose, length=SecretBox.KEY_SIZE): if not isinstance(purpose, type(u"")): raise TypeError(type(purpose)) return HKDF(self.key, length, CTXinfo=to_bytes(purpose)) diff --git a/src/wormhole/twisted/transcribe.py b/src/wormhole/twisted/transcribe.py index e71cd42..6ea9e41 100644 --- a/src/wormhole/twisted/transcribe.py +++ b/src/wormhole/twisted/transcribe.py @@ -331,7 +331,6 @@ class Wormhole: self.msg1 = d["msg1"].decode("hex") return self - #@close_on_error # XXX def derive_key(self, purpose, length=SecretBox.KEY_SIZE): if not isinstance(purpose, type(u"")): raise TypeError(type(purpose)) if self.key is None: