hibp 16.0.0 → 16.0.1

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 (69) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/browser/hibp.module.js +2 -2
  3. package/dist/esm/api/base-fetch.d.ts +8 -6
  4. package/dist/esm/api/base-fetch.js +5 -11
  5. package/dist/esm/api/base-fetch.js.map +1 -1
  6. package/dist/esm/api/haveibeenpwned/fetch-from-api.js +28 -57
  7. package/dist/esm/api/haveibeenpwned/fetch-from-api.js.map +1 -1
  8. package/dist/esm/api/haveibeenpwned/package-info.d.ts +1 -1
  9. package/dist/esm/api/haveibeenpwned/package-info.js +1 -1
  10. package/dist/esm/api/haveibeenpwned/post-to-api.js +1 -9
  11. package/dist/esm/api/haveibeenpwned/post-to-api.js.map +1 -1
  12. package/dist/esm/api/haveibeenpwned/responses.d.ts +0 -10
  13. package/dist/esm/api/haveibeenpwned/responses.js +3 -35
  14. package/dist/esm/api/haveibeenpwned/responses.js.map +1 -1
  15. package/dist/esm/api/haveibeenpwned/types.js +0 -3
  16. package/dist/esm/api/haveibeenpwned/types.js.map +1 -1
  17. package/dist/esm/api/pwnedpasswords/fetch-from-api.js +1 -24
  18. package/dist/esm/api/pwnedpasswords/fetch-from-api.js.map +1 -1
  19. package/dist/esm/api/pwnedpasswords/responses.d.ts +0 -6
  20. package/dist/esm/api/pwnedpasswords/responses.js +0 -6
  21. package/dist/esm/api/pwnedpasswords/responses.js.map +1 -1
  22. package/dist/esm/breach.d.ts +4 -4
  23. package/dist/esm/breach.js.map +1 -1
  24. package/dist/esm/breached-account-range.d.ts +5 -5
  25. package/dist/esm/breached-account-range.js.map +1 -1
  26. package/dist/esm/breached-account.d.ts +9 -9
  27. package/dist/esm/breached-account.js.map +1 -1
  28. package/dist/esm/breached-domain.d.ts +5 -5
  29. package/dist/esm/breached-domain.js.map +1 -1
  30. package/dist/esm/breaches.d.ts +6 -6
  31. package/dist/esm/breaches.js +2 -2
  32. package/dist/esm/breaches.js.map +1 -1
  33. package/dist/esm/data-class-descriptions.d.ts +4 -4
  34. package/dist/esm/data-class-descriptions.js.map +1 -1
  35. package/dist/esm/data-classes.d.ts +4 -4
  36. package/dist/esm/data-classes.js.map +1 -1
  37. package/dist/esm/generate-dns-token.d.ts +5 -5
  38. package/dist/esm/generate-dns-token.js +2 -1
  39. package/dist/esm/generate-dns-token.js.map +1 -1
  40. package/dist/esm/hibp.js +0 -11
  41. package/dist/esm/hibp.js.map +1 -1
  42. package/dist/esm/latest-breach.d.ts +4 -4
  43. package/dist/esm/latest-breach.js.map +1 -1
  44. package/dist/esm/paste-account.d.ts +5 -5
  45. package/dist/esm/paste-account.js.map +1 -1
  46. package/dist/esm/pwned-password-range.d.ts +6 -6
  47. package/dist/esm/pwned-password-range.js +0 -2
  48. package/dist/esm/pwned-password-range.js.map +1 -1
  49. package/dist/esm/pwned-password.d.ts +5 -5
  50. package/dist/esm/pwned-password.js +8 -3
  51. package/dist/esm/pwned-password.js.map +1 -1
  52. package/dist/esm/search.d.ts +8 -8
  53. package/dist/esm/search.js +2 -2
  54. package/dist/esm/search.js.map +1 -1
  55. package/dist/esm/send-email.d.ts +5 -5
  56. package/dist/esm/stealer-logs-by-email-domain.d.ts +5 -5
  57. package/dist/esm/stealer-logs-by-email-domain.js.map +1 -1
  58. package/dist/esm/stealer-logs-by-email.d.ts +5 -5
  59. package/dist/esm/stealer-logs-by-email.js.map +1 -1
  60. package/dist/esm/stealer-logs-by-website-domain.d.ts +5 -5
  61. package/dist/esm/stealer-logs-by-website-domain.js.map +1 -1
  62. package/dist/esm/subscribed-domains.d.ts +5 -5
  63. package/dist/esm/subscribed-domains.js +2 -2
  64. package/dist/esm/subscribed-domains.js.map +1 -1
  65. package/dist/esm/subscription-status.d.ts +5 -5
  66. package/dist/esm/subscription-status.js +2 -2
  67. package/dist/esm/subscription-status.js.map +1 -1
  68. package/dist/esm/verify-dns-token.d.ts +5 -5
  69. package/package.json +13 -13
@@ -49,23 +49,23 @@ export declare function breachedDomain(domain: string, options?: {
49
49
  /**
50
50
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
51
51
  */
52
- apiKey?: string;
52
+ apiKey?: string | undefined;
53
53
  /**
54
54
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
55
55
  * `https://haveibeenpwned.com/api/v3`)
56
56
  */
57
- baseUrl?: string;
57
+ baseUrl?: string | undefined;
58
58
  /**
59
59
  * timeout for the request in milliseconds (default: none)
60
60
  */
61
- timeoutMs?: number;
61
+ timeoutMs?: number | undefined;
62
62
  /**
63
63
  * an AbortSignal to cancel the request (default: none)
64
64
  */
65
- signal?: AbortSignal;
65
+ signal?: AbortSignal | undefined;
66
66
  /**
67
67
  * a custom string to send as the User-Agent field in the request headers
68
68
  * (default: `hibp <version>`)
69
69
  */
70
- userAgent?: string;
70
+ userAgent?: string | undefined;
71
71
  }): Promise<BreachedDomainsByEmailAlias | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"breached-domain.js","sourceRoot":"","sources":["../../src/breached-domain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,mBAAmB,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;IAEjE,OAAO,YAAY,CAAC,QAAQ,EAAE;QAC5B,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAgD,CAAC;AACpD,CAAC"}
1
+ {"version":3,"file":"breached-domain.js","sourceRoot":"","sources":["../../src/breached-domain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,mBAAmB,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;IAEjE,OAAO,YAAY,CAA8B,QAAQ,EAAE;QACzD,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
@@ -44,28 +44,28 @@ export declare function breaches(options?: {
44
44
  /**
45
45
  * a domain by which to filter the results (default: all domains)
46
46
  */
47
- domain?: string;
47
+ domain?: string | undefined;
48
48
  /**
49
49
  * true for only spam-list breaches, false for only non-spam-list breaches
50
50
  * (default: no spam-list filter)
51
51
  */
52
- isSpamList?: boolean;
52
+ isSpamList?: boolean | undefined;
53
53
  /**
54
54
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
55
55
  * `https://haveibeenpwned.com/api/v3`)
56
56
  */
57
- baseUrl?: string;
57
+ baseUrl?: string | undefined;
58
58
  /**
59
59
  * timeout for the request in milliseconds (default: none)
60
60
  */
61
- timeoutMs?: number;
61
+ timeoutMs?: number | undefined;
62
62
  /**
63
63
  * an AbortSignal to cancel the request (default: none)
64
64
  */
65
- signal?: AbortSignal;
65
+ signal?: AbortSignal | undefined;
66
66
  /**
67
67
  * a custom string to send as the User-Agent field in the request headers
68
68
  * (default: `hibp <version>`)
69
69
  */
70
- userAgent?: string;
70
+ userAgent?: string | undefined;
71
71
  }): Promise<Breach[]>;
@@ -1,4 +1,4 @@
1
- import { fetchFromApi } from "./api/haveibeenpwned/fetch-from-api.js";
1
+ import { fetchRequiredFromApi } from "./api/haveibeenpwned/fetch-from-api.js";
2
2
  /**
3
3
  * Fetches all breach events in the system.
4
4
  *
@@ -50,7 +50,7 @@ export function breaches(options = {}) {
50
50
  if (isSpamList !== undefined) {
51
51
  params.push(`isSpamList=${isSpamList}`);
52
52
  }
53
- return fetchFromApi(`${endpoint}${params.join("&")}`, {
53
+ return fetchRequiredFromApi(`${endpoint}${params.join("&")}`, {
54
54
  baseUrl,
55
55
  timeoutMs,
56
56
  signal,
@@ -1 +1 @@
1
- {"version":3,"file":"breaches.js","sourceRoot":"","sources":["../../src/breaches.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,QAAQ,CACtB,OAAO,GA4BH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC9E,MAAM,QAAQ,GAAG,YAAY,CAAC;IAC9B,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,UAAU,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,cAAc,UAAU,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,YAAY,CAAC,GAAG,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;QACpD,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAsB,CAAC;AAC1B,CAAC"}
1
+ {"version":3,"file":"breaches.js","sourceRoot":"","sources":["../../src/breaches.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,QAAQ,CACtB,OAAO,GA4BH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC9E,MAAM,QAAQ,GAAG,YAAY,CAAC;IAC9B,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,UAAU,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,cAAc,UAAU,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,oBAAoB,CAAW,GAAG,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;QACtE,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
@@ -38,18 +38,18 @@ export declare function dataClassDescriptions(options?: {
38
38
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
39
39
  * `https://haveibeenpwned.com/api/v3`)
40
40
  */
41
- baseUrl?: string;
41
+ baseUrl?: string | undefined;
42
42
  /**
43
43
  * timeout for the request in milliseconds (default: none)
44
44
  */
45
- timeoutMs?: number;
45
+ timeoutMs?: number | undefined;
46
46
  /**
47
47
  * an AbortSignal to cancel the request (default: none)
48
48
  */
49
- signal?: AbortSignal;
49
+ signal?: AbortSignal | undefined;
50
50
  /**
51
51
  * a custom string to send as the User-Agent field in the request headers
52
52
  * (default: `hibp <version>`)
53
53
  */
54
- userAgent?: string;
54
+ userAgent?: string | undefined;
55
55
  }): Promise<DataClassDescription[] | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"data-class-descriptions.js","sourceRoot":"","sources":["../../src/data-class-descriptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAO,GAmBH,EAAE;IAEN,OAAO,YAAY,CAAC,2BAA2B,EAAE,OAAO,CAEvD,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"data-class-descriptions.js","sourceRoot":"","sources":["../../src/data-class-descriptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAO,GAmBH,EAAE;IAEN,OAAO,YAAY,CACjB,2BAA2B,EAC3B,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -30,18 +30,18 @@ export declare function dataClasses(options?: {
30
30
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
31
31
  * `https://haveibeenpwned.com/api/v3`)
32
32
  */
33
- baseUrl?: string;
33
+ baseUrl?: string | undefined;
34
34
  /**
35
35
  * timeout for the request in milliseconds (default: none)
36
36
  */
37
- timeoutMs?: number;
37
+ timeoutMs?: number | undefined;
38
38
  /**
39
39
  * an AbortSignal to cancel the request (default: none)
40
40
  */
41
- signal?: AbortSignal;
41
+ signal?: AbortSignal | undefined;
42
42
  /**
43
43
  * a custom string to send as the User-Agent field in the request headers
44
44
  * (default: `hibp <version>`)
45
45
  */
46
- userAgent?: string;
46
+ userAgent?: string | undefined;
47
47
  }): Promise<string[] | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"data-classes.js","sourceRoot":"","sources":["../../src/data-classes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,WAAW,CACzB,OAAO,GAmBH,EAAE;IAEN,OAAO,YAAY,CAAC,cAAc,EAAE,OAAO,CAA6B,CAAC;AAC3E,CAAC"}
1
+ {"version":3,"file":"data-classes.js","sourceRoot":"","sources":["../../src/data-classes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,WAAW,CACzB,OAAO,GAmBH,EAAE;IAEN,OAAO,YAAY,CAAW,cAAc,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC"}
@@ -45,23 +45,23 @@ export declare function generateDnsToken(domain: string, options?: {
45
45
  /**
46
46
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
47
47
  */
48
- apiKey?: string;
48
+ apiKey?: string | undefined;
49
49
  /**
50
50
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
51
51
  * `https://haveibeenpwned.com/api/v3`)
52
52
  */
53
- baseUrl?: string;
53
+ baseUrl?: string | undefined;
54
54
  /**
55
55
  * timeout for the request in milliseconds (default: none)
56
56
  */
57
- timeoutMs?: number;
57
+ timeoutMs?: number | undefined;
58
58
  /**
59
59
  * an AbortSignal to cancel the request (default: none)
60
60
  */
61
- signal?: AbortSignal;
61
+ signal?: AbortSignal | undefined;
62
62
  /**
63
63
  * a custom string to send as the User-Agent field in the request headers
64
64
  * (default: `hibp <version>`)
65
65
  */
66
- userAgent?: string;
66
+ userAgent?: string | undefined;
67
67
  }): Promise<DnsToken>;
@@ -1,3 +1,4 @@
1
+ import { readJson } from "./api/haveibeenpwned/fetch-from-api.js";
1
2
  import { postToApi } from "./api/haveibeenpwned/post-to-api.js";
2
3
  /**
3
4
  * The TXT record value to publish at your DNS provider.
@@ -43,6 +44,6 @@ import { postToApi } from "./api/haveibeenpwned/post-to-api.js";
43
44
  */
44
45
  export async function generateDnsToken(domain, options = {}) {
45
46
  const response = await postToApi("/domainVerification/generateDnsToken", { DomainName: domain }, options);
46
- return response.json();
47
+ return readJson(response);
47
48
  }
48
49
  //# sourceMappingURL=generate-dns-token.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-dns-token.js","sourceRoot":"","sources":["../../src/generate-dns-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAGhE;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,OAAO,GAuBH,EAAE;IAEN,MAAM,QAAQ,GAAG,MAAM,SAAS,CAC9B,sCAAsC,EACtC,EAAE,UAAU,EAAE,MAAM,EAAE,EACtB,OAAO,CACR,CAAC;IACF,OAAO,QAAQ,CAAC,IAAI,EAAuB,CAAC;AAC9C,CAAC"}
1
+ {"version":3,"file":"generate-dns-token.js","sourceRoot":"","sources":["../../src/generate-dns-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAGhE;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,OAAO,GAuBH,EAAE;IAEN,MAAM,QAAQ,GAAG,MAAM,SAAS,CAC9B,sCAAsC,EACtC,EAAE,UAAU,EAAE,MAAM,EAAE,EACtB,OAAO,CACR,CAAC;IAEF,OAAO,QAAQ,CAAW,QAAQ,CAAC,CAAC;AACtC,CAAC"}
package/dist/esm/hibp.js CHANGED
@@ -19,16 +19,5 @@ import { stealerLogsByWebsiteDomain } from "./stealer-logs-by-website-domain.js"
19
19
  import { subscribedDomains } from "./subscribed-domains.js";
20
20
  import { subscriptionStatus } from "./subscription-status.js";
21
21
  import { verifyDnsToken } from "./verify-dns-token.js";
22
- /*
23
- * Export individual named functions to allow the following:
24
- *
25
- * import * as hibp from 'hibp'; // ESM (with tree-shaking)
26
- * import { search } from 'hibp'; // ESM (with tree-shaking)
27
- * const { search } = require('hibp'); // CommonJS
28
- * const hibp = require('hibp'); // CommonJS
29
- */
30
22
  export { breach, breachedAccount, breachedAccountRange, breachedDomain, breaches, dataClasses, dataClassDescriptions, generateDnsToken, latestBreach, pasteAccount, pwnedPassword, pwnedPasswordRange, search, sendEmail, stealerLogsByEmail, stealerLogsByEmailDomain, stealerLogsByWebsiteDomain, subscribedDomains, subscriptionStatus, verifyDnsToken, RateLimitError, };
31
- // https://github.com/jsdoc2md/jsdoc-to-markdown/wiki/How-to-document-TypeScript#jsdoc-comments-disappear
32
- // oxlint-disable-next-line eslint/no-unused-vars -- Required for jsdoc-to-markdown.
33
- const JSDOC2MARKDOWN_STUB = undefined;
34
23
  //# sourceMappingURL=hibp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hibp.js","sourceRoot":"","sources":["../../src/hibp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA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EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,EACL,MAAM,EACN,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,wBAAwB,EACxB,0BAA0B,EAC1B,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,cAAc,GACf,CAAC"}
@@ -31,18 +31,18 @@ export declare function latestBreach(options?: {
31
31
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
32
32
  * `https://haveibeenpwned.com/api/v3`)
33
33
  */
34
- baseUrl?: string;
34
+ baseUrl?: string | undefined;
35
35
  /**
36
36
  * timeout for the request in milliseconds (default: none)
37
37
  */
38
- timeoutMs?: number;
38
+ timeoutMs?: number | undefined;
39
39
  /**
40
40
  * an AbortSignal to cancel the request (default: none)
41
41
  */
42
- signal?: AbortSignal;
42
+ signal?: AbortSignal | undefined;
43
43
  /**
44
44
  * a custom string to send as the User-Agent field in the request headers
45
45
  * (default: `hibp <version>`)
46
46
  */
47
- userAgent?: string;
47
+ userAgent?: string | undefined;
48
48
  }): Promise<Breach | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"latest-breach.js","sourceRoot":"","sources":["../../src/latest-breach.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAO,GAmBH,EAAE;IAEN,OAAO,YAAY,CAAC,eAAe,EAAE,OAAO,CAA2B,CAAC;AAC1E,CAAC"}
1
+ {"version":3,"file":"latest-breach.js","sourceRoot":"","sources":["../../src/latest-breach.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAO,GAmBH,EAAE;IAEN,OAAO,YAAY,CAAS,eAAe,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC"}
@@ -62,23 +62,23 @@ export declare function pasteAccount(email: string, options?: {
62
62
  /**
63
63
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
64
64
  */
65
- apiKey?: string;
65
+ apiKey?: string | undefined;
66
66
  /**
67
67
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
68
68
  * `https://haveibeenpwned.com/api/v3`)
69
69
  */
70
- baseUrl?: string;
70
+ baseUrl?: string | undefined;
71
71
  /**
72
72
  * timeout for the request in milliseconds (default: none)
73
73
  */
74
- timeoutMs?: number;
74
+ timeoutMs?: number | undefined;
75
75
  /**
76
76
  * an AbortSignal to cancel the request (default: none)
77
77
  */
78
- signal?: AbortSignal;
78
+ signal?: AbortSignal | undefined;
79
79
  /**
80
80
  * a custom string to send as the User-Agent field in the request headers
81
81
  * (default: `hibp <version>`)
82
82
  */
83
- userAgent?: string;
83
+ userAgent?: string | undefined;
84
84
  }): Promise<Paste[] | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"paste-account.js","sourceRoot":"","sources":["../../src/paste-account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAa,EACb,OAAO,GAuBH,EAAE;IAEN,OAAO,YAAY,CACjB,iBAAiB,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAC5C,OAAO,CACmB,CAAC;AAC/B,CAAC"}
1
+ {"version":3,"file":"paste-account.js","sourceRoot":"","sources":["../../src/paste-account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAa,EACb,OAAO,GAuBH,EAAE;IAEN,OAAO,YAAY,CACjB,iBAAiB,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAC5C,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -61,27 +61,27 @@ export declare function pwnedPasswordRange(prefix: string, options?: {
61
61
  * ask the remote API to add padding to the response to obscure the password
62
62
  * prefix (default: `false`)
63
63
  */
64
- addPadding?: boolean;
64
+ addPadding?: boolean | undefined;
65
65
  /**
66
66
  * return SHA-1 or NTLM hashes (default: `sha1`)
67
67
  */
68
- mode?: "sha1" | "ntlm";
68
+ mode?: "sha1" | "ntlm" | undefined;
69
69
  /**
70
70
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
71
71
  * `https://haveibeenpwned.com/api/v3`)
72
72
  */
73
- baseUrl?: string;
73
+ baseUrl?: string | undefined;
74
74
  /**
75
75
  * timeout for the request in milliseconds (default: none)
76
76
  */
77
- timeoutMs?: number;
77
+ timeoutMs?: number | undefined;
78
78
  /**
79
79
  * an AbortSignal to cancel the request (default: none)
80
80
  */
81
- signal?: AbortSignal;
81
+ signal?: AbortSignal | undefined;
82
82
  /**
83
83
  * a custom string to send as the User-Agent field in the request headers
84
84
  * (default: `hibp <version>`)
85
85
  */
86
- userAgent?: string;
86
+ userAgent?: string | undefined;
87
87
  }): Promise<PwnedPasswordSuffixes>;
@@ -66,9 +66,7 @@ export async function pwnedPasswordRange(prefix, options = {}) {
66
66
  addPadding,
67
67
  mode,
68
68
  });
69
- // create array from lines of text in response body
70
69
  const results = data.split("\n").filter(Boolean);
71
- // convert into an object mapping suffix to count for each line
72
70
  return results.reduce((acc, row) => {
73
71
  const [suffix, countString] = row.split(":");
74
72
  acc[suffix] = Number.parseInt(countString, 10);
@@ -1 +1 @@
1
- {"version":3,"file":"pwned-password-range.js","sourceRoot":"","sources":["../../src/pwned-password-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAItE;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,OAAO,GA4BH,EAAE;IAEN,MAAM,EACJ,OAAO,EACP,SAAS,EACT,MAAM,EACN,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,MAAM,GACd,GAAG,OAAO,CAAC;IAEZ,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,UAAU,kBAAkB,CA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,OAAO,CAAC,CAAC;IAEjD,OAAO,OAAO,CAAC,MAAM,CAAwB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACxD,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7C,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAE/C,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
@@ -35,23 +35,23 @@ export declare function pwnedPassword(password: string, options?: {
35
35
  * ask the remote API to add padding to the response to obscure the password
36
36
  * prefix (default: `false`)
37
37
  */
38
- addPadding?: boolean;
38
+ addPadding?: boolean | undefined;
39
39
  /**
40
40
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
41
41
  * `https://haveibeenpwned.com/api/v3`)
42
42
  */
43
- baseUrl?: string;
43
+ baseUrl?: string | undefined;
44
44
  /**
45
45
  * timeout for the request in milliseconds (default: none)
46
46
  */
47
- timeoutMs?: number;
47
+ timeoutMs?: number | undefined;
48
48
  /**
49
49
  * an AbortSignal to cancel the request (default: none)
50
50
  */
51
- signal?: AbortSignal;
51
+ signal?: AbortSignal | undefined;
52
52
  /**
53
53
  * a custom string to send as the User-Agent field in the request headers
54
54
  * (default: `hibp <version>`)
55
55
  */
56
- userAgent?: string;
56
+ userAgent?: string | undefined;
57
57
  }): Promise<number>;
@@ -34,12 +34,14 @@ import { pwnedPasswordRange } from "./pwned-password-range.js";
34
34
  export async function pwnedPassword(password, options = {}) {
35
35
  const [prefix, suffix] = await getPasswordHashParts(password);
36
36
  const range = await pwnedPasswordRange(prefix, options);
37
- return range[suffix] || 0;
37
+ const count = range[suffix];
38
+ return count === undefined || Number.isNaN(count) ? 0 : count;
38
39
  }
39
40
  async function getPasswordHashParts(password) {
40
- if (typeof crypto === "object" && crypto.subtle) {
41
+ const subtle = webCryptoIfAvailable()?.subtle;
42
+ if (subtle) {
41
43
  const msgUint8 = new TextEncoder().encode(password);
42
- const hashBuffer = await crypto.subtle.digest("SHA-1", msgUint8);
44
+ const hashBuffer = await subtle.digest("SHA-1", msgUint8);
43
45
  const hashArray = Array.from(new Uint8Array(hashBuffer));
44
46
  const hashHex = hashArray
45
47
  .map((byte) => byte.toString(16).padStart(2, "0"))
@@ -49,4 +51,7 @@ async function getPasswordHashParts(password) {
49
51
  }
50
52
  throw new Error("The Web Crypto API is not available in this environment.");
51
53
  }
54
+ function webCryptoIfAvailable() {
55
+ return globalThis.crypto;
56
+ }
52
57
  //# sourceMappingURL=pwned-password.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pwned-password.js","sourceRoot":"","sources":["../../src/pwned-password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAgB,EAChB,OAAO,GAwBH,EAAE;IAEN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED,KAAK,UAAU,oBAAoB,CAAC,QAAgB;IAClD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAChD,MAAM,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjE,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,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W,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;QAEzD,MAAM,OAAO,GAAG,SAAS;aACtB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;aACjD,IAAI,CAAC,EAAE,CAAC;aACR,WAAW,EAAE,CAAC;QAEjB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAU,CAAC;IAC1D,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,oBAAoB;IAC3B,OAAO,UAAU,CAAC,MAAM,CAAC;AAC3B,CAAC"}
@@ -14,34 +14,34 @@ interface SearchOptions {
14
14
  /**
15
15
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
16
16
  */
17
- apiKey?: string;
17
+ apiKey?: string | undefined;
18
18
  /**
19
19
  * a domain by which to filter the results (default: all domains)
20
20
  */
21
- domain?: string;
21
+ domain?: string | undefined;
22
22
  /**
23
23
  * truncate the results to only include the name of each breach (default:
24
24
  * true)
25
25
  */
26
- truncate?: boolean;
26
+ truncate?: boolean | undefined;
27
27
  /**
28
28
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
29
29
  * `https://haveibeenpwned.com/api/v3`)
30
30
  */
31
- baseUrl?: string;
31
+ baseUrl?: string | undefined;
32
32
  /**
33
33
  * timeout for the request in milliseconds (default: none)
34
34
  */
35
- timeoutMs?: number;
35
+ timeoutMs?: number | undefined;
36
36
  /**
37
37
  * an AbortSignal to cancel the request (default: none)
38
38
  */
39
- signal?: AbortSignal;
39
+ signal?: AbortSignal | undefined;
40
40
  /**
41
41
  * a custom string to send as the User-Agent field in the request headers
42
42
  * (default: `hibp <version>`)
43
43
  */
44
- userAgent?: string;
44
+ userAgent?: string | undefined;
45
45
  }
46
46
  /**
47
47
  * Fetches all breaches and all pastes associated with the provided account
@@ -109,7 +109,7 @@ interface SearchOptions {
109
109
  * @see https://haveibeenpwned.com/
110
110
  */
111
111
  export declare function search(account: string, options?: SearchOptions & {
112
- truncate?: true;
112
+ truncate?: true | undefined;
113
113
  }): Promise<{
114
114
  breaches: Pick<Breach, "Name">[] | null;
115
115
  pastes: Paste[] | null;
@@ -1,5 +1,6 @@
1
1
  import { breachedAccount } from "./breached-account.js";
2
2
  import { pasteAccount } from "./paste-account.js";
3
+ const PASTE_API_EMAIL_PATTERN = /^.+@.+$/;
3
4
  export async function search(account, options = {}) {
4
5
  const { apiKey, domain, truncate = true, baseUrl, timeoutMs, signal, userAgent, } = options;
5
6
  const [breaches, pastes] = await Promise.all([
@@ -12,8 +13,7 @@ export async function search(account, options = {}) {
12
13
  signal,
13
14
  userAgent,
14
15
  }),
15
- // This email regex is garbage but it seems to be what the API uses:
16
- /^.+@.+$/.test(account)
16
+ PASTE_API_EMAIL_PATTERN.test(account)
17
17
  ? pasteAccount(account, { apiKey, baseUrl, timeoutMs, signal, userAgent })
18
18
  : null,
19
19
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA8HlD,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,OAAe,EACf,OAAO,GAAkB,EAAE;IAE3B,MAAM,EACJ,MAAM,EACN,MAAM,EACN,QAAQ,GAAG,IAAI,EACf,OAAO,EACP,SAAS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AAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;YAC1E,CAAC,CAAC,IAAI;KACT,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC"}
@@ -47,23 +47,23 @@ export declare function sendEmail(domain: string, emailAlias: EmailAlias, option
47
47
  /**
48
48
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
49
49
  */
50
- apiKey?: string;
50
+ apiKey?: string | undefined;
51
51
  /**
52
52
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
53
53
  * `https://haveibeenpwned.com/api/v3`)
54
54
  */
55
- baseUrl?: string;
55
+ baseUrl?: string | undefined;
56
56
  /**
57
57
  * timeout for the request in milliseconds (default: none)
58
58
  */
59
- timeoutMs?: number;
59
+ timeoutMs?: number | undefined;
60
60
  /**
61
61
  * an AbortSignal to cancel the request (default: none)
62
62
  */
63
- signal?: AbortSignal;
63
+ signal?: AbortSignal | undefined;
64
64
  /**
65
65
  * a custom string to send as the User-Agent field in the request headers
66
66
  * (default: `hibp <version>`)
67
67
  */
68
- userAgent?: string;
68
+ userAgent?: string | undefined;
69
69
  }): Promise<void>;
@@ -50,23 +50,23 @@ export declare function stealerLogsByEmailDomain(emailDomain: string, options?:
50
50
  /**
51
51
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
52
52
  */
53
- apiKey?: string;
53
+ apiKey?: string | undefined;
54
54
  /**
55
55
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
56
56
  * `https://haveibeenpwned.com/api/v3`)
57
57
  */
58
- baseUrl?: string;
58
+ baseUrl?: string | undefined;
59
59
  /**
60
60
  * timeout for the request in milliseconds (default: none)
61
61
  */
62
- timeoutMs?: number;
62
+ timeoutMs?: number | undefined;
63
63
  /**
64
64
  * an AbortSignal to cancel the request (default: none)
65
65
  */
66
- signal?: AbortSignal;
66
+ signal?: AbortSignal | undefined;
67
67
  /**
68
68
  * a custom string to send as the User-Agent field in the request headers
69
69
  * (default: `hibp <version>`)
70
70
  */
71
- userAgent?: string;
71
+ userAgent?: string | undefined;
72
72
  }): Promise<StealerLogDomainsByEmailAlias | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"stealer-logs-by-email-domain.js","sourceRoot":"","sources":["../../src/stealer-logs-by-email-domain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,wBAAwB,CACtC,WAAmB,EACnB,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,6BAA6B,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC;IAEhF,OAAO,YAAY,CAAC,QAAQ,EAAE;QAC5B,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAkD,CAAC;AACtD,CAAC"}
1
+ {"version":3,"file":"stealer-logs-by-email-domain.js","sourceRoot":"","sources":["../../src/stealer-logs-by-email-domain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,wBAAwB,CACtC,WAAmB,EACnB,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,6BAA6B,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC;IAEhF,OAAO,YAAY,CAAgC,QAAQ,EAAE;QAC3D,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
@@ -53,23 +53,23 @@ export declare function stealerLogsByEmail(emailAddress: string, options?: {
53
53
  /**
54
54
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
55
55
  */
56
- apiKey?: string;
56
+ apiKey?: string | undefined;
57
57
  /**
58
58
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
59
59
  * `https://haveibeenpwned.com/api/v3`)
60
60
  */
61
- baseUrl?: string;
61
+ baseUrl?: string | undefined;
62
62
  /**
63
63
  * timeout for the request in milliseconds (default: none)
64
64
  */
65
- timeoutMs?: number;
65
+ timeoutMs?: number | undefined;
66
66
  /**
67
67
  * an AbortSignal to cancel the request (default: none)
68
68
  */
69
- signal?: AbortSignal;
69
+ signal?: AbortSignal | undefined;
70
70
  /**
71
71
  * a custom string to send as the User-Agent field in the request headers
72
72
  * (default: `hibp <version>`)
73
73
  */
74
- userAgent?: string;
74
+ userAgent?: string | undefined;
75
75
  }): Promise<string[] | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"stealer-logs-by-email.js","sourceRoot":"","sources":["../../src/stealer-logs-by-email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,UAAU,kBAAkB,CAChC,YAAoB,EACpB,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,uBAAuB,kBAAkB,CAAC,YAAY,CAAC,EAAE,CAAC;IAE3E,OAAO,YAAY,CAAC,QAAQ,EAAE;QAC5B,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAA6B,CAAC;AACjC,CAAC"}
1
+ {"version":3,"file":"stealer-logs-by-email.js","sourceRoot":"","sources":["../../src/stealer-logs-by-email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,UAAU,kBAAkB,CAChC,YAAoB,EACpB,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,uBAAuB,kBAAkB,CAAC,YAAY,CAAC,EAAE,CAAC;IAE3E,OAAO,YAAY,CAAW,QAAQ,EAAE;QACtC,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
@@ -53,23 +53,23 @@ export declare function stealerLogsByWebsiteDomain(websiteDomain: string, option
53
53
  /**
54
54
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
55
55
  */
56
- apiKey?: string;
56
+ apiKey?: string | undefined;
57
57
  /**
58
58
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
59
59
  * `https://haveibeenpwned.com/api/v3`)
60
60
  */
61
- baseUrl?: string;
61
+ baseUrl?: string | undefined;
62
62
  /**
63
63
  * timeout for the request in milliseconds (default: none)
64
64
  */
65
- timeoutMs?: number;
65
+ timeoutMs?: number | undefined;
66
66
  /**
67
67
  * an AbortSignal to cancel the request (default: none)
68
68
  */
69
- signal?: AbortSignal;
69
+ signal?: AbortSignal | undefined;
70
70
  /**
71
71
  * a custom string to send as the User-Agent field in the request headers
72
72
  * (default: `hibp <version>`)
73
73
  */
74
- userAgent?: string;
74
+ userAgent?: string | undefined;
75
75
  }): Promise<string[] | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"stealer-logs-by-website-domain.js","sourceRoot":"","sources":["../../src/stealer-logs-by-website-domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,UAAU,0BAA0B,CACxC,aAAqB,EACrB,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,+BAA+B,kBAAkB,CAAC,aAAa,CAAC,EAAE,CAAC;IAEpF,OAAO,YAAY,CAAC,QAAQ,EAAE;QAC5B,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAA6B,CAAC;AACjC,CAAC"}
1
+ {"version":3,"file":"stealer-logs-by-website-domain.js","sourceRoot":"","sources":["../../src/stealer-logs-by-website-domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,UAAU,0BAA0B,CACxC,aAAqB,EACrB,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,+BAA+B,kBAAkB,CAAC,aAAa,CAAC,EAAE,CAAC;IAEpF,OAAO,YAAY,CAAW,QAAQ,EAAE;QACtC,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}