Sha256: 64bd81fc32609f38972c3fd710149224d0ab9387a88408797fe0caa4580ee9a2

Contents?: true

Size: 687 Bytes

Versions: 5

Compression:

Stored size: 687 Bytes

Contents

require 'sym/app/commands/base_command'

module Sym
  module App
    module Commands
      class PasswordProtectKey < BaseCommand

        required_options [:private_key, :keyfile, :keychain, :interactive],
                         :password

        try_after :generate_key, :encrypt_decrypt

        def execute
          retries ||= 0

          the_key = self.key
          the_key = encrypt_password_if_needed(the_key)
          add_to_keychain_if_needed(the_key)

          the_key
        rescue Sym::Errors::PasswordsDontMatch, Sym::Errors::PasswordTooShort => e
          STDERR.puts e.message.bold
          retry if (retries += 1) < 3
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sym-2.2.1 lib/sym/app/commands/password_protect_key.rb
sym-2.2.0 lib/sym/app/commands/password_protect_key.rb
sym-2.1.2 lib/sym/app/commands/password_protect_key.rb
sym-2.1.1 lib/sym/app/commands/password_protect_key.rb
sym-2.1.0 lib/sym/app/commands/password_protect_key.rb