mirror of
https://github.com/Nighthawk42/bnet_auth_tool.git
synced 2026-08-30 06:22:27 +00:00
Replace the single-file v1.3.1 script with a proper src/bnet_auth_tool/ package: config (YAML settings + platformdirs), crypto (scrypt + AES-256-GCM with a versioned header; legacy PBKDF2 100k/600k still decrypt), storage (single encrypted vault), fileio (atomic 0600 writes), api, totp, migrate, and a cli with an interactive menu plus argparse subcommands. Security/audit fixes: drop catch-all excepts, stop leaking server bodies/tokens in errors, atomic permission-hardened writes, explicit Ctrl-C handling, versioned format header, best-effort passphrase scrubbing. Add packaging (pyproject for uv, organized requirements.txt fallback, uv.lock), .gitignore, settings.yaml, CLAUDE.md/AGENTS.md, 22 pytest tests, and ruff config. Online attach/retrieve is preserved but kept labelled unverified. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
38 lines
978 B
Python
38 lines
978 B
Python
"""Shared test fixtures."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from bnet_auth_tool.config import (
|
|
ApiConfig,
|
|
CryptoConfig,
|
|
Settings,
|
|
TotpConfig,
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def settings() -> Settings:
|
|
"""Settings with cheap scrypt params so tests stay fast."""
|
|
return Settings(
|
|
api=ApiConfig(
|
|
host="https://example.test",
|
|
attach_path="/v1/authenticator",
|
|
device_path="/v2/authenticator/device",
|
|
sso_url="https://oauth.example.test/sso",
|
|
client_id="test-client",
|
|
timeout=5,
|
|
region_prefixes=["US-", "EU-"],
|
|
),
|
|
totp=TotpConfig(algorithm="SHA1", digits=8, period=30, issuer="Battle.net"),
|
|
crypto=CryptoConfig(
|
|
kdf="scrypt",
|
|
scrypt_n=1024, # small N for fast tests
|
|
scrypt_r=8,
|
|
scrypt_p=1,
|
|
pbkdf2_iterations=1000,
|
|
pbkdf2_legacy_iterations=100,
|
|
),
|
|
)
|