index.d.ts 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import * as RNGSModule from "./module";
  2. export { BackgroundBlurEffectIOS, Lang } from "./module";
  3. export interface IAPI1Result {
  4. success: 0 | 1;
  5. challenge: string;
  6. gt: string;
  7. new_captcha: boolean;
  8. [key: string]: any;
  9. }
  10. export interface IOption {
  11. api1Result: IAPI1Result;
  12. debug?: boolean;
  13. loadTimeout?: number;
  14. reqTimeout?: number;
  15. lang?: RNGSModule.Lang;
  16. enableBackgroundCancel?: boolean;
  17. backgroundColorIOS?: any;
  18. backgroundBlurEffectIOS?: RNGSModule.BackgroundBlurEffectIOS;
  19. onEvent?: (code: Events, data?: Array<number | string>) => void;
  20. }
  21. export interface IResult {
  22. geetest_challenge: string;
  23. geetest_seccode: string;
  24. geetest_validate: string;
  25. [key: string]: any;
  26. }
  27. export declare enum Errors {
  28. PARAMETER_PARSE_FAILED = -1,
  29. ANDROID_ACTIVITY_DESTROYED = -2,
  30. DUPLICATE_START = -3
  31. }
  32. export declare enum Events {
  33. RESULT = 1,
  34. CLOSED = 2,
  35. FAILED = 3,
  36. ERROR = 0
  37. }
  38. export declare function start(option: IOption): Promise<IResult>;
  39. export declare class GeetestError extends Error {
  40. readonly code: number;
  41. readonly message: string;
  42. constructor(code: number, message: string);
  43. }