2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-23 01:53:28 +00:00

Ensure the invitation works out to even multiple of 3 bytes

It's cosmetic, but a nice way to avoid '=' in the tokens.
This commit is contained in:
Jarrod Johnson 2018-04-26 11:35:06 -04:00
parent fb9925bb84
commit 3a354a6300

View File

@ -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)