hibp 15.2.1 → 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 (91) hide show
  1. package/API.md +433 -126
  2. package/CHANGELOG.md +52 -0
  3. package/MIGRATION.md +7 -5
  4. package/README.md +53 -27
  5. package/dist/browser/hibp.module.js +2 -2
  6. package/dist/esm/api/base-fetch.d.ts +9 -5
  7. package/dist/esm/api/base-fetch.js +17 -10
  8. package/dist/esm/api/base-fetch.js.map +1 -1
  9. package/dist/esm/api/haveibeenpwned/fetch-from-api.d.ts +1 -1
  10. package/dist/esm/api/haveibeenpwned/fetch-from-api.js +62 -44
  11. package/dist/esm/api/haveibeenpwned/fetch-from-api.js.map +1 -1
  12. package/dist/esm/api/haveibeenpwned/package-info.d.ts +1 -1
  13. package/dist/esm/api/haveibeenpwned/package-info.js +1 -1
  14. package/dist/esm/api/haveibeenpwned/post-to-api.d.ts +1 -0
  15. package/dist/esm/api/haveibeenpwned/post-to-api.js +23 -0
  16. package/dist/esm/api/haveibeenpwned/post-to-api.js.map +1 -0
  17. package/dist/esm/api/haveibeenpwned/responses.d.ts +0 -10
  18. package/dist/esm/api/haveibeenpwned/responses.js +5 -36
  19. package/dist/esm/api/haveibeenpwned/responses.js.map +1 -1
  20. package/dist/esm/api/haveibeenpwned/types.d.ts +22 -2
  21. package/dist/esm/api/haveibeenpwned/types.js +0 -3
  22. package/dist/esm/api/haveibeenpwned/types.js.map +1 -1
  23. package/dist/esm/api/pwnedpasswords/fetch-from-api.js +5 -28
  24. package/dist/esm/api/pwnedpasswords/fetch-from-api.js.map +1 -1
  25. package/dist/esm/api/pwnedpasswords/responses.d.ts +0 -6
  26. package/dist/esm/api/pwnedpasswords/responses.js +1 -7
  27. package/dist/esm/api/pwnedpasswords/responses.js.map +1 -1
  28. package/dist/esm/breach.d.ts +12 -5
  29. package/dist/esm/breach.js +8 -1
  30. package/dist/esm/breach.js.map +1 -1
  31. package/dist/esm/breached-account-range.d.ts +73 -0
  32. package/dist/esm/breached-account-range.js +60 -0
  33. package/dist/esm/breached-account-range.js.map +1 -0
  34. package/dist/esm/breached-account.d.ts +56 -45
  35. package/dist/esm/breached-account.js +4 -76
  36. package/dist/esm/breached-account.js.map +1 -1
  37. package/dist/esm/breached-domain.d.ts +7 -8
  38. package/dist/esm/breached-domain.js +2 -3
  39. package/dist/esm/breached-domain.js.map +1 -1
  40. package/dist/esm/breaches.d.ts +14 -7
  41. package/dist/esm/breaches.js +10 -5
  42. package/dist/esm/breaches.js.map +1 -1
  43. package/dist/esm/data-class-descriptions.d.ts +55 -0
  44. package/dist/esm/data-class-descriptions.js +39 -0
  45. package/dist/esm/data-class-descriptions.js.map +1 -0
  46. package/dist/esm/data-classes.d.ts +4 -4
  47. package/dist/esm/data-classes.js +2 -2
  48. package/dist/esm/data-classes.js.map +1 -1
  49. package/dist/esm/generate-dns-token.d.ts +67 -0
  50. package/dist/esm/generate-dns-token.js +49 -0
  51. package/dist/esm/generate-dns-token.js.map +1 -0
  52. package/dist/esm/hibp.d.ts +28 -18
  53. package/dist/esm/hibp.js +22 -28
  54. package/dist/esm/hibp.js.map +1 -1
  55. package/dist/esm/latest-breach.d.ts +5 -5
  56. package/dist/esm/latest-breach.js +2 -2
  57. package/dist/esm/latest-breach.js.map +1 -1
  58. package/dist/esm/paste-account.d.ts +13 -13
  59. package/dist/esm/paste-account.js +8 -8
  60. package/dist/esm/paste-account.js.map +1 -1
  61. package/dist/esm/pwned-password-range.d.ts +6 -6
  62. package/dist/esm/pwned-password-range.js +4 -6
  63. package/dist/esm/pwned-password-range.js.map +1 -1
  64. package/dist/esm/pwned-password.d.ts +5 -5
  65. package/dist/esm/pwned-password.js +12 -7
  66. package/dist/esm/pwned-password.js.map +1 -1
  67. package/dist/esm/search.d.ts +57 -40
  68. package/dist/esm/search.js +5 -74
  69. package/dist/esm/search.js.map +1 -1
  70. package/dist/esm/send-email.d.ts +69 -0
  71. package/dist/esm/send-email.js +49 -0
  72. package/dist/esm/send-email.js.map +1 -0
  73. package/dist/esm/stealer-logs-by-email-domain.d.ts +13 -14
  74. package/dist/esm/stealer-logs-by-email-domain.js +8 -9
  75. package/dist/esm/stealer-logs-by-email-domain.js.map +1 -1
  76. package/dist/esm/stealer-logs-by-email.d.ts +9 -10
  77. package/dist/esm/stealer-logs-by-email.js +5 -6
  78. package/dist/esm/stealer-logs-by-email.js.map +1 -1
  79. package/dist/esm/stealer-logs-by-website-domain.d.ts +9 -10
  80. package/dist/esm/stealer-logs-by-website-domain.js +5 -6
  81. package/dist/esm/stealer-logs-by-website-domain.js.map +1 -1
  82. package/dist/esm/subscribed-domains.d.ts +7 -8
  83. package/dist/esm/subscribed-domains.js +4 -5
  84. package/dist/esm/subscribed-domains.js.map +1 -1
  85. package/dist/esm/subscription-status.d.ts +16 -11
  86. package/dist/esm/subscription-status.js +13 -8
  87. package/dist/esm/subscription-status.js.map +1 -1
  88. package/dist/esm/verify-dns-token.d.ts +60 -0
  89. package/dist/esm/verify-dns-token.js +41 -0
  90. package/dist/esm/verify-dns-token.js.map +1 -0
  91. package/package.json +55 -56
@@ -1,8 +1,8 @@
1
- import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
1
+ import { fetchFromApi } from "./api/haveibeenpwned/fetch-from-api.js";
2
2
  /**
3
3
  * An object mapping an email alias (local-part before the '@') to the list of
4
- * email domains that alias has appeared in within stealer logs for the specified
5
- * email domain.
4
+ * website domains that alias has appeared against in stealer logs for the
5
+ * specified email domain.
6
6
  *
7
7
  * @typedef {Object.<string, string[]>} StealerLogDomainsByEmailAlias
8
8
  */
@@ -10,15 +10,14 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
10
10
  * Fetches all stealer log email aliases for an email domain.
11
11
  *
12
12
  * The result maps email aliases (the local-part before the '@') to an array of
13
- * email domains found in stealer logs. For example, querying `example.com`
13
+ * website domains found in stealer logs. For example, querying `example.com`
14
14
  * could return an object like `{ "andy": ["netflix.com"], "jane": ["netflix.com",
15
15
  * "spotify.com"] }`, corresponding to `andy@example.com` and `jane@example.com`.
16
16
  *
17
- * 🔑 `haveibeenpwned.com` requires an API key from
18
- * https://haveibeenpwned.com/API/Key for the `stealerlogsbyemaildomain` endpoint.
19
- * The `apiKey` option here is not explicitly required, but direct requests made
20
- * without it will fail (unless you specify a `baseUrl` to a proxy that inserts
21
- * a valid API key on your behalf).
17
+ * Requires a Pro API key from https://haveibeenpwned.com/API/Key. The `apiKey`
18
+ * option here is not explicitly required, but direct requests made without it
19
+ * will fail (unless you specify a `baseUrl` to a proxy that inserts a valid API
20
+ * key on your behalf).
22
21
  *
23
22
  * @param {string} emailDomain the email domain to query (e.g., "example.com")
24
23
  * @param {object} [options] a configuration object
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,wBAAwB,CACtC,WAAmB,EACnB,UAuBI,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"}
@@ -4,11 +4,10 @@
4
4
  * Returns an array of domains for which stealer logs contain entries for the
5
5
  * supplied email address.
6
6
  *
7
- * 🔑 `haveibeenpwned.com` requires an API key from
8
- * https://haveibeenpwned.com/API/Key for the `stealerlogsbyemail` endpoint. The
9
- * `apiKey` option here is not explicitly required, but direct requests made
10
- * without it will fail (unless you specify a `baseUrl` to a proxy that inserts
11
- * a valid API key on your behalf).
7
+ * Requires a Pro API key from https://haveibeenpwned.com/API/Key. The `apiKey`
8
+ * option here is not explicitly required, but direct requests made without it
9
+ * will fail (unless you specify a `baseUrl` to a proxy that inserts a valid API
10
+ * key on your behalf).
12
11
  *
13
12
  * @param {string} emailAddress the email address to query
14
13
  * @param {object} [options] a configuration object
@@ -54,23 +53,23 @@ export declare function stealerLogsByEmail(emailAddress: string, options?: {
54
53
  /**
55
54
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
56
55
  */
57
- apiKey?: string;
56
+ apiKey?: string | undefined;
58
57
  /**
59
58
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
60
59
  * `https://haveibeenpwned.com/api/v3`)
61
60
  */
62
- baseUrl?: string;
61
+ baseUrl?: string | undefined;
63
62
  /**
64
63
  * timeout for the request in milliseconds (default: none)
65
64
  */
66
- timeoutMs?: number;
65
+ timeoutMs?: number | undefined;
67
66
  /**
68
67
  * an AbortSignal to cancel the request (default: none)
69
68
  */
70
- signal?: AbortSignal;
69
+ signal?: AbortSignal | undefined;
71
70
  /**
72
71
  * a custom string to send as the User-Agent field in the request headers
73
72
  * (default: `hibp <version>`)
74
73
  */
75
- userAgent?: string;
74
+ userAgent?: string | undefined;
76
75
  }): Promise<string[] | null>;
@@ -1,15 +1,14 @@
1
- import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
1
+ import { fetchFromApi } from "./api/haveibeenpwned/fetch-from-api.js";
2
2
  /**
3
3
  * Fetches all stealer log domains for an email address.
4
4
  *
5
5
  * Returns an array of domains for which stealer logs contain entries for the
6
6
  * supplied email address.
7
7
  *
8
- * 🔑 `haveibeenpwned.com` requires an API key from
9
- * https://haveibeenpwned.com/API/Key for the `stealerlogsbyemail` endpoint. The
10
- * `apiKey` option here is not explicitly required, but direct requests made
11
- * without it will fail (unless you specify a `baseUrl` to a proxy that inserts
12
- * a valid API key on your behalf).
8
+ * Requires a Pro API key from https://haveibeenpwned.com/API/Key. The `apiKey`
9
+ * option here is not explicitly required, but direct requests made without it
10
+ * will fail (unless you specify a `baseUrl` to a proxy that inserts a valid API
11
+ * key on your behalf).
13
12
  *
14
13
  * @param {string} emailAddress the email address to query
15
14
  * @param {object} [options] a configuration object
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,kBAAkB,CAChC,YAAoB,EACpB,UAuBI,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"}
@@ -4,11 +4,10 @@
4
4
  * The result is an array of strings representing email addresses found in
5
5
  * stealer logs for the specified website domain (e.g., "example.com").
6
6
  *
7
- * 🔑 `haveibeenpwned.com` requires an API key from
8
- * https://haveibeenpwned.com/API/Key for the `stealerlogsbywebsitedomain`
9
- * endpoint. The `apiKey` option here is not explicitly required, but direct
10
- * requests made without it will fail (unless you specify a `baseUrl` to a proxy
11
- * that inserts a valid API key on your behalf).
7
+ * Requires a Pro API key from https://haveibeenpwned.com/API/Key. The `apiKey`
8
+ * option here is not explicitly required, but direct requests made without it
9
+ * will fail (unless you specify a `baseUrl` to a proxy that inserts a valid API
10
+ * key on your behalf).
12
11
  *
13
12
  * @param {string} websiteDomain the website domain to query (e.g., "example.com")
14
13
  * @param {object} [options] a configuration object
@@ -54,23 +53,23 @@ export declare function stealerLogsByWebsiteDomain(websiteDomain: string, option
54
53
  /**
55
54
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
56
55
  */
57
- apiKey?: string;
56
+ apiKey?: string | undefined;
58
57
  /**
59
58
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
60
59
  * `https://haveibeenpwned.com/api/v3`)
61
60
  */
62
- baseUrl?: string;
61
+ baseUrl?: string | undefined;
63
62
  /**
64
63
  * timeout for the request in milliseconds (default: none)
65
64
  */
66
- timeoutMs?: number;
65
+ timeoutMs?: number | undefined;
67
66
  /**
68
67
  * an AbortSignal to cancel the request (default: none)
69
68
  */
70
- signal?: AbortSignal;
69
+ signal?: AbortSignal | undefined;
71
70
  /**
72
71
  * a custom string to send as the User-Agent field in the request headers
73
72
  * (default: `hibp <version>`)
74
73
  */
75
- userAgent?: string;
74
+ userAgent?: string | undefined;
76
75
  }): Promise<string[] | null>;
@@ -1,15 +1,14 @@
1
- import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
1
+ import { fetchFromApi } from "./api/haveibeenpwned/fetch-from-api.js";
2
2
  /**
3
3
  * Fetches all stealer log email addresses for a website domain.
4
4
  *
5
5
  * The result is an array of strings representing email addresses found in
6
6
  * stealer logs for the specified website domain (e.g., "example.com").
7
7
  *
8
- * 🔑 `haveibeenpwned.com` requires an API key from
9
- * https://haveibeenpwned.com/API/Key for the `stealerlogsbywebsitedomain`
10
- * endpoint. The `apiKey` option here is not explicitly required, but direct
11
- * requests made without it will fail (unless you specify a `baseUrl` to a proxy
12
- * that inserts a valid API key on your behalf).
8
+ * Requires a Pro API key from https://haveibeenpwned.com/API/Key. The `apiKey`
9
+ * option here is not explicitly required, but direct requests made without it
10
+ * will fail (unless you specify a `baseUrl` to a proxy that inserts a valid API
11
+ * key on your behalf).
13
12
  *
14
13
  * @param {string} websiteDomain the website domain to query (e.g., "example.com")
15
14
  * @param {object} [options] a configuration object
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,0BAA0B,CACxC,aAAqB,EACrB,UAuBI,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"}
@@ -1,4 +1,4 @@
1
- import type { SubscribedDomain } from './api/haveibeenpwned/types.js';
1
+ import type { SubscribedDomain } from "./api/haveibeenpwned/types.js";
2
2
  /**
3
3
  * An object representing a subscribed domain.
4
4
  *
@@ -16,8 +16,7 @@ import type { SubscribedDomain } from './api/haveibeenpwned/types.js';
16
16
  * after verifying control. Each domain includes metadata about breach counts and
17
17
  * the next renewal date, where available.
18
18
  *
19
- * 🔑 `haveibeenpwned.com` requires an API key from
20
- * https://haveibeenpwned.com/API/Key for the `subscribeddomains` endpoint. The
19
+ * Requires a Core or Pro API key from https://haveibeenpwned.com/API/Key. The
21
20
  * `apiKey` option here is not explicitly required, but direct requests made
22
21
  * without it will fail (unless you specify a `baseUrl` to a proxy that inserts
23
22
  * a valid API key on your behalf).
@@ -56,23 +55,23 @@ export declare function subscribedDomains(options?: {
56
55
  /**
57
56
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
58
57
  */
59
- apiKey?: string;
58
+ apiKey?: string | undefined;
60
59
  /**
61
60
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
62
61
  * `https://haveibeenpwned.com/api/v3`)
63
62
  */
64
- baseUrl?: string;
63
+ baseUrl?: string | undefined;
65
64
  /**
66
65
  * timeout for the request in milliseconds (default: none)
67
66
  */
68
- timeoutMs?: number;
67
+ timeoutMs?: number | undefined;
69
68
  /**
70
69
  * an AbortSignal to cancel the request (default: none)
71
70
  */
72
- signal?: AbortSignal;
71
+ signal?: AbortSignal | undefined;
73
72
  /**
74
73
  * a custom string to send as the User-Agent field in the request headers
75
74
  * (default: `hibp <version>`)
76
75
  */
77
- userAgent?: string;
76
+ userAgent?: string | undefined;
78
77
  }): Promise<SubscribedDomain[]>;
@@ -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
  * An object representing a subscribed domain.
4
4
  *
@@ -16,8 +16,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
16
16
  * after verifying control. Each domain includes metadata about breach counts and
17
17
  * the next renewal date, where available.
18
18
  *
19
- * 🔑 `haveibeenpwned.com` requires an API key from
20
- * https://haveibeenpwned.com/API/Key for the `subscribeddomains` endpoint. The
19
+ * Requires a Core or Pro API key from https://haveibeenpwned.com/API/Key. The
21
20
  * `apiKey` option here is not explicitly required, but direct requests made
22
21
  * without it will fail (unless you specify a `baseUrl` to a proxy that inserts
23
22
  * a valid API key on your behalf).
@@ -54,8 +53,8 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
54
53
  */
55
54
  export function subscribedDomains(options = {}) {
56
55
  const { apiKey, baseUrl, timeoutMs, signal, userAgent } = options;
57
- const endpoint = '/subscribeddomains';
58
- return fetchFromApi(endpoint, {
56
+ const endpoint = "/subscribeddomains";
57
+ return fetchRequiredFromApi(endpoint, {
59
58
  apiKey,
60
59
  baseUrl,
61
60
  timeoutMs,
@@ -1 +1 @@
1
- {"version":3,"file":"subscribed-domains.js","sourceRoot":"","sources":["../../src/subscribed-domains.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAuBI,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,oBAAoB,CAAC;IAEtC,OAAO,YAAY,CAAC,QAAQ,EAAE;QAC5B,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAgC,CAAC;AACpC,CAAC"}
1
+ {"version":3,"file":"subscribed-domains.js","sourceRoot":"","sources":["../../src/subscribed-domains.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,oBAAoB,CAAC;IAEtC,OAAO,oBAAoB,CAAqB,QAAQ,EAAE;QACxD,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { SubscriptionStatus } from './api/haveibeenpwned/types.js';
1
+ import type { SubscriptionStatus } from "./api/haveibeenpwned/types.js";
2
2
  /**
3
3
  * An object representing the status of your HIBP subscription.
4
4
  *
@@ -8,16 +8,21 @@ import type { SubscriptionStatus } from './api/haveibeenpwned/types.js';
8
8
  * @property {string} SubscribedUntil
9
9
  * @property {number} Rpm
10
10
  * @property {number} DomainSearchMaxBreachedAccounts
11
+ * @property {number|null} MaxBreachedDomains maximum domains that can be added; null means no limit
11
12
  * @property {boolean} IncludesStealerLogs
13
+ * @property {boolean} IncludesBulkDomainAdd access to APIs for adding domains in bulk
14
+ * @property {boolean} IncludesAutoSubdomainVerification automatic verification of subdomains of a verified apex domain
15
+ * @property {boolean} IncludesCustomerDomains permission to add customer domains
16
+ * @property {boolean} IncludesKAnon access to email address searches using k-anonymity
12
17
  */
13
18
  /**
14
19
  * Fetches the current status of your HIBP subscription (API key).
15
20
  *
16
- * 🔑 `haveibeenpwned.com` requires an API key from
17
- * https://haveibeenpwned.com/API/Key for the `subscription/status` endpoint.
18
- * The `apiKey` option here is not explicitly required, but direct requests made
19
- * without it will fail (unless you specify a `baseUrl` to a proxy that inserts
20
- * a valid API key on your behalf).
21
+ * Requires a Core, Pro, or High RPM API key from
22
+ * https://haveibeenpwned.com/API/Key. The `apiKey` option here is not
23
+ * explicitly required, but direct requests made without it will fail (unless
24
+ * you specify a `baseUrl` to a proxy that inserts a valid API key on your
25
+ * behalf).
21
26
  *
22
27
  * @param {object} [options] a configuration object
23
28
  * @param {string} [options.apiKey] an API key from
@@ -53,23 +58,23 @@ export declare function subscriptionStatus(options?: {
53
58
  /**
54
59
  * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
55
60
  */
56
- apiKey?: string;
61
+ apiKey?: string | undefined;
57
62
  /**
58
63
  * a custom base URL for the haveibeenpwned.com API endpoints (default:
59
64
  * `https://haveibeenpwned.com/api/v3`)
60
65
  */
61
- baseUrl?: string;
66
+ baseUrl?: string | undefined;
62
67
  /**
63
68
  * timeout for the request in milliseconds (default: none)
64
69
  */
65
- timeoutMs?: number;
70
+ timeoutMs?: number | undefined;
66
71
  /**
67
72
  * an AbortSignal to cancel the request (default: none)
68
73
  */
69
- signal?: AbortSignal;
74
+ signal?: AbortSignal | undefined;
70
75
  /**
71
76
  * a custom string to send as the User-Agent field in the request headers
72
77
  * (default: `hibp <version>`)
73
78
  */
74
- userAgent?: string;
79
+ userAgent?: string | undefined;
75
80
  }): Promise<SubscriptionStatus>;
@@ -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
  * An object representing the status of your HIBP subscription.
4
4
  *
@@ -8,16 +8,21 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
8
8
  * @property {string} SubscribedUntil
9
9
  * @property {number} Rpm
10
10
  * @property {number} DomainSearchMaxBreachedAccounts
11
+ * @property {number|null} MaxBreachedDomains maximum domains that can be added; null means no limit
11
12
  * @property {boolean} IncludesStealerLogs
13
+ * @property {boolean} IncludesBulkDomainAdd access to APIs for adding domains in bulk
14
+ * @property {boolean} IncludesAutoSubdomainVerification automatic verification of subdomains of a verified apex domain
15
+ * @property {boolean} IncludesCustomerDomains permission to add customer domains
16
+ * @property {boolean} IncludesKAnon access to email address searches using k-anonymity
12
17
  */
13
18
  /**
14
19
  * Fetches the current status of your HIBP subscription (API key).
15
20
  *
16
- * 🔑 `haveibeenpwned.com` requires an API key from
17
- * https://haveibeenpwned.com/API/Key for the `subscription/status` endpoint.
18
- * The `apiKey` option here is not explicitly required, but direct requests made
19
- * without it will fail (unless you specify a `baseUrl` to a proxy that inserts
20
- * a valid API key on your behalf).
21
+ * Requires a Core, Pro, or High RPM API key from
22
+ * https://haveibeenpwned.com/API/Key. The `apiKey` option here is not
23
+ * explicitly required, but direct requests made without it will fail (unless
24
+ * you specify a `baseUrl` to a proxy that inserts a valid API key on your
25
+ * behalf).
21
26
  *
22
27
  * @param {object} [options] a configuration object
23
28
  * @param {string} [options.apiKey] an API key from
@@ -50,7 +55,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
50
55
  * }
51
56
  */
52
57
  export async function subscriptionStatus(options = {}) {
53
- const endpoint = '/subscription/status';
54
- return fetchFromApi(endpoint, options);
58
+ const endpoint = "/subscription/status";
59
+ return fetchRequiredFromApi(endpoint, options);
55
60
  }
56
61
  //# sourceMappingURL=subscription-status.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscription-status.js","sourceRoot":"","sources":["../../src/subscription-status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,UAuBI,EAAE;IAEN,MAAM,QAAQ,GAAG,sBAAsB,CAAC;IAExC,OAAO,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAgC,CAAC;AACxE,CAAC"}
1
+ {"version":3,"file":"subscription-status.js","sourceRoot":"","sources":["../../src/subscription-status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAO,GAuBH,EAAE;IAEN,MAAM,QAAQ,GAAG,sBAAsB,CAAC;IAExC,OAAO,oBAAoB,CAAqB,QAAQ,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Verifies a domain's published HIBP TXT record.
3
+ *
4
+ * Generate the value with `generateDnsToken`, publish it at your DNS provider,
5
+ * and allow time for DNS propagation first. The record can be removed after
6
+ * verification succeeds.
7
+ *
8
+ * Requires a Pro API key from https://haveibeenpwned.com/API/Key. The `apiKey`
9
+ * option here is not explicitly required, but direct requests made without it
10
+ * will fail (unless you specify a `baseUrl` to a proxy that inserts a valid API
11
+ * key on your behalf).
12
+ *
13
+ * @see https://haveibeenpwned.com/API/v3#VerifyDomainViaDns
14
+ * @param {string} domain the domain to verify (e.g., "example.com")
15
+ * @param {object} [options] a configuration object
16
+ * @param {string} [options.apiKey] an API key from
17
+ * https://haveibeenpwned.com/API/Key (default: undefined)
18
+ * @param {string} [options.baseUrl] a custom base URL for the
19
+ * haveibeenpwned.com API endpoints (default:
20
+ * `https://haveibeenpwned.com/api/v3`)
21
+ * @param {number} [options.timeoutMs] timeout for the request in milliseconds
22
+ * (default: none)
23
+ * @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
24
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
25
+ * field in the request headers (default: `hibp <version>`)
26
+ * @returns {Promise<void>} a Promise which resolves without parsing the
27
+ * response body when verification succeeds, or rejects with an Error
28
+ * containing the upstream failure reason
29
+ * @example
30
+ * try {
31
+ * await verifyDnsToken("example.com", { apiKey: "my-api-key" });
32
+ * // ...
33
+ * } catch (err) {
34
+ * // ...
35
+ * }
36
+ */
37
+ export declare function verifyDnsToken(domain: string, options?: {
38
+ /**
39
+ * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
40
+ */
41
+ apiKey?: string | undefined;
42
+ /**
43
+ * a custom base URL for the haveibeenpwned.com API endpoints (default:
44
+ * `https://haveibeenpwned.com/api/v3`)
45
+ */
46
+ baseUrl?: string | undefined;
47
+ /**
48
+ * timeout for the request in milliseconds (default: none)
49
+ */
50
+ timeoutMs?: number | undefined;
51
+ /**
52
+ * an AbortSignal to cancel the request (default: none)
53
+ */
54
+ signal?: AbortSignal | undefined;
55
+ /**
56
+ * a custom string to send as the User-Agent field in the request headers
57
+ * (default: `hibp <version>`)
58
+ */
59
+ userAgent?: string | undefined;
60
+ }): Promise<void>;
@@ -0,0 +1,41 @@
1
+ import { postToApi } from "./api/haveibeenpwned/post-to-api.js";
2
+ /**
3
+ * Verifies a domain's published HIBP TXT record.
4
+ *
5
+ * Generate the value with `generateDnsToken`, publish it at your DNS provider,
6
+ * and allow time for DNS propagation first. The record can be removed after
7
+ * verification succeeds.
8
+ *
9
+ * Requires a Pro API key from https://haveibeenpwned.com/API/Key. The `apiKey`
10
+ * option here is not explicitly required, but direct requests made without it
11
+ * will fail (unless you specify a `baseUrl` to a proxy that inserts a valid API
12
+ * key on your behalf).
13
+ *
14
+ * @see https://haveibeenpwned.com/API/v3#VerifyDomainViaDns
15
+ * @param {string} domain the domain to verify (e.g., "example.com")
16
+ * @param {object} [options] a configuration object
17
+ * @param {string} [options.apiKey] an API key from
18
+ * https://haveibeenpwned.com/API/Key (default: undefined)
19
+ * @param {string} [options.baseUrl] a custom base URL for the
20
+ * haveibeenpwned.com API endpoints (default:
21
+ * `https://haveibeenpwned.com/api/v3`)
22
+ * @param {number} [options.timeoutMs] timeout for the request in milliseconds
23
+ * (default: none)
24
+ * @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
25
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
26
+ * field in the request headers (default: `hibp <version>`)
27
+ * @returns {Promise<void>} a Promise which resolves without parsing the
28
+ * response body when verification succeeds, or rejects with an Error
29
+ * containing the upstream failure reason
30
+ * @example
31
+ * try {
32
+ * await verifyDnsToken("example.com", { apiKey: "my-api-key" });
33
+ * // ...
34
+ * } catch (err) {
35
+ * // ...
36
+ * }
37
+ */
38
+ export async function verifyDnsToken(domain, options = {}) {
39
+ await postToApi("/domainVerification/verifyDnsToken", { DomainName: domain }, options);
40
+ }
41
+ //# sourceMappingURL=verify-dns-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-dns-token.js","sourceRoot":"","sources":["../../src/verify-dns-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,OAAO,GAuBH,EAAE;IAEN,MAAM,SAAS,CACb,oCAAoC,EACpC,EAAE,UAAU,EAAE,MAAM,EAAE,EACtB,OAAO,CACR,CAAC;AACJ,CAAC"}