refactor: some minor cleanup
This commit is contained in:
parent
307ca38ecc
commit
858d127246
12 changed files with 84 additions and 59 deletions
13
src/utils/randoms.py
Normal file
13
src/utils/randoms.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import random
|
||||
import secrets
|
||||
import string
|
||||
|
||||
|
||||
def generate_password(
|
||||
length: int = 20,
|
||||
*,
|
||||
secure: bool = True,
|
||||
) -> str:
|
||||
alphabet = string.ascii_letters + string.digits
|
||||
chooser = secrets.choice if secure else random.choice
|
||||
return "".join(chooser(alphabet) for _ in range(length))
|
||||
Loading…
Add table
Add a link
Reference in a new issue