Only the domain portion of the URL is checked. The path and query string are stripped before sending the request to the ChainPatrol API to preserve privacy and prevent leaking sensitive information.

Example

Parameters

url
string
required

The URL to check. This can be a full URL or a domain. The URL will be parsed to extract only the domain for checking.

Ex. https://google.com or google.com

Return Value

The return value is a promise that resolves with an object containing the result of the check.

Success

If the check was successful, the object will contain the following properties:

result
object
required
ok
true
required

This property will be true if the check was successful.

url
string

The url property is the URL that was checked.

status
'ALLOWED' | 'BLOCKED' | 'UNKNOWN'
required

The status property indicates whether the URL is allowed or blocked.

redirectUrl
string

The redirectUrl property specifies where to redirect the user when the detector detects a threat. This property will only be present if the status property is set to BLOCKED.

By default, the detector will return the ChainPatrol warning page URL, but you can override this by specifying your own redirectUrl in when instantiating the ThreatDetector.

Failure

However, if the check was unsuccessful, the object will contain the following:

result
object
required
ok
false
required

This property will be false if the check was unsuccessful.

url
string

The url property is the URL that was checked.

error
string

The error property will contain a human-readable error message.