-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathindex.d.ts
41 lines (34 loc) · 1.2 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* The response type returned from the /siteverify
* endpoint used for verifying the challenge token.
*/
type VerifyResponse = {
/** Whether verification succeeded or not */
success: boolean,
/**
* Timestamp of the captcha (ISO format yyyy-MM-dd'T'HH:mm:ssZZ).
* Present when success is true.
*/
challenge_ts?: string,
/** Whether the response will be credited. Optional. */
credit?: boolean,
/** Hostname of the site where the captcha was solved. Optional */
hostname?: string,
/** List of error codes. Present if success is false */
"error-codes"?: string[],
/** A score denoting malicious activity. (Optional b/c of ENTERPRISE feature) */
score?: number,
/** Reason(s) for score. (Optional b/c of ENTERPRISE feature) */
score_reason?: string[],
};
declare module "hcaptcha" {
/**
* Verify HCaptcha token validity.
*
* @param secret HCaptcha secret key (`0x...`)
* @param token HCaptcha challenge token (`P0_ey...`)
* @param remoteip Optional. The user's IP address.
* @param sitekey Optional. The sitekey you expect to see.
*/
export function verify(secret: string, token: string, remoteip?: string, sitekey?: string): Promise<VerifyResponse>;
}