> ## Documentation Index
> Fetch the complete documentation index at: https://chainpatrol.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> ThreatDetector is used to detect Phishing and Scam websites using ChainPatrol's APIs.

A [ThreatDetector](./constructor) allows you to easily build out community safety features
in your dApp or wallet. It is a smart wrapper around ChainPatrol's APIs that allows you to
check if a website is a scam or not. It comes with a variety of storage adapters, so you can
easily cache the results of your checks and avoid making unnecessary API calls.

```js theme={null}
import { ThreatDetector, Storage } from "@chainpatrol/sdk";

// Create a new detector instance
const detector = new ThreatDetector({
  mode: "cloud", // 'cloud' | 'local' (default: 'cloud')

  // Optional: Specify a custom API key (only available for 'cloud' mode)
  apiKey: "YOUR_API_KEY",

  // Optional: Configure a proxy server (only available for 'cloud' mode)
  proxyUrl: "https://proxy.acme.com",

  // Optional: Specify a custom storage adapter
  storage: Storage.extension(),
  // storage: Storage.browser(),
  // storage: Storage.memory(),

  // Optional: Specify a custom redirect URL
  redirectUrl: "https://app.chainpatrol.io/warning",
});
```

## Constructor

### `new ThreatDetector(options)`

Creates a new instance of the ThreatDetector class.

***

## Instance Methods

### [url()](./instance-methods/url)

Checks if a URL is a scam or not.

### [allow()](./instance-methods/allow)

Adds a URL to the local allowlist.

### [block()](./instance-methods/block)

Adds a URL to the local blocklist.

### [ignore()](./instance-methods/ignore)

Adds a URL to the local ignorelist.
