PerimeterX

object PerimeterX

PerimeterX main class. You should interact with it in order to setup and start the SDK.

Functions

Link copied to clipboard

Returns a JSON string that represent a "blocked request" error. When the interceptor is enabled, the body of the URL response will be the same as the string that returns here. When the interceptor is disabled, you may replace the original URL response with the string that returns here.

Link copied to clipboard
fun canHandleResponse(response: String, appId: String? = null): Boolean

This function checks if the SDK can handle the URL request's response and presents the block screen. Returns true if the PerimeterX's payload in the response can be handled by the SDK. This function does not present the block screen. You must call the start(appId:delegate:completion:) function and wait until it's done before calling this function

Link copied to clipboard

Returns a JSON string that represent a "blocked request and challenge cancelled" error. When the interceptor is enabled, the body of the URL response will be the same as the string that returns here. When the interceptor is disabled, you may replace the original URL response with the string that returns here.

Link copied to clipboard

Returns a JSON string that represent a "blocked request and challenge solved" error. When the interceptor is enabled, the body of the URL response will be the same as the string that returns here.

Link copied to clipboard
fun handleResponse(response: String, appId: String? = null, callback: (result: PerimeterXChallengeResult) -> Unit?): Boolean

This function handles the URL request's response and presents the block screen, if necessary. Returns true if the PerimeterX's payload in the response was handled by the SDK. This function should be used only when the `PXPolicyUrlRequestInterceptionType` is set to `PXPolicyUrlRequestInterceptionType/NONE` in the policy.

Link copied to clipboard

Returns HTTP headers that should be added to the URL request. This function should be used only when the `PXPolicy/urlRequestInterceptionType` is set to `PXPolicyUrlRequestInterceptionType/NONE`.

Link copied to clipboard

Returns true if the error is "blocked request and challenge cancelled" error. This kind error should returned when the `PXPolicyUrlRequestInterceptionType` is set to any value rather than `PXPolicyUrlRequestInterceptionType/NONE`.

Link copied to clipboard

Returns true if the error is "blocked request and challenge solved" error. This kind error should returned when the `PXPolicyUrlRequestInterceptionType` is set to any value rather than `PXPolicyUrlRequestInterceptionType/NONE`.

Link copied to clipboard

Returns true if the error is "blocked request" error. This kind error should returned when the `PXPolicyUrlRequestInterceptionType` is set to any value rather than `PXPolicyUrlRequestInterceptionType/NONE`.

Link copied to clipboard
fun registerOutgoingUrlRequest(url: String, appId: String? = null)

Provide outgoing URL request to the Account Defender feature. You must call the setUserId function before calling this function. If you are using the automatic interceptor you should not need to use this function (it will be called automatically by the interceptor).

Link copied to clipboard

Returns the current SDK version.

Link copied to clipboard
fun setAdditionalData(parameters: HashMap<String, String>, appId: String? = null)

Set additional data that support Account Defender for given AppID.

Link copied to clipboard
fun setCustomParameters(parameters: HashMap<String, String>, appId: String? = null)

Set custom parameters for given AppID.

Link copied to clipboard
fun setupWebView(webView: WebView, webViewClient: WebViewClient?)

Setup the web view to be synced with SDK. Do not set a web view client to the web view after calling this function. If you wish to set a web view client, call this function again with the new web view client. This function enables JavaScript in the web view's settings. Do not change this setting.

Link copied to clipboard
fun setUserId(userId: String?, appId: String? = null)

Calling this method with non-null userId will start the Account Defender feature. You must call the start function and wait until it's done before calling this function.

Link copied to clipboard
fun start(application: Application, appIds: ArrayList<String>, delegate: PerimeterXDelegate?, policy: PXPolicy)

Call this function to start th SDK with multiple AppIDs. You should call this function only once. You should call this function only from the main thread.

fun start(application: Application, appId: String, delegate: PerimeterXDelegate?, policy: PXPolicy)

Call this function to start th SDK with a single AppID. You should call this function only once. You should call this function only from the main thread.

Link copied to clipboard
fun vid(appId: String? = null): String?

Get the VID for given AppID.