albertyw/ios_config_profile

View on GitHub
lib/ios_config_profile/device/security_payload.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module IOSConfigProfile
  class SecurityPayload < Hash
    include IOSConfigProfile::BasicPayload

    attr_accessor :content, :password

    def initialize(content, password)
      self.content = content
      self.password = password
      require_attributes :content, :password
      merge! security_payload
    end

    private

    def security_payload
      {
        "Password" => password,
        "PayloadUUID" => uuid,
        "PayloadContent" => StringIO.new(content),
        "PayloadCertificateFileName" => "identity.p12",

        "PayloadType" => "com.apple.security.pkcs12",
        "PayloadVersion" => 1,
        "PayloadIdentifier" => "#{IOSConfigProfile.root_domain}ipcu.profile.credential",
        "PayloadDisplayName" => "Security",
        "PayloadDescription" => "Provides device authentication (certificate or identity).",
        "PayloadOrganization" => IOSConfigProfile.organization,
      }
    end
  end
end