Sha256: 01d50a3236196aaf6840b43290ba35ec820456be3f7840ac961e60704a6bccba

Contents?: true

Size: 611 Bytes

Versions: 1

Compression:

Stored size: 611 Bytes

Contents

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

        required_options :generate

        try_after :show_help

        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

1 entries across 1 versions & 1 rubygems

Version Path
sym-2.3.0 lib/sym/app/commands/generate_key.rb