dilation side needs to be 16-chars to match transit relay
This commit is contained in:
parent
840dfa603b
commit
49c36b0277
|
@ -28,7 +28,9 @@ from ._noise import NoiseConnection
|
|||
|
||||
def build_sided_relay_handshake(key, side):
|
||||
assert isinstance(side, type(u""))
|
||||
assert len(side) == 8 * 2
|
||||
# magic-wormhole-transit-relay expects a specific layout for the
|
||||
# handshake message: "please relay {64} for side {16}\n"
|
||||
assert len(side) == 8 * 2, side
|
||||
token = HKDF(key, 32, CTXinfo=b"transit_relay_token")
|
||||
return (b"please relay " + hexlify(token) +
|
||||
b" for side " + side.encode("ascii") + b"\n")
|
||||
|
|
|
@ -65,7 +65,7 @@ class EndpointRecord(Sequence):
|
|||
return (self.control, self.connect, self.listen)[n]
|
||||
|
||||
def make_side():
|
||||
return bytes_to_hexstr(os.urandom(6))
|
||||
return bytes_to_hexstr(os.urandom(8))
|
||||
|
||||
|
||||
# new scheme:
|
||||
|
|
|
@ -216,7 +216,7 @@ class TestManager(unittest.TestCase):
|
|||
def test_make_side(self):
|
||||
side = make_side()
|
||||
self.assertEqual(type(side), type(u""))
|
||||
self.assertEqual(len(side), 2 * 6)
|
||||
self.assertEqual(len(side), 2 * 8)
|
||||
|
||||
def test_create(self):
|
||||
m, h = make_manager()
|
||||
|
|
Loading…
Reference in New Issue
Block a user