Class: Slk::Commands::SshKeyManager
- Inherits:
-
Object
- Object
- Slk::Commands::SshKeyManager
- Defined in:
- lib/slk/commands/ssh_key_manager.rb
Overview
Handles SSH key configuration and token migration. When the SSH key is changed, existing tokens are decrypted with the old key and re-encrypted with the new key. Supports prompting for public key location if not found at the default path (private_key.pub).
Constant Summary collapse
- FILE_ERRORS =
File system errors mapped to user-friendly messages. These occur during SSH key file operations (reading keys, migrating tokens).
{ Errno::ENOENT => 'File not found', Errno::EACCES => 'Permission denied', Errno::EPERM => 'Permission denied', Errno::ENOSPC => 'Disk full', Errno::EDQUOT => 'Disk quota exceeded', Errno::EROFS => 'Read-only file system' }.freeze
Instance Attribute Summary collapse
-
#on_info ⇒ Object
Returns the value of attribute on_info.
-
#on_warning ⇒ Object
Returns the value of attribute on_warning.
Instance Method Summary collapse
-
#initialize(config:, token_store:, output:) ⇒ SshKeyManager
constructor
A new instance of SshKeyManager.
- #set(new_path) ⇒ Object
- #unset ⇒ Object
Constructor Details
#initialize(config:, token_store:, output:) ⇒ SshKeyManager
Returns a new instance of SshKeyManager.
23 24 25 26 27 |
# File 'lib/slk/commands/ssh_key_manager.rb', line 23 def initialize(config:, token_store:, output:) @config = config @token_store = token_store @output = output end |
Instance Attribute Details
#on_info ⇒ Object
Returns the value of attribute on_info.
21 22 23 |
# File 'lib/slk/commands/ssh_key_manager.rb', line 21 def on_info @on_info end |
#on_warning ⇒ Object
Returns the value of attribute on_warning.
21 22 23 |
# File 'lib/slk/commands/ssh_key_manager.rb', line 21 def on_warning @on_warning end |
Instance Method Details
#set(new_path) ⇒ Object
29 30 31 |
# File 'lib/slk/commands/ssh_key_manager.rb', line 29 def set(new_path) with_error_handling { perform_set(new_path) } end |
#unset ⇒ Object
33 34 35 |
# File 'lib/slk/commands/ssh_key_manager.rb', line 33 def unset with_error_handling { perform_unset } end |