UNPKG

hibp

Version:

An unofficial TypeScript SDK for the 'Have I been pwned?' service.

43 lines (42 loc) 1.32 kB
/** * Fetches all data classes in the system. * * @param {object} [options] a configuration object * @param {string} [options.baseUrl] a custom base URL for the * haveibeenpwned.com API endpoints (default: * `https://haveibeenpwned.com/api/v3`) * @param {number} [options.timeoutMs] timeout for the request in milliseconds * (default: none) * @param {string} [options.userAgent] a custom string to send as the User-Agent * field in the request headers (default: `hibp <version>`) * @returns {(Promise<string[]> | Promise<null>)} a Promise which resolves to an * array of strings (or null if no data classes were found), or rejects with an * Error * @example * try { * const data = await dataClasses(); * if (data) { * // ... * } else { * // ... * } * } catch (err) { * // ... * } */ export declare function dataClasses(options?: { /** * a custom base URL for the haveibeenpwned.com API endpoints (default: * `https://haveibeenpwned.com/api/v3`) */ baseUrl?: string; /** * timeout for the request in milliseconds (default: none) */ timeoutMs?: number; /** * a custom string to send as the User-Agent field in the request headers * (default: `hibp <version>`) */ userAgent?: string; }): Promise<string[] | null>;