b0VIM 8.1_JwjoshJoshs-Mac-mini.local~josh/Projects/fastlane/fastlane/cert/lib/cert/runner.rb 3210#"! UtphIi>ad?h}YED*)1 a ? 7 6 (  B " z G F g @    '10$#nmG9'$eVJI? # See also: https://github.com/fastlane/fastlane/pull/14462 # As keychain is specific to macOS, this will likely fail on non macOS systems. private_key_path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.p12")) path = store_certificate(certificate, Cert.config[:filename]) end next unless certificate.certificate_content certificates.each do |certificate| def find_existing_cert end certificates.reject(&:valid?) def expired_certs end UI.success("#{revoke_count} expired certificate#{'s' if revoke_count != 1} #{revoke_count == 1 ? 'has' : 'have'} been revoked! 👍") end end UI.error("#{e.message}\n#{e.backtrace.join("\n")}") if FastlaneCore::Globals.verbose? UI.error("An error occurred while revoking #{certificate.id} #{certificate.display_name}") rescue => e revoke_count += 1 certificate.delete! UI.message("#{certificate.id} #{certificate.display_name} has expired, revoking...") begin to_revoke.each do |certificate| revoke_count = 0 end return UI.success("No expired certificates were found to revoke! 👍") if to_revoke.empty? to_revoke = expired_certs login FastlaneCore::PrintTable.print_values(config: Cert.config, hide_keys: [:output_path], title: "Summary for cert #{Fastlane::VERSION}") def revoke_expired_certs! # Command method for the :revoke_expired sub-command end end UI.user_error!("Something went wrong when trying to create a new certificate...") else return # success if create_certificate # no certificate here, creating a new one return unless should_create end should_create = cert_path.nil? cert_path = find_existing_cert unless should_create should_create = Cert.config[:force] login FastlaneCore::PrintTable.print_values(config: Cert.config, hide_keys: [:output_path], title: "Summary for cert #{Fastlane::VERSION}") FileUtils.mkdir_p(Cert.config[:output_path]) def run end return @api_token @api_token ||= Spaceship::ConnectAPI::Token.from_json_file(Cert.config[:api_key_path]) if Cert.config[:api_key_path] @api_token ||= Spaceship::ConnectAPI::Token.create(Cert.config[:api_key]) if Cert.config[:api_key] def api_token end end UI.message("Successfully logged in") Spaceship::ConnectAPI.login(Cert.config[:username], nil, use_portal: true, use_tunes: false) UI.message("Starting login with user '#{Cert.config[:username]}'") else Spaceship::ConnectAPI.token = api_token UI.message("Creating authorization token for App Store Connect API") if api_token def login end return ENV["CER_FILE_PATH"] UI.success("Successfully installed certificate #{ENV['CER_CERTIFICATE_ID']}") UI.user_error!("Could not find the newly generated certificate installed", show_github_issues: true) unless installed UI.message("Verifying the certificate is properly installed locally...") installed = FastlaneCore::CertChecker.installed?(ENV["CER_FILE_PATH"], in_keychain: ENV["CER_KEYCHAIN_PATH"]) run def launch class Runnermodule Certrequire_relative 'module'require 'spaceship'require 'fastlane_core/print_table'require 'fastlane_core/keychain_importer'require 'fastlane_core/cert_checker'require 'fastlane_core/globals'require 'fileutils'ad-A>xnmVNM2QE F ` m l c : 9 Osr  }/eSKEA@end end end return path File.write(path, raw_data.force_encoding("UTF-8")) raw_data = Base64.decode64(certificate.certificate_content) path = File.expand_path(File.join(Cert.config[:output_path], cert_name)) cert_name = "#{cert_name}.cer" unless File.extname(cert_name) == ".cer" cert_name = filename ? filename : certificate.id def store_certificate(certificate, filename = nil) end return cert_path UI.success("Successfully generated #{certificate.id} which was imported to the local machine.") ENV["CER_FILE_PATH"] = cert_path ENV["CER_CERTIFICATE_ID"] = certificate.id # Environment variables for the fastlane action FastlaneCore::KeychainImporter.import_file(cert_path, keychain, keychain_password: password, skip_set_partition_list: Cert.config[:skip_set_partition_list]) FastlaneCore::KeychainImporter.import_file(private_key_path, keychain, keychain_password: password, skip_set_partition_list: Cert.config[:skip_set_partition_list]) password = Cert.config[:keychain_password] keychain = File.expand_path(Cert.config[:keychain_path]) # Import all the things into the Keychain cert_path = store_certificate(certificate, Cert.config[:filename]) File.write(private_key_path, pkey) private_key_path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.p12")) File.write(request_path, csr.to_pem) request_path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.certSigningRequest")) # Store all that onto the filesystem end raise ex end UI.user_error!("You do not have permission to create this certificate. Only Team Admins can create Distribution certificates\n 🔍 See https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/ManagingYourTeam/ManagingYourTeam.html for more information.") elsif ex.to_s.include?("You are not allowed to perform this operation.") && type_name == "Distribution" UI.user_error!("Could not create another #{type_name} certificate, reached the maximum number of available #{type_name} certificates.", show_github_issues: true) if ex.to_s.include?("You already have a current") type_name = (Cert.config[:development] ? "Development" : "Distribution") rescue => ex ) csr_content: csr.to_pem certificate_type: certificate_type, certificate = Spaceship::ConnectAPI::Certificate.create( begin # Use the signing request to create a new (development|distribution) certificate csr, pkey = Spaceship::ConnectAPI::Certificate.create_certificate_signing_request # Create a new certificate signing request def create_certificate end return cert_type end end cert_type = Spaceship::ConnectAPI::Certificate::CertificateType::MAC_APP_DEVELOPMENT if Cert.config[:development]