Sha256: de6e51d0ef3aa27b4a687a875434eaca98bc67f8f785b262718e7d89ad04cc94
Contents?: true
Size: 1.02 KB
Versions: 5
Compression:
Stored size: 1.02 KB
Contents
require_relative 'command' require 'shhh/app/keychain' module Shhh module App module Commands class GenerateKey < Command include Shhh required_options :generate 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.message.bold retry if (retries += 1) < 3 end private def clipboard_copy(key) require 'clipboard' Clipboard.copy(key) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems