b0VIM 8.0]<ݖjoshJoshs-MacBook-Pro.local~josh/Projects/fastlane/fastlane/spaceship/lib/spaceship/portal/certificate.rbutf-8 U3210#"! UtpmcnUD*ad&mTN ybJI V E 2   { z 0  o g @ / ` G k Z C % $ n9L*)oK'b7srlkzy% class MacDevelopment < Certificate; end # A Mac development code signing certificate used for development environment class InHouse < Certificate; end # An In House code signing certificate used for enterprise distributions class Production < Certificate; end # A production code signing certificate used for distribution environment class Development < Certificate; end # A development code signing certificate used for development environment class AppleDistribution < Certificate; end # An Apple distribution code signing certificate used for distribution environment class AppleDevelopment < Certificate; end # An Apple development code signing certificate used for development environment ##################################################### # Certs are not associated with apps ##################################################### }) 'canDownload' => :can_download 'certificateTypeDisplayId' => :type_display_id, 'ownerId' => :owner_id, 'ownerName' => :owner_name, 'ownerType' => :owner_type, 'expirationDate' => :expires, 'dateCreated' => :created, 'statusString' => :status, 'name' => :name, 'certificateId' => :id, attr_mapping({ attr_accessor :can_download # @return (Bool) Whether or not the certificate can be downloaded attr_accessor :type_display_id # "5QPB9NHCEI" # @example Development Certificate # "R58UK2EWSO" # @example Production Certificate # @return (String) The type of the certificate # the certificate. Available values listed in CERTIFICATE_TYPE_IDS # which is automatically used to determine the class of # Indicates the type of this certificate attr_accessor :owner_id # "75B83SPLAA" # @example # fetch more information # @return (String) The ID of the owner, that can be used to attr_accessor :owner_name # "tools.fastlane.app" # @example Push Certificate (the bundle identifier) # "SunApps Gmbh" # @example Code Signing Identity (usually the company name) # # @return (String) The name of the owner attr_accessor :owner_type # "bundle" # @example Push Certificate # "team" # @example Code Signing Identity # # or a code signing identity # @return (String) The owner type that defines if it's a push profile attr_accessor :expires # 2016-04-01 21:24:00 UTC # @example # @return (Date) The date and time when the certificate will expire attr_accessor :created # 2015-04-01 21:24:00 UTC # @example # @return (Date) The date and time when the certificate was created attr_accessor :status # "Issued" # @example # @return (String) Status of the certificate attr_accessor :name # "Apple Push Services" # @example Push Profile # "SunApps GmbH" # @example Company # @return (String) The name of the certificate attr_accessor :id # "P577TH3PAA" # @example # @return (String) The ID given from the developer portal. You'll probably not need it. class Certificate < PortalBase # This can either be a code signing identity or a push profile # # Represents a certificate from the Apple Developer Portal. module Portalmodule Spaceshiprequire_relative 'website_push'require_relative 'app'require 'openssl'addDs3) \ . ~ = C B x 9 f   aJaWViV/%$end end end end MAC_CERTIFICATE_TYPE_IDS.include?(type_display_id) def mac? # @return (Bool) Is this a Mac profile? end self.kind_of?(PushCertificate) def is_push? # @return (Bool): Is this certificate a push profile for apps? end client.revoke_certificate!(id, type_display_id, mac: mac?) def revoke! # Revoke the certificate. You shouldn't use this method probably. end OpenSSL::X509::Certificate.new(download_raw) def download # @return (OpenSSL::X509::Certificate) Downloads and parses the certificate end client.download_certificate(id, type_display_id, mac: mac?) def download_raw # @return (String) Download the raw data of the certificate without parsing # instance methods end end Spaceship::Portal::App def portal_type # @return (Class): The class this type of certificate belongs to # Default portal class to use when finding by bundle_id end self.new(response) response['certificateTypeDisplayId'] = response['certificateType']['certificateTypeDisplayId'] # munge the response to make it work for the factory response = client.create_certificate!(type, csr.to_pem, app_id, mac) # if this succeeds, we need to save the .cer and the private key in keychain access or wherever they go in linux csr = OpenSSL::X509::Request.new(csr) if csr.kind_of?(String) # ensure csr is a OpenSSL::X509::Request end app_id = app.app_id raise "Could not find app with bundle id '#{bundle_id}'" unless app app = portal_type.set_client(client).find(bundle_id) if bundle_id # look up the app_id by the bundle_id mac = MAC_CERTIFICATE_TYPE_IDS.include?(type) type = CERTIFICATE_TYPE_IDS.key(self) def create!(csr: nil, bundle_id: nil) # @return (Certificate): The newly created certificate # Spaceship::Certificate::Production.create!(csr: csr) # # Use the signing request to create a new distribution certificate # # csr, pkey = Spaceship::Certificate.create_certificate_signing_request # # Create a new certificate signing request # @example # certificates, you must only pass a certificate signing request. # This value is only needed if you create a push profile. For normal code signing # @param bundle_id (String) (optional): The app identifier this certificate is for. # `create_certificate_signing_request`adT # # csr, pkey = Spaceship.certificate.create_certificate_signing_request # Create a new certificate signing request # @example # generate a new certificate # Create a new code signing request that can be used toadc2zy- T S V # " w M 0  e = <  H   oE`7SKJ$}U@87`0i+uthgPOCB-, fica end def mac_app_distribution end def in_house end def production end def mac_development def devevlopment class << self # Class methods .merge(MAC_CERTIFICATE_TYPE_IDS) .merge(IOS_CERTIFICATE_TYPE_IDS) CERTIFICATE_TYPE_IDS = APPLE_CERTIFICATE_TYPE_IDS } "DIVN2GW3XT" => DeveloperIdApplication "HQ4KP3I34R" => MacDevelopmentPush, "CDZ7EMXIZ1" => MacProductionPush, "W0EURJRMC5" => DeveloperIdApplication, "OYVN2GW35E" => DeveloperIdInstaller, "2PQI8IDXNH" => MacInstallerDistribution, "HXZEUKP0FP" => MacAppDistribution, "749Y1QAGU7" => MacDevelopment, MAC_CERTIFICATE_TYPE_IDS = { ] "FUOY7LWJET" "3BQKVH9I2X", # ProductionPush, "S5WE21TULA", "FGQUP4785Z", "DZQUP8189Y", "T44PTHVNID", # those are also sent by the browser, but not sure what they represent OLDER_IOS_CERTIFICATE_TYPES = [ } "MD8Q2VRT6A" => ApplePayMerchantIdentity "4APLUP237T" => ApplePay, "E5D663CMZW" => VoipPush, "3T2ZP62QW8" => WebsitePush, "Y3B2F3TYSI" => Passbook, "UPV3DW712I" => ProductionPush, "BKLRAVXMGM" => DevelopmentPush, "LA30L5BJEU" => Certificate, "9RQEK7MSXA" => InHouse, "R58UK2EWSO" => Production, "5QPB9NHCEI" => Development, IOS_CERTIFICATE_TYPE_IDS = { } "WXV89964HE" => AppleDistribution "83Q87W3TGH" => AppleDevelopment, APPLE_CERTIFICATE_TYPE_IDS = { class MacProductionPush < PushCertificate; end # A Mac push notification certificate for production environment class MacDevelopmentPush < PushCertificate; end # A Mac push notification certificate for development environment class ApplePayMerchantIdentity < Certificate; end # ApplePayMerchantIdentity certificate class ApplePay < Certificate; end # ApplePay certificate class Passbook < Certificate; end # Passbook certificate class VoipPush < PushCertificate; end # A push notification certificate for the VOIP environment end end Spaceship::Portal::WebsitePush def self.portal_type class WebsitePush < PushCertificate # A push notification certificate for websites class ProductionPush < PushCertificate; end # A push notification certificate for production environment class DevelopmentPush < PushCertificate; end # A push notification certificate for development environment class PushCertificate < Certificate; end # DevelopmentPush, ProductionPush, WebsitePush and VoipPush # Abstract class for push certificates. Check out the subclasses ##################################################### # Certs that are specific for one app ##################################################### class DeveloperIdInstaller < Certificate; end # A Mac Developer ID signing certificate for building .pkg installers class DeveloperIdApplication < Certificate; end # A Mac Developer ID signing certificate for building .app bundles class MacInstallerDistribution < Certificate; end # A Mac production code signing certificate for building .pkg installers class MacAppDistribution < Certificate; end # A Mac production code signing certificate for building .app bundlesadR`_SR end def mac_app_distribution end def in_house end def production end def mac_development end