Files
altcha/src/types.ts
Daniel Regeci bddbad588f 0.8.0
2024-08-09 19:05:28 -03:00

109 lines
2.2 KiB
TypeScript

export interface Strings {
error: string;
expired: string;
footer: string;
label: string;
verified: string;
verifying: string;
waitAlert: string;
}
export interface Configure {
analytics?: boolean;
auto?: 'onfocus' | 'onload' | 'onsubmit';
beaconurl?: string;
challenge?: Challenge;
challengeurl?: string;
debug?: boolean;
delay?: number;
expire?: number;
floating?: 'auto' | 'top' | 'bottom';
floatinganchor?: string;
floatingoffset?: number;
autorenew?: boolean;
hidefooter?: boolean;
hidelogo?: boolean;
maxnumber?: number;
mockerror?: boolean;
name?: string;
obfuscated?: string;
refetchonexpire?: boolean;
spamfilter?: boolean | 'ipAddress' | SpamFilter;
strings?: Partial<Strings>;
test?: boolean | number | 'delay';
verifyurl?: string;
workers?: number;
workerurl?: string;
}
export interface SpamFilter {
blockedCountries?: string[];
classifier?: string;
disableRules?: string[];
email?: string | false;
expectedCountries?: string[];
expectedLanguages?: string[];
fields?: string[] | false;
ipAddress?: string | false;
text?: string | string[];
timeZone?: string | false;
}
export interface ServerVerificationPayload {
blockedCountries?: string[];
classifier?: string;
disableRules?: string[];
email?: string;
expectedCountries?: string[];
expectedLanguages?: string[];
fields?: Record<string, string>;
ipAddress?: string;
payload: string;
text?: string | string[];
timeZone?: string;
}
export interface Solution {
number: number;
took: number;
worker?: boolean;
}
export interface Challenge {
algorithm: string;
challenge: string;
maxnumber?: number;
salt: string;
signature: string;
}
export interface Payload {
algorithm: string;
challenge: string;
number: number;
salt: string;
signature: string;
test?: boolean;
took: number;
}
export interface Obfuscated {
obfuscated: string;
key?: string;
maxnumber?: number;
}
export interface ClarifySolution {
clearText: string;
took: number;
worker?: boolean;
}
export enum State {
ERROR = 'error',
VERIFIED = 'verified',
VERIFYING = 'verifying',
UNVERIFIED = 'unverified',
EXPIRED = 'expired',
}