mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Use secrets instead of random
Since we're no longer stuck on python 3.5, we can use secrets instead of random which provides better randomness. CURA-8401 SEC-207
This commit is contained in:
parent
3caee3f143
commit
e24a844d17
1 changed files with 2 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
import random
|
import secrets
|
||||||
from hashlib import sha512
|
from hashlib import sha512
|
||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
@ -143,7 +143,7 @@ class AuthorizationHelpers:
|
||||||
better to leave it at 32
|
better to leave it at 32
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return "".join(random.choice("0123456789ABCDEF") for i in range(code_length))
|
return "".join(secrets.choice("0123456789ABCDEF") for i in range(code_length))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generateVerificationCodeChallenge(verification_code: str) -> str:
|
def generateVerificationCodeChallenge(verification_code: str) -> str:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue