UNPKG

@coolgk/utils

Version:

javascript, typescript utility and wrapper functions and classes: array, string, base64, ampq, bcrypt, cache, captcha, csv, email, jwt, number, pdf, tmp, token, unit conversion, url params, session, form data, google sign in, facebook sign in

35 lines (33 loc) 1.05 kB
/*! * @package @coolgk/utils * @version 3.1.4 * @link https://github.com/coolgk/node-utils * @license MIT * @author Daniel Gong <daniel.k.gong@gmail.com> * * Copyright (c) 2017 Daniel Gong <daniel.k.gong@gmail.com>. All rights reserved. * Licensed under the MIT License. */ /// <reference types="request" /> /*! * Copyright (c) 2017 Daniel Gong <daniel.k.gong@gmail.com>. All rights reserved. * Licensed under the MIT License. */ import * as request from 'request'; export interface ICaptchaConfig { readonly request?: typeof request; readonly secret: string; } export interface IResult { success: boolean; [index: string]: any; } export declare class Captcha { static readonly _RECAPTCHA_URL: string; protected _secret: string; protected _request: typeof request; constructor(options: ICaptchaConfig); verify(response: string, remoteip?: string): Promise<IResult>; } export declare function verify(secret: string, response: string, remoteip?: string): Promise<IResult>; export default Captcha;