Sha256: 1111a28d593b9b8ceeea7131c432c0aefeb3b31cb4ef94ee7d9f921a18140e8a
Contents?: true
Size: 989 Bytes
Versions: 4
Compression:
Stored size: 989 Bytes
Contents
require 'sym/app/commands/base_command' module Sym module App module Commands class PasswordProtectKey < BaseCommand required_options %i(key interactive), :password incompatible_options %i(examples help version bash_support) try_after :generate_key, :encrypt, :decrypt def execute retries ||= 0 raise Sym::Errors::NoPrivateKeyFound.new("Unable to resolve private key from argument '#{opts[:key]}'") if self.key.nil? the_key = self.key if opts[:password] encrypted_key, password = encrypt_with_password(the_key) add_password_to_the_cache(encrypted_key, password) the_key = encrypted_key end 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
4 entries across 4 versions & 1 rubygems