Skip to content

Commit

Permalink
fix: missing account management
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhenShuo2021 committed Dec 13, 2024
1 parent c4a1fe5 commit fa51af4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions v2dl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ def _check_cli_inputs(self, args: Namespace) -> None:
print(version.__version__) # noqa: T201
sys.exit(0)

if args.account:
config_manager = config.ConfigManager(self.default_config)
config_manager.load_from_defaults()
config_manager.load_from_yaml()
cli.cli(config_manager.create_encryption_config())
sys.exit(0)

if args.bot_type == "selenium":
utils.check_module_installed()

Expand Down
2 changes: 1 addition & 1 deletion v2dl/common/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"key_bytes": 32,
"salt_bytes": 16,
"nonce_bytes": 24,
"kdf_ops_limit": 2**10,
"kdf_ops_limit": 2**4,
"kdf_mem_limit": 2**13,
},
}
Expand Down
5 changes: 3 additions & 2 deletions v2dl/utils/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ def _init_keys(self) -> tuple[bytes, bytes, PublicKey, bytes, bytes] | None:
self.logger.info("Key pair already exists")
return None

self.check_folder()
return self._generate_and_encrypt_keys()

def _keys_exist(self) -> bool:
Expand Down Expand Up @@ -470,7 +469,9 @@ def write_env(env_path: str, key: str, value: str | bytes) -> None:
def read_env(key: str) -> str:
value = os.getenv(key)
if value is None:
raise SecurityError(f"Missing required environment variable: {key}")
raise SecurityError(
f"Missing required environment variable: {key}, please check your key files"
)
return value


Expand Down

0 comments on commit fa51af4

Please sign in to comment.