persistent_ssh_agent.cli module¶
Command-line interface for persistent-ssh-agent.
- class persistent_ssh_agent.cli.Args(**kwargs)[source]¶
Bases:
object
Simple class to mimic argparse namespace for compatibility with existing functions.
- class persistent_ssh_agent.cli.ConfigManager[source]¶
Bases:
object
Manages persistent configuration for SSH agent.
- add_key(name: str, identity_file: str) bool [source]¶
Add a named SSH key.
- Parameters:
name – Name of the key
identity_file – Path to SSH identity file
- Returns:
True if successful
- Return type:
bool
- clear_config() bool [source]¶
Clear all configuration.
- Returns:
True if successful
- Return type:
bool
- deobfuscate_passphrase(encrypted_data: str) str [source]¶
Decrypt passphrase.
- Parameters:
encrypted_data – Encrypted passphrase
- Returns:
Plain text passphrase
- Return type:
str
- export_config(include_sensitive: bool = False) Dict [source]¶
Export configuration.
- Parameters:
include_sensitive – Whether to include sensitive information
- Returns:
Exported configuration
- Return type:
Dict
- get_expiration_time() int | None [source]¶
Get stored expiration time.
- Returns:
Expiration time in seconds or None
- Return type:
Optional[int]
- get_identity_file() str | None [source]¶
Get stored identity file path.
- Returns:
Stored identity file path or None
- Return type:
Optional[str]
- get_passphrase() str | None [source]¶
Get stored passphrase.
- Returns:
Stored passphrase or None
- Return type:
Optional[str]
- get_reuse_agent() bool | None [source]¶
Get stored reuse agent setting.
- Returns:
Reuse agent setting or None
- Return type:
Optional[bool]
- import_config(config_data: Dict) bool [source]¶
Import configuration.
- Parameters:
config_data – Configuration data to import
- Returns:
True if successful
- Return type:
bool
- list_keys() Dict [source]¶
List all configured SSH keys.
- Returns:
Dictionary of configured keys
- Return type:
Dict
- load_config() Dict [source]¶
Load configuration from file.
- Returns:
Configuration dictionary
- Return type:
Dict
- remove_key(name: str) bool [source]¶
Remove a named SSH key.
- Parameters:
name – Name of the key
- Returns:
True if successful
- Return type:
bool
- save_config(config: Dict) bool [source]¶
Save configuration to file.
- Parameters:
config – Configuration dictionary
- Returns:
True if successful
- Return type:
bool
- static secure_delete_from_memory(data: str | bytes | bytearray) None [source]¶
Securely delete sensitive data from memory.
- Parameters:
data – Data to delete
- set_expiration_time(hours: int) bool [source]¶
Set and store expiration time.
- Parameters:
hours – Expiration time in hours
- Returns:
True if successful
- Return type:
bool
- set_identity_file(identity_file: str) bool [source]¶
Set and store identity file path.
- Parameters:
identity_file – Path to SSH identity file
- Returns:
True if successful
- Return type:
bool
- persistent_ssh_agent.cli.add_key(args)[source]¶
Add a configured SSH key.
- Parameters:
args – Command line arguments
- persistent_ssh_agent.cli.export_config(args)[source]¶
Export configuration.
- Parameters:
args – Command line arguments
- persistent_ssh_agent.cli.import_config(args)[source]¶
Import configuration.
- Parameters:
args – Command line arguments
- persistent_ssh_agent.cli.list_keys(_)[source]¶
List all configured SSH keys.
- Parameters:
_ – Command line arguments (unused)
- persistent_ssh_agent.cli.remove_key(args)[source]¶
Remove a configured SSH key.
- Parameters:
args – Command line arguments