mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-16 20:57:53 +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:
parent
1deb44021f
commit
d38d9204a7
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user