Compare commits

...

4 Commits

Author SHA1 Message Date
6c424c6135 revert: don't cipher password in config 2025-12-14 16:48:51 +01:00
1b8eb4abd4 docs: update readme 2025-12-14 16:48:42 +01:00
4d530a5a65 build: update uv.lock 2025-12-14 16:48:38 +01:00
ac21ad39b1 clean: remove dep 2025-12-14 16:48:32 +01:00
4 changed files with 2 additions and 38 deletions

View File

@@ -50,7 +50,7 @@ If you run the tool for the first time, it will prompt you to use `skywipe confi
```yaml
handle: your_handle
password: your_password_encrypted
password: your_password
batch_size: 10
delay: 1
verbose: true

View File

@@ -7,5 +7,4 @@ requires-python = ">=3.13"
dependencies = [
"atproto>=0.0.65",
"pyyaml>=6.0",
"cryptography>=42.0.0",
]

View File

@@ -1,48 +1,17 @@
"""Core configuration handling class and related logic."""
import os
import getpass
from pathlib import Path
import yaml
from cryptography.fernet import Fernet
class Configuration:
def __init__(self):
self.config_file = Path.home() / ".config" / "skywipe" / "config.yml"
self.key_file = Path.home() / ".config" / "skywipe" / ".key"
self._fernet = None
def exists(self) -> bool:
return self.config_file.exists()
def _get_or_create_key(self) -> bytes:
if self.key_file.exists():
return self.key_file.read_bytes()
key = Fernet.generate_key()
config_dir = self.key_file.parent
config_dir.mkdir(parents=True, exist_ok=True)
self.key_file.write_bytes(key)
os.chmod(self.key_file, 0o600)
return key
def _get_fernet(self) -> Fernet:
if self._fernet is None:
key = self._get_or_create_key()
self._fernet = Fernet(key)
return self._fernet
def encrypt_password(self, password: str) -> str:
fernet = self._get_fernet()
encrypted = fernet.encrypt(password.encode())
return encrypted.decode()
def decrypt_password(self, encrypted_password: str) -> str:
fernet = self._get_fernet()
decrypted = fernet.decrypt(encrypted_password.encode())
return decrypted.decode()
def create(self):
if self.exists():
overwrite = input(
@@ -71,11 +40,9 @@ class Configuration:
print("Error: batch_size and delay must be integers")
return
encrypted_password = self.encrypt_password(password)
config_data = {
"handle": handle,
"password": encrypted_password,
"password": password,
"batch_size": batch_size,
"delay": delay,
"verbose": verbose

2
uv.lock generated
View File

@@ -381,14 +381,12 @@ version = "0.1.0"
source = { virtual = "." }
dependencies = [
{ name = "atproto" },
{ name = "cryptography" },
{ name = "pyyaml" },
]
[package.metadata]
requires-dist = [
{ name = "atproto", specifier = ">=0.0.65" },
{ name = "cryptography", specifier = ">=42.0.0" },
{ name = "pyyaml", specifier = ">=6.0" },
]