fraud-check-ts
Version:
This module integrates the IP-API service to analyze IP addresses and determine their potential for fraudulent activity based on a predefined list of high-risk countries. It is designed to enhance security measures for online platforms by identifying and
30 lines (28 loc) • 846 B
TypeScript
type ConstructorType = {
key?: string;
};
type VerifyOptions = ({
validCountries: string[];
} | {
bannedCountries: string[];
}) & {
allowProxy?: boolean;
allowHosting?: boolean;
allowFailStatus?: boolean;
byPassIcloudRelay?: boolean;
};
type VerifyResponse = {
success: true;
} | {
success: false;
reason: "invalid_ip" | "status_fail" | "is_proxy" | "is_hosting" | "banned_country" | "not_valid_country" | string;
};
declare class FraudChecker {
readonly key: string | undefined;
constructor(payload: ConstructorType);
private runApi;
verify(ip: string, opts: VerifyOptions): Promise<VerifyResponse>;
static fraudChecker(payload: ConstructorType): FraudChecker;
}
declare function fraudChecker(payload: ConstructorType): FraudChecker;
export { FraudChecker as default, fraudChecker };