class Net::SSH::Authentication::KeyManager

def prepare_identities_from_files

Prepares identities from user key_files for loading, preserving their order and sources.
def prepare_identities_from_files
  key_files.map do |file|
    if readable_file?(file)
      identity = {}
      public_key_file = file + ".pub"
      if readable_file?(public_key_file)
        identity[:load_from] = :pubkey_file
        identity[:pubkey_file] = public_key_file
      else
        identity[:load_from] = :privkey_file
      end
      identity.merge(privkey_file: file)
    end
  end.compact
end