-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (26 loc) · 984 Bytes
/
Copy pathmain.py
File metadata and controls
32 lines (26 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Password Manager — a CLI tool for securely storing and managing credentials."""
import sys
if __name__ == "__main__":
if "--version" in sys.argv:
from app.cli.menu import print_version
print_version()
sys.exit()
from app.cli import console
from app.cli.menu import menu
from app.config import KEY_FILE
from app.crypto.encryption import init_fernet
from app.crypto.key_manager import load_or_create_key
from app.database.connection import init_db
from app.database.repository import Repository
from app.services.password_service import PasswordService
key_was_created = not KEY_FILE.exists()
key = load_or_create_key()
if key_was_created:
console.print("[green]✔ Encryption key generated[/green]")
init_fernet(key)
try:
init_db()
service = PasswordService(Repository())
menu(service)
except KeyboardInterrupt:
console.print("\n[dim]Goodbye[/dim]")