From d38d9204a73b93dc311721f7012f9f47abebb35f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 26 Apr 2018 11:35:06 -0400 Subject: [PATCH] Ensure the invitation works out to even multiple of 3 bytes It's cosmetic, but a nice way to avoid '=' in the tokens. --- confluent_server/confluent/collective/invites.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/collective/invites.py b/confluent_server/confluent/collective/invites.py index 94c0906f..b635dbeb 100644 --- a/confluent_server/confluent/collective/invites.py +++ b/confluent_server/confluent/collective/invites.py @@ -24,7 +24,8 @@ pending_invites = {} def create_server_invitation(servername): servername = servername.encode('utf-8') - invitation = os.urandom(66) + randbytes = (3 - ((len(servername) + 2) % 3)) % 3 + 64 + invitation = os.urandom(randbytes) pending_invites[servername] = invitation return base64.b64encode(servername + b'@' + invitation)