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.
This commit is contained in:
parent
22a1ce2eda
commit
00bb816d11
|
@ -293,7 +293,6 @@ class Wormhole:
|
||||||
idSymmetric=to_bytes(self._appid))
|
idSymmetric=to_bytes(self._appid))
|
||||||
self.msg1 = self.sp.start()
|
self.msg1 = self.sp.start()
|
||||||
|
|
||||||
@close_on_error
|
|
||||||
def derive_key(self, purpose, length=SecretBox.KEY_SIZE):
|
def derive_key(self, purpose, length=SecretBox.KEY_SIZE):
|
||||||
if not isinstance(purpose, type(u"")): raise TypeError(type(purpose))
|
if not isinstance(purpose, type(u"")): raise TypeError(type(purpose))
|
||||||
return HKDF(self.key, length, CTXinfo=to_bytes(purpose))
|
return HKDF(self.key, length, CTXinfo=to_bytes(purpose))
|
||||||
|
|
|
@ -331,7 +331,6 @@ class Wormhole:
|
||||||
self.msg1 = d["msg1"].decode("hex")
|
self.msg1 = d["msg1"].decode("hex")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
#@close_on_error # XXX
|
|
||||||
def derive_key(self, purpose, length=SecretBox.KEY_SIZE):
|
def derive_key(self, purpose, length=SecretBox.KEY_SIZE):
|
||||||
if not isinstance(purpose, type(u"")): raise TypeError(type(purpose))
|
if not isinstance(purpose, type(u"")): raise TypeError(type(purpose))
|
||||||
if self.key is None:
|
if self.key is None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user