hibp 0.0.0-dev.8859c6fb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/API.md +508 -0
  2. package/CHANGELOG.md +7 -0
  3. package/LICENSE.txt +22 -0
  4. package/MIGRATION.md +227 -0
  5. package/README.md +255 -0
  6. package/dist/browser/hibp.module.js +2 -0
  7. package/dist/browser/hibp.module.js.map +1 -0
  8. package/dist/browser/hibp.umd.js +2 -0
  9. package/dist/browser/hibp.umd.js.map +1 -0
  10. package/dist/cjs/api/haveibeenpwned/fetchFromApi.js +107 -0
  11. package/dist/cjs/api/haveibeenpwned/fetchFromApi.js.map +1 -0
  12. package/dist/cjs/api/haveibeenpwned/index.js +6 -0
  13. package/dist/cjs/api/haveibeenpwned/index.js.map +1 -0
  14. package/dist/cjs/api/haveibeenpwned/responses.js +79 -0
  15. package/dist/cjs/api/haveibeenpwned/responses.js.map +1 -0
  16. package/dist/cjs/api/pwnedpasswords/fetchFromApi.js +44 -0
  17. package/dist/cjs/api/pwnedpasswords/fetchFromApi.js.map +1 -0
  18. package/dist/cjs/api/pwnedpasswords/index.js +5 -0
  19. package/dist/cjs/api/pwnedpasswords/index.js.map +1 -0
  20. package/dist/cjs/api/pwnedpasswords/responses.js +20 -0
  21. package/dist/cjs/api/pwnedpasswords/responses.js.map +1 -0
  22. package/dist/cjs/breach.js +55 -0
  23. package/dist/cjs/breach.js.map +1 -0
  24. package/dist/cjs/breachedAccount.js +101 -0
  25. package/dist/cjs/breachedAccount.js.map +1 -0
  26. package/dist/cjs/breaches.js +55 -0
  27. package/dist/cjs/breaches.js.map +1 -0
  28. package/dist/cjs/dataClasses.js +34 -0
  29. package/dist/cjs/dataClasses.js.map +1 -0
  30. package/dist/cjs/hibp.js +21 -0
  31. package/dist/cjs/hibp.js.map +1 -0
  32. package/dist/cjs/maybe-fetch.js +12 -0
  33. package/dist/cjs/maybe-fetch.js.map +1 -0
  34. package/dist/cjs/package.json.js +7 -0
  35. package/dist/cjs/package.json.js.map +1 -0
  36. package/dist/cjs/pasteAccount.js +59 -0
  37. package/dist/cjs/pasteAccount.js.map +1 -0
  38. package/dist/cjs/pwnedPassword.js +45 -0
  39. package/dist/cjs/pwnedPassword.js.map +1 -0
  40. package/dist/cjs/pwnedPasswordRange.js +63 -0
  41. package/dist/cjs/pwnedPasswordRange.js.map +1 -0
  42. package/dist/cjs/search.js +97 -0
  43. package/dist/cjs/search.js.map +1 -0
  44. package/dist/esm/api/haveibeenpwned/fetchFromApi.mjs +104 -0
  45. package/dist/esm/api/haveibeenpwned/fetchFromApi.mjs.map +1 -0
  46. package/dist/esm/api/haveibeenpwned/index.mjs +2 -0
  47. package/dist/esm/api/haveibeenpwned/index.mjs.map +1 -0
  48. package/dist/esm/api/haveibeenpwned/responses.mjs +71 -0
  49. package/dist/esm/api/haveibeenpwned/responses.mjs.map +1 -0
  50. package/dist/esm/api/pwnedpasswords/fetchFromApi.mjs +42 -0
  51. package/dist/esm/api/pwnedpasswords/fetchFromApi.mjs.map +1 -0
  52. package/dist/esm/api/pwnedpasswords/index.mjs +2 -0
  53. package/dist/esm/api/pwnedpasswords/index.mjs.map +1 -0
  54. package/dist/esm/api/pwnedpasswords/responses.mjs +17 -0
  55. package/dist/esm/api/pwnedpasswords/responses.mjs.map +1 -0
  56. package/dist/esm/breach.mjs +53 -0
  57. package/dist/esm/breach.mjs.map +1 -0
  58. package/dist/esm/breachedAccount.mjs +99 -0
  59. package/dist/esm/breachedAccount.mjs.map +1 -0
  60. package/dist/esm/breaches.mjs +53 -0
  61. package/dist/esm/breaches.mjs.map +1 -0
  62. package/dist/esm/dataClasses.mjs +32 -0
  63. package/dist/esm/dataClasses.mjs.map +1 -0
  64. package/dist/esm/hibp.mjs +10 -0
  65. package/dist/esm/hibp.mjs.map +1 -0
  66. package/dist/esm/maybe-fetch.mjs +8 -0
  67. package/dist/esm/maybe-fetch.mjs.map +1 -0
  68. package/dist/esm/package.json.mjs +4 -0
  69. package/dist/esm/package.json.mjs.map +1 -0
  70. package/dist/esm/pasteAccount.mjs +57 -0
  71. package/dist/esm/pasteAccount.mjs.map +1 -0
  72. package/dist/esm/pwnedPassword.mjs +43 -0
  73. package/dist/esm/pwnedPassword.mjs.map +1 -0
  74. package/dist/esm/pwnedPasswordRange.mjs +61 -0
  75. package/dist/esm/pwnedPasswordRange.mjs.map +1 -0
  76. package/dist/esm/search.mjs +95 -0
  77. package/dist/esm/search.mjs.map +1 -0
  78. package/dist/hibp.d.ts +502 -0
  79. package/example/runkit.js +16 -0
  80. package/package.json +138 -0
package/dist/hibp.d.ts ADDED
@@ -0,0 +1,502 @@
1
+ // Generated by dts-bundle-generator v7.2.0
2
+
3
+ //
4
+ // Data Models from the API
5
+ //
6
+ export interface Breach {
7
+ Name: string;
8
+ Title: string;
9
+ Domain: string;
10
+ BreachDate: string;
11
+ AddedDate: string;
12
+ ModifiedDate: string;
13
+ PwnCount: number;
14
+ Description: string;
15
+ LogoPath: string;
16
+ DataClasses: string[];
17
+ IsVerified: boolean;
18
+ IsFabricated: boolean;
19
+ IsSensitive: boolean;
20
+ IsRetired: boolean;
21
+ IsSpamList: boolean;
22
+ }
23
+ export interface Paste {
24
+ Id: string;
25
+ Source: string;
26
+ Title: string;
27
+ Date: string;
28
+ EmailCount: number;
29
+ }
30
+ /**
31
+ * An object representing a breach.
32
+ *
33
+ * @typedef {object} Breach
34
+ * @property {string} Name
35
+ * @property {string} Title
36
+ * @property {string} Domain
37
+ * @property {string} BreachDate
38
+ * @property {string} AddedDate
39
+ * @property {string} ModifiedDate
40
+ * @property {number} PwnCount
41
+ * @property {string} Description
42
+ * @property {string} LogoPath
43
+ * @property {string[]} DataClasses
44
+ * @property {boolean} IsVerified
45
+ * @property {boolean} IsFabricated
46
+ * @property {boolean} IsSensitive
47
+ * @property {boolean} IsRetired
48
+ * @property {boolean} IsSpamList
49
+ */
50
+ /**
51
+ * Fetches data for a specific breach event.
52
+ *
53
+ * @param {string} breachName the name of a breach in the system
54
+ * @param {object} [options] a configuration object
55
+ * @param {string} [options.baseUrl] a custom base URL for the
56
+ * haveibeenpwned.com API endpoints (default:
57
+ * `https://haveibeenpwned.com/api/v3`)
58
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
59
+ * field in the request headers (default: `hibp <version>`)
60
+ * @returns {(Promise<Breach>|Promise<null>)} a Promise which resolves to an
61
+ * object representing a breach (or null if no breach was found), or rejects
62
+ * with an Error
63
+ * @example
64
+ * breach('Adobe')
65
+ * .then(data => {
66
+ * if (data) {
67
+ * // ...
68
+ * } else {
69
+ * // ...
70
+ * }
71
+ * })
72
+ * .catch(err => {
73
+ * // ...
74
+ * });
75
+ */
76
+ export declare function breach(
77
+ breachName: string,
78
+ options?: {
79
+ baseUrl?: string;
80
+ userAgent?: string;
81
+ },
82
+ ): Promise<Breach | null>;
83
+ /**
84
+ * Fetches breach data for a specific account.
85
+ *
86
+ * ***Warning (July 18, 2019):***
87
+ *
88
+ * `haveibeenpwned.com` now requires an API key from
89
+ * https://haveibeenpwned.com/API/Key for the `breachedaccount` endpoint. The
90
+ * `apiKey` option here is not explicitly required, but direct requests made
91
+ * without it (that is, without specifying a `baseUrl` to a proxy that inserts a
92
+ * valid API key on your behalf) will fail.
93
+ *
94
+ * @param {string} account a username or email address
95
+ * @param {object} [options] a configuration object
96
+ * @param {string} [options.apiKey] an API key from
97
+ * https://haveibeenpwned.com/API/Key (default: undefined)
98
+ * @param {string} [options.domain] a domain by which to filter the results
99
+ * (default: all domains)
100
+ * @param {boolean} [options.includeUnverified] include "unverified" breaches in
101
+ * the results (default: true)
102
+ * @param {boolean} [options.truncate] truncate the results to only include
103
+ * the name of each breach (default: true)
104
+ * @param {string} [options.baseUrl] a custom base URL for the
105
+ * haveibeenpwned.com API endpoints (default:
106
+ * `https://haveibeenpwned.com/api/v3`)
107
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
108
+ * field in the request headers (default: `hibp <version>`)
109
+ * @returns {(Promise<Breach[]> | Promise<null>)} a Promise which resolves to an
110
+ * array of breach objects (or null if no breaches were found), or rejects with
111
+ * an Error
112
+ * @example
113
+ * breachedAccount('foo', { apiKey: 'my-api-key' })
114
+ * .then(data => {
115
+ * if (data) {
116
+ * // ...
117
+ * } else {
118
+ * // ...
119
+ * }
120
+ * })
121
+ * .catch(err => {
122
+ * // ...
123
+ * });
124
+ * @example
125
+ * breachedAccount('bar', {
126
+ * includeUnverified: false,
127
+ * baseUrl: 'https://my-hibp-proxy:8080',
128
+ * })
129
+ * .then(data => {
130
+ * if (data) {
131
+ * // ...
132
+ * } else {
133
+ * // ...
134
+ * }
135
+ * })
136
+ * .catch(err => {
137
+ * // ...
138
+ * });
139
+ * @example
140
+ * breachedAccount('baz', {
141
+ * apiKey: 'my-api-key',
142
+ * domain: 'adobe.com',
143
+ * truncate: false,
144
+ * userAgent: 'my-app 1.0'
145
+ * })
146
+ * .then(data => {
147
+ * if (data) {
148
+ * // ...
149
+ * } else {
150
+ * // ...
151
+ * }
152
+ * })
153
+ * .catch(err => {
154
+ * // ...
155
+ * });
156
+ */
157
+ export declare function breachedAccount(
158
+ account: string,
159
+ options?: {
160
+ apiKey?: string;
161
+ domain?: string;
162
+ includeUnverified?: boolean;
163
+ truncate?: boolean;
164
+ baseUrl?: string;
165
+ userAgent?: string;
166
+ },
167
+ ): Promise<Breach[] | null>;
168
+ /**
169
+ * Fetches all breach events in the system.
170
+ *
171
+ * @param {object} [options] a configuration object
172
+ * @param {string} [options.domain] a domain by which to filter the results
173
+ * (default: all domains)
174
+ * @param {string} [options.baseUrl] a custom base URL for the
175
+ * haveibeenpwned.com API endpoints (default:
176
+ * `https://haveibeenpwned.com/api/v3`)
177
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
178
+ * field in the request headers (default: `hibp <version>`)
179
+ * @returns {Promise<Breach[]>} a Promise which resolves to an array of breach
180
+ * objects (an empty array if no breaches were found), or rejects with an Error
181
+ * @example
182
+ * breaches()
183
+ * .then(data => {
184
+ * if (data) {
185
+ * // ...
186
+ * } else {
187
+ * // ...
188
+ * }
189
+ * })
190
+ * .catch(err => {
191
+ * // ...
192
+ * });
193
+ * @example
194
+ * breaches({ domain: 'adobe.com' })
195
+ * .then(data => {
196
+ * if (data) {
197
+ * // ...
198
+ * } else {
199
+ * // ...
200
+ * }
201
+ * })
202
+ * .catch(err => {
203
+ * // ...
204
+ * });
205
+ */
206
+ export declare function breaches(options?: {
207
+ domain?: string;
208
+ baseUrl?: string;
209
+ userAgent?: string;
210
+ }): Promise<Breach[]>;
211
+ /**
212
+ * Fetches all data classes in the system.
213
+ *
214
+ * @param {object} [options] a configuration object
215
+ * @param {string} [options.baseUrl] a custom base URL for the
216
+ * haveibeenpwned.com API endpoints (default:
217
+ * `https://haveibeenpwned.com/api/v3`)
218
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
219
+ * field in the request headers (default: `hibp <version>`)
220
+ * @returns {(Promise<string[]> | Promise<null>)} a Promise which resolves to an
221
+ * array of strings (or null if no data classes were found), or rejects with an
222
+ * Error
223
+ * @example
224
+ * dataClasses()
225
+ * .then(data => {
226
+ * if (data) {
227
+ * // ...
228
+ * } else {
229
+ * // ...
230
+ * }
231
+ * })
232
+ * .catch(err => {
233
+ * // ...
234
+ * });
235
+ */
236
+ export declare function dataClasses(options?: {
237
+ baseUrl?: string;
238
+ userAgent?: string;
239
+ }): Promise<string[] | null>;
240
+ /**
241
+ * An object representing a paste.
242
+ *
243
+ * @typedef {object} Paste
244
+ * @property {string} Id
245
+ * @property {string} Source
246
+ * @property {string} Title
247
+ * @property {string} Date
248
+ * @property {number} EmailCount
249
+ */
250
+ /**
251
+ * Fetches paste data for a specific account (email address).
252
+ *
253
+ * ***Warning (July 18, 2019):***
254
+ *
255
+ * `haveibeenpwned.com` now requires an API key from
256
+ * https://haveibeenpwned.com/API/Key for the `pasteaccount` endpoint. The
257
+ * `apiKey` option here is not explicitly required, but direct requests made
258
+ * without it (that is, without specifying a `baseUrl` to a proxy that inserts a
259
+ * valid API key on your behalf) will fail.
260
+ *
261
+ * @param {string} email the email address to query
262
+ * @param {object} [options] a configuration object
263
+ * @param {string} [options.apiKey] an API key from
264
+ * https://haveibeenpwned.com/API/Key
265
+ * @param {string} [options.baseUrl] a custom base URL for the
266
+ * haveibeenpwned.com API endpoints (default:
267
+ * `https://haveibeenpwned.com/api/v3`)
268
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
269
+ * field in the request headers (default: `hibp <version>`)
270
+ * @returns {(Promise<Paste[]> | Promise<null>)} a Promise which resolves to an
271
+ * array of paste objects (or null if no pastes were found), or rejects with an
272
+ * Error
273
+ * @example
274
+ * pasteAccount('foo@bar.com', { apiKey: 'my-api-key' })
275
+ * .then(data => {
276
+ * if (data) {
277
+ * // ...
278
+ * } else {
279
+ * // ...
280
+ * }
281
+ * })
282
+ * .catch(err => {
283
+ * // ...
284
+ * });
285
+ */
286
+ export declare function pasteAccount(
287
+ email: string,
288
+ options?: {
289
+ apiKey?: string;
290
+ baseUrl?: string;
291
+ userAgent?: string;
292
+ },
293
+ ): Promise<Paste[] | null>;
294
+ /**
295
+ * Fetches the number of times the the given password has been exposed in a
296
+ * breach (0 indicating no exposure). The password is given in plain text, but
297
+ * only the first 5 characters of its SHA-1 hash will be submitted to the API.
298
+ *
299
+ * @param {string} password a password in plain text
300
+ * @param {object} [options] a configuration object
301
+ * @param {string} [options.baseUrl] a custom base URL for the
302
+ * pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)
303
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
304
+ * field in the request headers (default: `hibp <version>`)
305
+ * @returns {Promise<number>} a Promise which resolves to the number of times
306
+ * the password has been exposed in a breach, or rejects with an Error
307
+ * @example
308
+ * pwnedPassword('f00b4r')
309
+ * .then(numPwns => {
310
+ * // truthy check or numeric condition
311
+ * if (numPwns) {
312
+ * // ...
313
+ * } else {
314
+ * // ...
315
+ * }
316
+ * })
317
+ * .catch(err => {
318
+ * // ...
319
+ * });
320
+ * @see https://haveibeenpwned.com/api/v3#PwnedPasswords
321
+ */
322
+ export declare function pwnedPassword(
323
+ password: string,
324
+ options?: {
325
+ baseUrl?: string;
326
+ userAgent?: string;
327
+ },
328
+ ): Promise<number>;
329
+ export interface PwnedPasswordSuffixes {
330
+ [suffix: string]: number;
331
+ }
332
+ /**
333
+ * An object mapping an exposed password hash suffix (corresponding to a given
334
+ * hash prefix) to how many times it occurred in the Pwned Passwords repository.
335
+ *
336
+ * @typedef {Object.<string, number>} PwnedPasswordSuffixes
337
+ */
338
+ /**
339
+ * Fetches the SHA-1 hash suffixes for the given 5-character SHA-1 hash prefix.
340
+ *
341
+ * When a password hash with the same first 5 characters is found in the Pwned
342
+ * Passwords repository, the API will respond with an HTTP 200 and include the
343
+ * suffix of every hash beginning with the specified prefix, followed by a count
344
+ * of how many times it appears in the data set. This function parses the
345
+ * response and returns a more structured format.
346
+ *
347
+ * @param {string} prefix the first 5 characters of a SHA-1 password hash (case
348
+ * insensitive)
349
+ * @param {object} [options] a configuration object
350
+ * @param {string} [options.baseUrl] a custom base URL for the
351
+ * pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)
352
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
353
+ * field in the request headers (default: `hibp <version>`)
354
+ * @returns {Promise<PwnedPasswordSuffixes>} a Promise which resolves to an
355
+ * object mapping the `suffix` that when matched with the prefix composes the
356
+ * complete hash, to the `count` of how many times it appears in the breached
357
+ * password data set, or rejects with an Error
358
+ *
359
+ * @example
360
+ * pwnedPasswordRange('5BAA6')
361
+ * .then(results => {
362
+ * // results will have the following shape:
363
+ * // {
364
+ * // "003D68EB55068C33ACE09247EE4C639306B": 3,
365
+ * // "012C192B2F16F82EA0EB9EF18D9D539B0DD": 1,
366
+ * // ...
367
+ * // }
368
+ * })
369
+ * @example
370
+ * const suffix = '1E4C9B93F3F0682250B6CF8331B7EE68FD8';
371
+ * pwnedPasswordRange('5BAA6')
372
+ * .then(results => (results[suffix] || 0))
373
+ * .catch(err => {
374
+ * // ...
375
+ * });
376
+ * @see https://haveibeenpwned.com/api/v3#SearchingPwnedPasswordsByRange
377
+ */
378
+ export declare function pwnedPasswordRange(
379
+ prefix: string,
380
+ options?: {
381
+ baseUrl?: string;
382
+ userAgent?: string;
383
+ },
384
+ ): Promise<PwnedPasswordSuffixes>;
385
+ export interface SearchResults {
386
+ breaches: Breach[] | null;
387
+ pastes: Paste[] | null;
388
+ }
389
+ /**
390
+ * An object representing search results.
391
+ *
392
+ * @typedef {object} SearchResults
393
+ * @property {(Breach[] | null)} breaches
394
+ * @property {(Paste[] | null)} pastes
395
+ */
396
+ /**
397
+ * Fetches all breaches and all pastes associated with the provided account
398
+ * (email address or username). Note that the remote API does not support
399
+ * querying pastes by username (only email addresses), so in the event the
400
+ * provided account is not a valid email address, only breach data is queried
401
+ * and the "pastes" field of the resulting object will always be null. This is
402
+ * exactly how searching via the current web interface behaves, which this
403
+ * convenience method is designed to mimic.
404
+ *
405
+ * ***Warning (July 18, 2019):***
406
+ *
407
+ * `haveibeenpwned.com` now requires an API key from
408
+ * https://haveibeenpwned.com/API/Key for the `breachedaccount` and
409
+ * `pasteaccount` endpoints. The `apiKey` option here is not explicitly
410
+ * required, but direct requests made without it (that is, without specifying a
411
+ * `baseUrl` to a proxy that inserts a valid API key on your behalf) will fail.
412
+ *
413
+ * @param {string} account an email address or username
414
+ * @param {object} [breachOptions] a configuration object pertaining to breach
415
+ * queries
416
+ * @param {string} [breachOptions.apiKey] an API key from
417
+ * https://haveibeenpwned.com/API/Key
418
+ * @param {string} [breachOptions.domain] a domain by which to filter the
419
+ * results (default: all domains)
420
+ * @param {boolean} [breachOptions.truncate] truncate the results to only
421
+ * include the name of each breach (default: true)
422
+ * @param {string} [breachOptions.baseUrl] a custom base URL for the
423
+ * haveibeenpwned.com API endpoints (default:
424
+ * `https://haveibeenpwned.com/api/v3`)
425
+ * @param {string} [breachOptions.userAgent] a custom string to send as the
426
+ * User-Agent field in the request headers (default: `hibp <version>`)
427
+ * @returns {Promise<SearchResults>} a Promise which resolves to an object
428
+ * containing a "breaches" key (which can be null or an array of breach objects)
429
+ * and a "pastes" key (which can be null or an array of paste objects), or
430
+ * rejects with an Error
431
+ * @example
432
+ * search('foo', { apiKey: 'my-api-key' })
433
+ * .then(data => {
434
+ * if (data.breaches || data.pastes) {
435
+ * // ...
436
+ * } else {
437
+ * // ...
438
+ * }
439
+ * })
440
+ * .catch(err => {
441
+ * // ...
442
+ * });
443
+ * @example
444
+ * search('nobody@nowhere.com', { apiKey: 'my-api-key', truncate: false })
445
+ * .then(data => {
446
+ * if (data.breaches || data.pastes) {
447
+ * // ...
448
+ * } else {
449
+ * // ...
450
+ * }
451
+ * })
452
+ * .catch(err => {
453
+ * // ...
454
+ * });
455
+ *
456
+ * @see https://haveibeenpwned.com/
457
+ */
458
+ export declare function search(
459
+ account: string,
460
+ breachOptions?: {
461
+ apiKey?: string;
462
+ domain?: string;
463
+ truncate?: boolean;
464
+ baseUrl?: string;
465
+ userAgent?: string;
466
+ },
467
+ ): Promise<SearchResults>;
468
+ /**
469
+ * Custom error thrown when the haveibeenpwned.com API responds with 429 Too
470
+ * Many Requests. See the `retryAfterSeconds` property for the number of seconds
471
+ * to wait before attempting the request again.
472
+ *
473
+ * @see https://haveibeenpwned.com/API/v3#RateLimiting
474
+ */
475
+ export declare class RateLimitError extends Error {
476
+ /**
477
+ * The number of seconds to wait before attempting the request again. May be
478
+ * `undefined` if the API does not provide a `retry-after` header, but this
479
+ * should never happen.
480
+ */
481
+ retryAfterSeconds: number | undefined;
482
+ constructor(
483
+ retryAfter: ReturnType<Headers['get']>,
484
+ message: string | undefined,
485
+ options?: ErrorOptions,
486
+ );
487
+ }
488
+ export interface HIBP {
489
+ breach: typeof breach;
490
+ breachedAccount: typeof breachedAccount;
491
+ breaches: typeof breaches;
492
+ dataClasses: typeof dataClasses;
493
+ pasteAccount: typeof pasteAccount;
494
+ pwnedPassword: typeof pwnedPassword;
495
+ pwnedPasswordRange: typeof pwnedPasswordRange;
496
+ search: typeof search;
497
+ RateLimitError: typeof RateLimitError;
498
+ }
499
+
500
+ export as namespace hibp;
501
+
502
+ export {};
@@ -0,0 +1,16 @@
1
+ const hibp = require('hibp');
2
+
3
+ hibp
4
+ .breach('Adobe')
5
+ .then((data) => {
6
+ if (data) {
7
+ // Breach data found
8
+ console.log(data);
9
+ } else {
10
+ console.log('No breach data found by that name.');
11
+ }
12
+ })
13
+ .catch((err) => {
14
+ // Something went wrong.
15
+ console.log(err.message);
16
+ });
package/package.json ADDED
@@ -0,0 +1,138 @@
1
+ {
2
+ "name": "hibp",
3
+ "version": "0.0.0-dev.8859c6fb",
4
+ "description": "A Promise-based client for the 'Have I been pwned?' service.",
5
+ "keywords": [
6
+ "haveibeenpwned",
7
+ "hibp",
8
+ "pwned",
9
+ "security",
10
+ "hack",
11
+ "dump",
12
+ "breach",
13
+ "pastes",
14
+ "passwords",
15
+ "client"
16
+ ],
17
+ "author": {
18
+ "name": "Justin Hall",
19
+ "email": "justin.r.hall@gmail.com"
20
+ },
21
+ "license": "MIT",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/hibp.d.ts",
25
+ "browser": "./dist/browser/hibp.module.js",
26
+ "umd": "./dist/browser/hibp.umd.js",
27
+ "require": "./dist/cjs/hibp.js",
28
+ "import": "./dist/esm/hibp.mjs"
29
+ },
30
+ "./package.json": "./package.json"
31
+ },
32
+ "main": "dist/cjs/hibp.js",
33
+ "module": "dist/esm/hibp.mjs",
34
+ "unpkg": "dist/browser/hibp.umd.js",
35
+ "types": "dist/hibp.d.ts",
36
+ "runkitExampleFilename": "example/runkit.js",
37
+ "files": [
38
+ "dist",
39
+ "example",
40
+ "API.md",
41
+ "CHANGELOG.md",
42
+ "MIGRATION.md"
43
+ ],
44
+ "sideEffects": false,
45
+ "scripts": {
46
+ "build": "run-s --silent build:bundle build:types build:docs",
47
+ "build:bundle": "rollup --config",
48
+ "build:docs": "jsdoc2md --no-cache --files src/*.ts --configure jsdoc2md.json > API.md && node scripts/fix-api-docs.js",
49
+ "build:types": "dts-bundle-generator --silent --umd-module-name hibp --out-file dist/hibp.d.ts src/hibp.ts && prettier --loglevel silent --write dist/hibp.d.ts",
50
+ "changeset": "changeset",
51
+ "changeset:version": "changeset version && npm install --package-lock-only",
52
+ "changeset:publish": "changeset publish",
53
+ "check-types": "run-p --silent check-types:*",
54
+ "check-types:cypress": "tsc --project cypress",
55
+ "check-types:src": "tsc --noEmit",
56
+ "clean": "rimraf dist coverage",
57
+ "cy:open": "cypress open",
58
+ "cy:run": "cypress run",
59
+ "format": "prettier --cache --write .",
60
+ "lint": "eslint .",
61
+ "prebuild": "npm run --silent clean",
62
+ "prepare": "npm run --silent build",
63
+ "size": "bundlewatch --config .bundlewatch.config.js",
64
+ "ssat": "start-server-and-test start-test-server 3000",
65
+ "start-test-server": "serve --no-clipboard",
66
+ "test": "vitest run",
67
+ "test:coverage": "vitest run --coverage",
68
+ "test:browser:open": "run-s --silent build:bundle \"ssat cy:open\"",
69
+ "test:browser:run": "run-s --silent build:bundle \"ssat cy:run\"",
70
+ "test:watch": "vitest watch"
71
+ },
72
+ "private": false,
73
+ "publishConfig": {
74
+ "access": "public"
75
+ },
76
+ "repository": {
77
+ "type": "git",
78
+ "url": "https://github.com/wKovacs64/hibp.git"
79
+ },
80
+ "bugs": {
81
+ "url": "https://github.com/wKovacs64/hibp/issues"
82
+ },
83
+ "homepage": "https://wkovacs64.github.io/hibp",
84
+ "engines": {
85
+ "node": ">= 12.16"
86
+ },
87
+ "dependencies": {
88
+ "@remix-run/web-fetch": "4.3.2",
89
+ "jssha": "^3.3.0"
90
+ },
91
+ "devDependencies": {
92
+ "@babel/core": "7.20.12",
93
+ "@babel/parser": "7.20.13",
94
+ "@babel/plugin-proposal-class-properties": "7.18.6",
95
+ "@babel/plugin-proposal-object-rest-spread": "7.20.7",
96
+ "@babel/preset-env": "7.20.2",
97
+ "@babel/preset-typescript": "7.18.6",
98
+ "@changesets/changelog-github": "0.4.8",
99
+ "@changesets/cli": "2.26.0",
100
+ "@rollup/plugin-babel": "6.0.3",
101
+ "@rollup/plugin-commonjs": "24.0.1",
102
+ "@rollup/plugin-json": "6.0.0",
103
+ "@rollup/plugin-node-resolve": "15.0.1",
104
+ "@rollup/plugin-replace": "5.0.2",
105
+ "@rollup/plugin-terser": "0.4.0",
106
+ "@rollup/plugin-typescript": "11.0.0",
107
+ "@types/common-tags": "1.8.1",
108
+ "@types/debug": "4.1.7",
109
+ "@types/node": "16.18.11",
110
+ "@types/ws": "8.5.4",
111
+ "@vitest/coverage-c8": "0.28.3",
112
+ "@wkovacs64/prettier-config": "3.0.3",
113
+ "babel-plugin-annotate-pure-calls": "0.4.0",
114
+ "bundlewatch": "0.3.3",
115
+ "c8": "7.12.0",
116
+ "codecov": "3.8.3",
117
+ "common-tags": "1.8.2",
118
+ "cross-env": "7.0.3",
119
+ "cypress": "12.4.1",
120
+ "dts-bundle-generator": "7.2.0",
121
+ "eslint": "8.33.0",
122
+ "eslint-plugin-cypress": "2.12.1",
123
+ "eslint-plugin-wkovacs64": "14.1.0",
124
+ "glob": "8.1.0",
125
+ "jsdoc-babel": "0.5.0",
126
+ "jsdoc-to-markdown": "8.0.0",
127
+ "msw": "1.0.0",
128
+ "npm-run-all": "4.1.5",
129
+ "prettier": "2.8.3",
130
+ "rimraf": "4.1.2",
131
+ "rollup": "3.12.0",
132
+ "serve": "14.2.0",
133
+ "start-server-and-test": "1.15.3",
134
+ "tslib": "2.5.0",
135
+ "typescript": "4.9.4",
136
+ "vitest": "0.28.3"
137
+ }
138
+ }