Apple SDK Legacy API Reference (v2.0.1 and v1.0)
This page documents Arkose Apple SDK API versions below v2.1.0, retained for customers on older SDK versions. For the current API, see the Mobile SDK for Apple page and the Apple SDK Common API Reference. We recommend upgrading to the latest SDK version.
For API Version 2.0.1
ArkoseConfig.Builder
Arkose Labs Enforcement Challenge configuration parameters can be updated using ArkoseConfig.Builder class. The public methods to specify these parameters are listed below:
-
public init(withAPIKey apiKey: String)Initialize the Builder instance with the public key of your account
-
public func with(apiBaseUrl: String) -> Builder
Base URL of Arkose Labs EC platform as supplied by Arkose Labs. -
public func with(blob: String) -> Builder
Specify any encrypted data blobs to share with Arkose Bot Manager. It is optional. -
public func with(language: String) -> Builder
Specify any language setting for the Enforcement Challenge, the default value is en. It is optional. -
public func build() -> ArkoseConfig
Builds and returns an instance of ArkoseConfig
ArkoseConfig
An instance of ArkoseConfig contains all the configuration parameters, use ArkoseConfig.Builder to class to construct an instance of ArkoseConfig
ArkoseManager
ArkoseManager class provides public methods to integrate the application with the Arkose Bot Manager.
public static func initialize(with configuration: ArkoseConfig)
Initialize Arkose Bot Manager SDK with the configuration parameterspublic static func update(with configuration: ArkoseConfig)
Update Arkose Bot Manager SDK with the configuration parameterspublic static func showEnforcementChallenge(parent: UIViewController,delegate: ArkoseChallengeDelegate,cancelActionConfig: ArkoseActionConfig? = nil,resetActionConfig: ArkoseActionConfig? = nil)
Display the Enforcement Challenge View and invokes the ArkoseChallengeDelegate methods to notify the result.
parent: An instance of UIViewController where the Enforcement Challenge View is displayed
delegate: An instance ofArkoseChallengeDelegateto receive event notifications
cancelButtonTitle: A localized string for the title of theCancelbutton, the default value is "Cancel".
If this parameter is set to nil, the Cancel button is not shown in the view.Deprecated since Arkose SDK v2.18.0.- cancelActionConfig: A structure containing localised
Stringfor the title of the Cancel button and localisedStringfor the accessibilityHint of the Cancel Button. If set tonil, the Cancel button will not be displayed in the view.
Example structure can be as follows
resetButtonTitle: A localized string for the title of theResetbutton, the default value is nil.
If this parameter is set to nil, the Reset button is not shown in the view. public static var logLevel: LogLevel
Set the log level for the SDK. All messages logged by theArkoseLabsKitframework will have the [ArkoseLabsKit] text for easy identification. ValidLogLevelvalues are:info, warn, error
ArkoseChallengeView
ArkoseChallengeView is the SwiftUI View component to integrate into the contents of the application View.
public init(isPresented: Binding<Bool>,
delegate: ArkoseChallengeDelegate,
cancelButtonTitle: String? = nil,
resetButtonTitle: String? = nil,
config: ArkoseConfig? = nil)isPresented: A boolean value to control the visibility of the Enforcement Challenge View
delegate: An instance of ArkoseChallengeDelegate to receive event notifications
cancelButtonTitle: A localized string for the title of the Cancel button, the default value is "Cancel".
If this parameter is set to nil, the Cancel button is not shown in the view.
resetButtonTitle: A localize string for the title of the Reset button, the default value is nil.
If this parameter is set to nil, the Reset button is not shown in the view
config: An ArkoseConfig created using it’s builder, the default is nil.
if this parameter is set to nil, the configuration is not updated with latest configuration
LogLevel
LogLevel is an enumeration to control the logs generated by the framework. The valid values are:
info
Log messages with severity level of info and abovewarn
Log messages with severity level of warn and aboveerror
Log messages with severity level of error only
ArkoseChallengeDelegate
ArkoseChallengeDelegate is a protocol to be implemented by the application and passed in showEnforcementChallenge function call to receive notification about different events during Enforcement Challenge View lifecycle.
All notifications are applicable to both Arkose Bot Manager detection and enforcement components unless explicitly specified.
-
func onReady()
onReady callback is invoked when the Enforcement or detection is ready. -
func onShow()
onShow callback is invoked when the Enforcement is running and our detection component is analyzing the user intent. The function is also invoked when an Enforcement Challenge or detection is re-displayed (e.g. if the user closes the EC or detection view and tries to continue).
Applicable to enforcement only. -
func onShown()
onShown callback is invoked when the Enforcement Challenge is displayed for the first time.
Applicable to enforcement only. -
func onSuppress()
onSuppress callback is invoked when either an Enforcement Challenge is suppressed (i.e. A session was classified as not requiring a challenge) or detection is running and our detection component is analyzing the user intent. -
func onHide()
onHide callback is invoked when the EC or detection view is hidden. For example, this happens after an EC or detection is completed or if the user clicks the close button. -
func onReset()
onReset callback is invoked after the Enforcement Challenge is reset. Typically occurs after a challenge has been successfully answered.
Applicable to enforcement only. -
func onCompleted(response: [String: Any?])
onCompleted callback is invoked when a session is classified as not needing a challenge or a detection has been successfully completed.A Response Object is passed to this function.
-
func onError(response: [String: Any?])
onError callback is invoked when an error occurs when loading the challenge or detection.A Response Object is passed to this function.
-
func onWarning(response: [String: Any?])
onWarning callback is invoked when an issue occurs which needs to be shared with the app as a warning, based on which App can take custom actions, when loading the challenge or detection.A Response Object is passed to this function.
-
func onFailed(response: [String: Any?])
onFailed callback is invoked when a challenge has failed (the user has failed the challenge multiple times and is not allowed to continue the session).A Response Object is passed to this function.
Applicable to enforcement only.
For API Version 1.0
Note: Version 1.0 APIs are deprecated starting with ArkoseLabsKit framework 2.0.0, but fully backward compatible with old APIs. But we recommend upgrading to the simplified implementation in 2.0.0 and above.
ALWebView
| Configuration Object | Type | Description |
|---|---|---|
ALWebView | Public method | Method used to start Arkose Bot Manager.Before this method is called, the model object must be initialized with these three additional configuration parameters detailed in this table. - webEventDelegate (should be assigned to “receiving component”) - apiLang - apiBlob |
WebEventDelegate | Public delegate component | Lets clients receive callbacks from Arkose Bot Manager. |
apiLang | String | Applies only to enforcement.Language setting for the Enforcement Challenge.Default: "en" |
apiBlob | String | Optional. Mainly used to share any client encrypted data blobs with Arkose Bot Manager.Default: "" |
apiKey | String | Optional. The API_KEY added in Config.plist can be overridden with this value if needed.Default: "" |
resetSession | Public method | Optional method to reset the current session for Arkose Bot Manager. This creates a new session. |
WebEventDelete Protocol
| Events Callback | Type | Description Event | Applicable Component |
|---|---|---|---|
onReady | Event | Receives the onReady event callback from the API server.Invoked when the Enforcement or detection is ready. The Enforcement or detection cannot be triggered before this event. You may want to disable the UI you are protecting until this event has been triggered. | Detection Enforcement |
onShow | Event | Listener function invoked when the Enforcement is running and detection is analyzing the user intent. The function is also invoked when an Enforcement Challenge or detection is re-displayed (e.g. if the user closes the EC or detection view and tries to continue). Note that the close button only appears when in Lightbox mode. | Detection Enforcement |
onShown | Event | Function only invoked the when the Enforcement Challenge is displayed for the first time. | Enforcement |
onSuppress | Event | Listener function invoked when either an Enforcement Challenge is suppressed (i.e. A session was classified as not requiring a challenge) or detection is running and detection is analyzing the user intent. | Detection Enforcement |
onHide | Event | Listener function invoked when the EC or detection view is hidden. For example, this happens after an EC or detection is completed or if the user clicks the close button. Note that the close button only appears when in Lightbox mode. | Detection Enforcement |
onReset | Event | Function invoked after the Enforcement resets. Typically occurs after a challenge has been successfully answered. | Enforcement |
onCompleted | Event | Listener function invoked when a session is classified as not needing a challenge or a detection has been successfully completed.A Response Object is passed to this function. | Detection Enforcement |
onError | Event | Function invoked when an error occurs when loading the challenge or detection.A Response Object is passed to this function. | Detection Enforcement |
onWarning | Event | Function invoked when an issue occurs which needs to be shared with the app as a warning, based on which App can take custom actions, when loading the challenge or detection.A Response Object is passed to this function. | Detection Enforcement |
onFailed | Event | Function invoked when a challenge has failed (the user has failed the challenge multiple times and is not allowed to continue the session).A Response Object is passed to this function. | Enforcement |
onResize | Event | Function invoked on a resizing event which provides the new width and height values of the EC due to an SDK call.A Response Object is passed to this function. | Enforcement |
Configuration Parameters
You can change the following configuration parameters by specifying their values in the config.plist file.
| Configuration Parameters | Type | Description |
|---|---|---|
API_URL_BASE | String | Base URL of Arkose Bot Manager as supplied by Arkose Labs. |
API_KEY | String | Public key for your account. |
API_FILE | String | Name of JavaScript file of Arkose Bot Manager as supplied by Arkose Labs. |
Config.plist Example
Config.plist Example<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>VERIFICATION_URL</key>
<string></string>
<key>API_KEY</key>
<!-- Replace <YOUR_PUBLIC_KEY> with the public key that has been setup for your account -->
<string>YOUR_PUBLIC_KEY</string>
<key>API_URL_BASE</key>
<string>https://client-api.arkoselabs.com/v2</string>
<key>API_FILE</key>
<string>api.js</string>
</dict>
</plist>Updated about 6 hours ago