aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cleberg <hello@cleberg.net>2025-04-04 22:32:42 -0500
committerChristian Cleberg <hello@cleberg.net>2025-04-04 22:32:42 -0500
commitd5f657283bc7de525661f3a967e5d6fb213763d2 (patch)
tree118a7d02ce108cefada2b0b8d514cf47839ccddd
parenta7bf2c602b2b186a9924db173a75572d09c1edcd (diff)
downloadyoshi-cli-d5f657283bc7de525661f3a967e5d6fb213763d2.tar.gz
yoshi-cli-d5f657283bc7de525661f3a967e5d6fb213763d2.tar.bz2
yoshi-cli-d5f657283bc7de525661f3a967e5d6fb213763d2.zip
fix: replace random.choice with secrets.choice
-rw-r--r--yoshi/process.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/yoshi/process.py b/yoshi/process.py
index dabce86..f09c036 100644
--- a/yoshi/process.py
+++ b/yoshi/process.py
@@ -25,6 +25,7 @@ Usage:
from string import ascii_letters, punctuation, digits
import random
+import secrets
import uuid
from prettytable import PrettyTable
from yoshi.account import Account
@@ -45,7 +46,7 @@ def generate_characters(n: int) -> list:
characters = []
password_format = ascii_letters + punctuation + digits
for _ in range(n):
- characters.append(random.choice(password_format))
+ characters.append(secrets.choice(password_format))
return characters
@@ -76,9 +77,9 @@ def generate_passphrase(n: int, sep: str) -> str:
str: A string representation of the passphrase
"""
phrases = []
- lucky_number = random.choice(range(0, n))
+ lucky_number = secrets.choice(range(0, n))
for _ in range(n):
- word = random.choice(WORDLIST)
+ word = secrets.choice(WORDLIST)
if _ == lucky_number:
phrases.append(word.capitalize() + str(_))
else: