mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 23:38:49 +00:00
Merge pull request #252 from PR0M3TH3AN/codex/display-qr-code-for-2fa-setup
Display QR code for new 2FA entries
This commit is contained in:
@@ -240,7 +240,7 @@ python src/main.py
|
|||||||
3. Provide a label for the account (for example, `GitHub`).
|
3. Provide a label for the account (for example, `GitHub`).
|
||||||
4. SeedPass automatically chooses the next available derivation index when deriving.
|
4. SeedPass automatically chooses the next available derivation index when deriving.
|
||||||
5. Optionally specify the TOTP period and digit count.
|
5. Optionally specify the TOTP period and digit count.
|
||||||
6. SeedPass will display the URI and secret so you can add it to your authenticator app.
|
6. SeedPass displays the URI and secret, along with a QR code you can scan to import it into your authenticator app.
|
||||||
|
|
||||||
### Modifying a 2FA Entry
|
### Modifying a 2FA Entry
|
||||||
|
|
||||||
|
@@ -979,6 +979,7 @@ class PasswordManager:
|
|||||||
)
|
)
|
||||||
print(colored("Add this URI to your authenticator app:", "cyan"))
|
print(colored("Add this URI to your authenticator app:", "cyan"))
|
||||||
print(colored(uri, "yellow"))
|
print(colored(uri, "yellow"))
|
||||||
|
TotpManager.print_qr_code(uri)
|
||||||
print(colored(f"Secret: {secret}\n", "cyan"))
|
print(colored(f"Secret: {secret}\n", "cyan"))
|
||||||
try:
|
try:
|
||||||
self.sync_vault()
|
self.sync_vault()
|
||||||
@@ -1016,6 +1017,7 @@ class PasswordManager:
|
|||||||
"green",
|
"green",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
TotpManager.print_qr_code(uri)
|
||||||
try:
|
try:
|
||||||
self.sync_vault()
|
self.sync_vault()
|
||||||
except Exception as nostr_error:
|
except Exception as nostr_error:
|
||||||
|
@@ -7,6 +7,8 @@ import time
|
|||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
from urllib.parse import urlparse, parse_qs, unquote
|
from urllib.parse import urlparse, parse_qs, unquote
|
||||||
|
|
||||||
|
import qrcode
|
||||||
|
|
||||||
import pyotp
|
import pyotp
|
||||||
|
|
||||||
from utils import key_derivation
|
from utils import key_derivation
|
||||||
@@ -81,3 +83,11 @@ class TotpManager:
|
|||||||
remaining -= 1
|
remaining -= 1
|
||||||
sys.stdout.write("\n")
|
sys.stdout.write("\n")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def print_qr_code(uri: str) -> None:
|
||||||
|
"""Display a QR code representing the provided URI in the terminal."""
|
||||||
|
qr = qrcode.QRCode(border=1)
|
||||||
|
qr.add_data(uri)
|
||||||
|
qr.make()
|
||||||
|
qr.print_ascii(invert=True)
|
||||||
|
@@ -23,3 +23,4 @@ pyotp>=2.8.0
|
|||||||
|
|
||||||
freezegun
|
freezegun
|
||||||
pyperclip
|
pyperclip
|
||||||
|
qrcode>=8.2
|
||||||
|
Reference in New Issue
Block a user