Sha256: f38d3874971cd198b168ef399a04fd2c0c3195aae30e53b7cbdec5eadb8e2bf5

Contents?: true

Size: 581 Bytes

Versions: 5

Compression:

Stored size: 581 Bytes

Contents

require 'sym/app/commands/base_command'
require 'sym/app/keychain'
module Sym
  module App
    module Commands
      class GenerateKey < BaseCommand

        required_options :generate

        def execute
          retries ||= 0

          the_key = create_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/generate_key.rb
sym-2.2.0 lib/sym/app/commands/generate_key.rb
sym-2.1.2 lib/sym/app/commands/generate_key.rb
sym-2.1.1 lib/sym/app/commands/generate_key.rb
sym-2.1.0 lib/sym/app/commands/generate_key.rb