Class: PProf::Entitlements

Inherits:
Object
  • Object
show all
Defined in:
lib/pprof/entitlements.rb

Overview

Represents the list of entitlements in a Provisioning Profile

Instance Method Summary collapse

Constructor Details

#initialize(dict) ⇒ Entitlements

Create a new Entitlements object from the hash representation extracted from the Provisioning Profile

Parameters:

  • dict (Hash)

    The hash representation of the entitlements, typically extracted from the Provisioning Profile.



11
12
13
# File 'lib/pprof/entitlements.rb', line 11

def initialize(dict)
  @dict = dict
end

Instance Method Details

#[](key) ⇒ Object

Generic access to any entitlement by key

Parameters:

  • key (#to_s)

    The entitlement key to read



92
93
94
# File 'lib/pprof/entitlements.rb', line 92

def [](key)
  @dict[key.to_s]
end

#app_groupsArray<String>

The Application Groups registered in the entitlements

Returns:

  • (Array<String>)


55
56
57
# File 'lib/pprof/entitlements.rb', line 55

def app_groups
  @dict['com.apple.security.application-groups']
end

#app_idString

The full application identifier (including the team prefix), as specified in the entitlements

Returns:

  • (String)


33
34
35
# File 'lib/pprof/entitlements.rb', line 33

def app_id
  @dict['application-identifier']
end

#aps_environmentString

The Apple Push Service environment used for push notifications. Typically either ‘development’ or ‘production’, or ‘nil` if push isn’t enabled.

Returns:

  • (String)


48
49
50
# File 'lib/pprof/entitlements.rb', line 48

def aps_environment
  @dict['aps-environment']
end

#beta_reports_activeBool

Are Beta (TestFlight) reports active?

Returns:

  • (Bool)


62
63
64
# File 'lib/pprof/entitlements.rb', line 62

def beta_reports_active
  @dict['beta-reports-active']
end

#get_task_allowBool

The status of the ‘get-task-allow` flag. True if we can attach a debugger to the executable, false if not.

Returns:

  • (Bool)


26
27
28
# File 'lib/pprof/entitlements.rb', line 26

def get_task_allow
  @dict['get-task-allow']
end

#has_key?(key) ⇒ Boolean

Check if a given entitlement key is present

Parameters:

  • key (#to_s)

    The key to check

Returns:

  • (Boolean)


101
102
103
# File 'lib/pprof/entitlements.rb', line 101

def has_key?(key)
  @dict.has_key?(key.to_s)
end

#healthkitBool

True if the HealthKit entitlement is set

Returns:

  • (Bool)


69
70
71
# File 'lib/pprof/entitlements.rb', line 69

def healthkit
  @dict['com.apple.developer.healthkit']
end

#keychain_access_groupsArray<String>

The list of Keychain Access Groups

Returns:

  • (Array<String>)


18
19
20
# File 'lib/pprof/entitlements.rb', line 18

def keychain_access_groups
  @dict['keychain-access-groups']
end

#keysArray<String>

The list of all entitlement keys, as String

Returns:

  • (Array<String>)


109
110
111
# File 'lib/pprof/entitlements.rb', line 109

def keys
  @dict.keys.map(&:to_s)
end

#team_idString

The Team Identifier

Returns:

  • (String)


40
41
42
# File 'lib/pprof/entitlements.rb', line 40

def team_id
  @dict['com.apple.developer.team-identifier']
end

#to_hashHash

The hash representation of the entitlements (as represented in their PLIST form)

Returns:

  • (Hash)


116
117
118
# File 'lib/pprof/entitlements.rb', line 116

def to_hash
  @dict
end

#to_sString

The pretty-printed list of all entitlement keys and values (as a multi-line dashed list for human reading)

Returns:

  • (String)


124
125
126
127
128
# File 'lib/pprof/entitlements.rb', line 124

def to_s
  @dict.map do |key, value|
    "- #{key}: #{value}"
  end.join("\n")
end

#ubiquity_container_identifiersArray<String>

The Ubiquity Container identifiers, if at least one is enabled

Returns:

  • (Array<String>)


76
77
78
# File 'lib/pprof/entitlements.rb', line 76

def ubiquity_container_identifiers
  @dict['com.apple.developer.ubiquity-container-identifiers']
end

#ubiquity_kvstore_identifierString

The Ubiquity Key-Value Store Identifier, if enabled.

Returns:

  • (String)


83
84
85
# File 'lib/pprof/entitlements.rb', line 83

def ubiquity_kvstore_identifier
  @dict['com.apple.developer.ubiquity-kvstore-identifier']
end