mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-27 07:52:03 +00:00
Merge pull request #882 from PR0M3TH3AN/fix/scan-codebase-linting-12332732608299564025
Fix formatting and logic errors found during codebase scan
This commit is contained in:
24 files changed
+207
-22
No files matched your search
+1
-1
@@ -11,6 +11,7 @@ import os
|
||||
import logging
|
||||
import signal
|
||||
import time
|
||||
import queue
|
||||
import argparse
|
||||
import tomli
|
||||
from tomli import TOMLDecodeError
|
||||
@@ -45,7 +46,6 @@ from utils.logging_utils import (
|
||||
)
|
||||
from local_bip85.bip85 import Bip85Error
|
||||
|
||||
|
||||
colorama_init()
|
||||
|
||||
OPTIONAL_DEPENDENCIES = {
|
||||
|
||||
@@ -28,7 +28,6 @@ from seedpass.core.manager import PasswordManager
|
||||
from seedpass.core.entry_types import EntryType
|
||||
from seedpass.core.api import UtilityService
|
||||
|
||||
|
||||
_RATE_LIMIT = int(os.getenv("SEEDPASS_RATE_LIMIT", "100"))
|
||||
_RATE_WINDOW = int(os.getenv("SEEDPASS_RATE_WINDOW", "60"))
|
||||
_RATE_LIMIT_STR = f"{_RATE_LIMIT}/{_RATE_WINDOW} seconds"
|
||||
|
||||
@@ -5,7 +5,6 @@ import uvicorn
|
||||
|
||||
from .. import api as api_module
|
||||
|
||||
|
||||
app = typer.Typer(help="Run the API server")
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import typer
|
||||
|
||||
from .common import _get_config_service
|
||||
|
||||
|
||||
app = typer.Typer(help="Get or set configuration values")
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ from .common import _get_entry_service, EntryType
|
||||
from seedpass.core.entry_types import ALL_ENTRY_TYPES
|
||||
from utils.clipboard import ClipboardUnavailableError
|
||||
|
||||
|
||||
app = typer.Typer(help="Manage individual entries")
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import typer
|
||||
|
||||
from .common import _get_services, ProfileRemoveRequest, ProfileSwitchRequest
|
||||
|
||||
|
||||
app = typer.Typer(help="Manage seed profiles")
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import typer
|
||||
|
||||
from .common import _get_services, _get_nostr_service
|
||||
|
||||
|
||||
app = typer.Typer(
|
||||
help="Interact with Nostr relays. See docs/nostr_setup.md for configuration and troubleshooting."
|
||||
)
|
||||
|
||||
@@ -6,7 +6,6 @@ import typer
|
||||
|
||||
from .common import _get_util_service
|
||||
|
||||
|
||||
app = typer.Typer(help="Utility commands")
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ from .common import (
|
||||
BackupParentSeedRequest,
|
||||
)
|
||||
|
||||
|
||||
app = typer.Typer(help="Manage the entire vault")
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import List, Optional
|
||||
from typing import List, Optional, TYPE_CHECKING
|
||||
|
||||
from utils.seed_prompt import masked_input
|
||||
|
||||
@@ -15,6 +15,9 @@ from nostr.client import DEFAULT_RELAYS as DEFAULT_NOSTR_RELAYS
|
||||
|
||||
from constants import INACTIVITY_TIMEOUT, MAX_RETRIES, RETRY_DELAY
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .password_generation import PasswordPolicy
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import unicodedata
|
||||
try:
|
||||
import orjson as json_lib # type: ignore
|
||||
|
||||
JSONDecodeError = orjson.JSONDecodeError
|
||||
JSONDecodeError = json_lib.JSONDecodeError
|
||||
USE_ORJSON = True
|
||||
except Exception: # pragma: no cover - fallback for environments without orjson
|
||||
import json as json_lib
|
||||
|
||||
@@ -49,7 +49,6 @@ from .vault import Vault
|
||||
from .backup import BackupManager
|
||||
from .errors import SeedPassError
|
||||
|
||||
|
||||
# Instantiate the logger
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ from seedpass.cli import app, entry as cli_entry
|
||||
from seedpass.core.entry_types import EntryType
|
||||
from utils.clipboard import ClipboardUnavailableError
|
||||
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ from utils.key_derivation import (
|
||||
from utils.fingerprint import generate_fingerprint
|
||||
from seedpass.core.encryption import EncryptionManager
|
||||
|
||||
|
||||
cfg_values = st.one_of(
|
||||
st.integers(min_value=0, max_value=100),
|
||||
st.text(min_size=0, max_size=20),
|
||||
|
||||
@@ -19,7 +19,6 @@ from seedpass.core.portable_backup import PortableMode
|
||||
from utils.key_derivation import derive_index_key, derive_key_from_password
|
||||
from utils.fingerprint import generate_fingerprint
|
||||
|
||||
|
||||
SEED = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
|
||||
PASSWORD = "passw0rd"
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ from helpers import create_vault, dummy_nostr_client
|
||||
import gzip
|
||||
from nostr.backup_models import Manifest, ChunkMeta
|
||||
|
||||
|
||||
VALID_SEED = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from seedpass.core.totp import TotpManager
|
||||
|
||||
|
||||
# Test parsing a normal otpauth URI with custom period and digits
|
||||
|
||||
|
||||
|
||||
@@ -40,14 +40,15 @@ from .atomic_write import atomic_write
|
||||
try: # pragma: no cover - exercised when dependency missing
|
||||
from .clipboard import ClipboardUnavailableError, copy_to_clipboard
|
||||
except Exception as exc: # pragma: no cover - executed only if pyperclip missing
|
||||
_error_msg = str(exc)
|
||||
|
||||
class ClipboardUnavailableError(RuntimeError):
|
||||
"""Stub exception when clipboard support is unavailable."""
|
||||
|
||||
def copy_to_clipboard(*_args, **_kwargs):
|
||||
"""Stub when clipboard support is unavailable."""
|
||||
logger.warning("Clipboard support unavailable: %s", exc)
|
||||
raise ClipboardUnavailableError(str(exc))
|
||||
logger.warning("Clipboard support unavailable: %s", _error_msg)
|
||||
raise ClipboardUnavailableError(_error_msg)
|
||||
|
||||
|
||||
__all__ = [
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from termcolor import colored
|
||||
|
||||
|
||||
# ANSI escape for 256-color orange (color code 208)
|
||||
_ORANGE = "\033[38;5;208m"
|
||||
_RESET = "\033[0m"
|
||||
|
||||
@@ -21,7 +21,7 @@ import hmac
|
||||
import time
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from typing import Optional, Union, Dict, Any
|
||||
from typing import Optional, Union, Dict, Any, TYPE_CHECKING
|
||||
|
||||
from bip_utils import Bip39SeedGenerator
|
||||
from local_bip85 import BIP85
|
||||
@@ -46,6 +46,9 @@ DEFAULT_ENCRYPTION_MODE = EncryptionMode.SEED_ONLY
|
||||
# Purpose constant for TOTP secret derivation using BIP85
|
||||
TOTP_PURPOSE = 39
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from seedpass.core.config_manager import ConfigManager
|
||||
|
||||
|
||||
@dataclass
|
||||
class KdfConfig:
|
||||
|
||||
@@ -17,7 +17,6 @@ except ImportError: # pragma: no cover - POSIX only
|
||||
from utils.terminal_utils import clear_screen
|
||||
from utils.logging_utils import pause_console_logging, resume_console_logging
|
||||
|
||||
|
||||
DEFAULT_MAX_ATTEMPTS = 5
|
||||
|
||||
|
||||
|
||||
Generated
+174
@@ -0,0 +1,174 @@
|
||||
{
|
||||
"name": "torch",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "torch",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"torch-lock": "https://github.com/PR0M3TH3AN/TORCH/archive/refs/heads/main.tar.gz"
|
||||
}
|
||||
},
|
||||
"node_modules/@noble/ciphers": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.5.3.tgz",
|
||||
"integrity": "sha512-B0+6IIHiqEs3BPMT0hcRmHvEj2QHOLu+uwt+tqDDeVd0oyVzh7BPrDcPjRnV1PV/5LaknXJJQvOuRGR0zQJz+w==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@noble/curves": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
|
||||
"integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@noble/hashes": "1.3.2"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@noble/curves/node_modules/@noble/hashes": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz",
|
||||
"integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@noble/hashes": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz",
|
||||
"integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@scure/base": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz",
|
||||
"integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@scure/bip32": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz",
|
||||
"integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@noble/curves": "~1.1.0",
|
||||
"@noble/hashes": "~1.3.1",
|
||||
"@scure/base": "~1.1.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@scure/bip32/node_modules/@noble/curves": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz",
|
||||
"integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@noble/hashes": "1.3.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@scure/bip39": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz",
|
||||
"integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@noble/hashes": "~1.3.0",
|
||||
"@scure/base": "~1.1.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/nostr-tools": {
|
||||
"version": "2.19.4",
|
||||
"resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-2.19.4.tgz",
|
||||
"integrity": "sha512-qVLfoTpZegNYRJo5j+Oi6RPu0AwLP6jcvzcB3ySMnIT5DrAGNXfs5HNBspB/2HiGfH3GY+v6yXkTtcKSBQZwSg==",
|
||||
"license": "Unlicense",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^0.5.1",
|
||||
"@noble/curves": "1.2.0",
|
||||
"@noble/hashes": "1.3.1",
|
||||
"@scure/base": "1.1.1",
|
||||
"@scure/bip32": "1.3.1",
|
||||
"@scure/bip39": "1.2.1",
|
||||
"nostr-wasm": "0.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": ">=5.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/nostr-wasm": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/nostr-wasm/-/nostr-wasm-0.1.0.tgz",
|
||||
"integrity": "sha512-78BTryCLcLYv96ONU8Ws3Q1JzjlAt+43pWQhIl86xZmWeegYCNLPml7yQ+gG3vR6V5h4XGj+TxO+SS5dsThQIA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/torch-lock": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://github.com/PR0M3TH3AN/TORCH/archive/refs/heads/main.tar.gz",
|
||||
"integrity": "sha512-E/6nV1W0Jgric/4n83u8PfapILLKWHm07/oKnJGnizfDFRO4JSxeLPkTLp8DgaKOZU2S15ksO87n79D2dOjyAw==",
|
||||
"dependencies": {
|
||||
"nostr-tools": "2.19.4",
|
||||
"ws": "8.19.0"
|
||||
},
|
||||
"bin": {
|
||||
"torch-lock": "bin/torch-lock.mjs"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.19.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
|
||||
"integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "torch",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"type": "commonjs",
|
||||
"dependencies": {
|
||||
"torch-lock": "https://github.com/PR0M3TH3AN/TORCH/archive/refs/heads/main.tar.gz"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# TODO for Perf Agent Run 2026-02-15T01-22-33Z
|
||||
|
||||
- [x] Scan codebase
|
||||
- [x] Fix linting and formatting issues
|
||||
Reference in new issue
Block a user