Class: Shhh::App::Commands::GenerateKey
- Includes:
- Shhh
- Defined in:
- lib/shhh/app/commands/generate_key.rb
Constant Summary
Constants included from Shhh
Instance Method Summary collapse
Constructor Details
This class inherits a constructor from Shhh::App::Commands::Command
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/shhh/app/commands/generate_key.rb', line 11 def execute retries ||= 0 new_private_key = self.class.create_private_key if opts[:password] new_private_key = encr_password(new_private_key, application.input_handler.new_password) end clipboard_copy(new_private_key) if opts[:copy] if opts[:keychain] && Shhh::App.is_osx? Shhh::App::KeyChain.new(opts[:keychain], opts).add(new_private_key) end new_private_key rescue Shhh::Errors::PasswordsDontMatch, Shhh::Errors::PasswordTooShort => e STDERR.puts e..bold retry if (retries += 1) < 3 end |