From 8a1a8b1f9c0fe5441082bb6cbef1711ddd30ada5 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 2 Jul 2018 08:58:28 -0700 Subject: [PATCH] manager: factor out make_side for testing and override --- src/wormhole/_dilation/manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wormhole/_dilation/manager.py b/src/wormhole/_dilation/manager.py index bae38d0..16553b2 100644 --- a/src/wormhole/_dilation/manager.py +++ b/src/wormhole/_dilation/manager.py @@ -37,6 +37,8 @@ class UnknownDilationMessageType(Exception): class ReceivedHintsTooEarly(Exception): pass +def make_side(): + return bytes_to_hexstr(os.urandom(6)) # new scheme: # * both sides send PLEASE as soon as they have an unverified key and @@ -487,7 +489,7 @@ class Dilator(object): # they're so new that they no longer accomodate our old version raise OldPeerCannotDilateError() - my_dilation_side = bytes_to_hexstr(os.urandom(6)) + my_dilation_side = make_side() self._manager = Manager(self._S, my_dilation_side, self._transit_key, self._transit_relay_location,