DeviceSecurityRules
@objc
public class DeviceSecurityRules : NSObject, InitializationStateProvider
Control which device security checks will be evaluated.
Control which device security checks will be evaluated when the application launches and when checkDeviceSecurity()
is called.
The following demonstrates how to only enable jailbreak detection:
// Initialize rules
var deviceSecurityRules = DeviceSecurityRules(featureStatus: .disabled)
// Enable jailbreak detection.
deviceSecurityRules = deviceSecurityRule.enableCheck(.jailbreakDetection)
// Set the new rules.
ManageRules.setDeviceSecurityRules(deviceSecurityRules)
-
Designated initializer
Declaration
Swift
public init(featureStatus: FeatureStatus)
-
Enable a specific security check.
Throws
invalidInitializationState
indicating that lib is incorrect state to use this APIDeclaration
Swift
@discardableResult public func enableCheck(_ check: DeviceSecurityCheck) throws -> DeviceSecurityRules
Parameters
check
A check to be enabled.
-
Disable a specific security check from being evaluated.
Throws
invalidInitializationState
indicating that lib is incorrect state to use this APIDeclaration
Swift
@discardableResult public func disableCheck(_ check: DeviceSecurityCheck) throws -> DeviceSecurityRules
Parameters
check
A check to be disabled.
-
Determine if a specific check is enabled or disabled.
Throws
invalidInitializationState
indicating that lib is incorrect state to use this APIDeclaration
Swift
public func featureStatus(of check: DeviceSecurityCheck) throws -> FeatureStatus
Parameters
check
A check to get status for.
-
Set an enforcement action specifically for debugger detection (
debugDetection
).The enforcement action for all other
DeviceSecurityCheck
types is to notify and so will not terminate the application process.Warning
When setting enforcement action for the check type other than
debugDetection
, method raises an exceptionThrows
invalidInitializationState
indicating that lib is incorrect state to use this APIDeclaration
Swift
@discardableResult public func setEnforcementAction(_ action: DeviceSecurityEnforcementAction, for check: DeviceSecurityCheck) throws -> DeviceSecurityRules
Parameters
action
An enforcement action to be set.
check
A device security check for what the enforcement action should be applied
-
Check what enforcement action will be applied when a device threat is detected.
Currently this action only applies to debugger detection (
debugDetection
).Throws
invalidInitializationState
indicating that lib is incorrect state to use this APIDeclaration
Swift
public func enforcementAction(for check: DeviceSecurityCheck) throws -> DeviceSecurityEnforcementAction
Parameters
check
A device security check to retrieve the enfrocement action for.