hibp 15.0.1 → 15.2.0

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 (64) hide show
  1. package/API.md +391 -0
  2. package/CHANGELOG.md +26 -2
  3. package/MIGRATION.md +0 -2
  4. package/README.md +14 -1
  5. package/dist/browser/hibp.module.js +2 -2
  6. package/dist/esm/api/base-fetch.d.ts +11 -0
  7. package/dist/esm/api/base-fetch.js +44 -0
  8. package/dist/esm/api/base-fetch.js.map +1 -0
  9. package/dist/esm/api/haveibeenpwned/fetch-from-api.js +12 -20
  10. package/dist/esm/api/haveibeenpwned/fetch-from-api.js.map +1 -1
  11. package/dist/esm/api/haveibeenpwned/package-info.d.ts +1 -1
  12. package/dist/esm/api/haveibeenpwned/package-info.js +1 -1
  13. package/dist/esm/api/haveibeenpwned/types.d.ts +10 -0
  14. package/dist/esm/api/pwnedpasswords/fetch-from-api.js +15 -10
  15. package/dist/esm/api/pwnedpasswords/fetch-from-api.js.map +1 -1
  16. package/dist/esm/breach.d.ts +5 -0
  17. package/dist/esm/breach.js +1 -0
  18. package/dist/esm/breach.js.map +1 -1
  19. package/dist/esm/breached-account.d.ts +5 -0
  20. package/dist/esm/breached-account.js +3 -1
  21. package/dist/esm/breached-account.js.map +1 -1
  22. package/dist/esm/breached-domain.d.ts +72 -0
  23. package/dist/esm/breached-domain.js +60 -0
  24. package/dist/esm/breached-domain.js.map +1 -0
  25. package/dist/esm/breaches.d.ts +5 -0
  26. package/dist/esm/breaches.js +3 -1
  27. package/dist/esm/breaches.js.map +1 -1
  28. package/dist/esm/data-classes.d.ts +5 -0
  29. package/dist/esm/data-classes.js +1 -0
  30. package/dist/esm/data-classes.js.map +1 -1
  31. package/dist/esm/hibp.d.ts +13 -1
  32. package/dist/esm/hibp.js +7 -1
  33. package/dist/esm/hibp.js.map +1 -1
  34. package/dist/esm/latest-breach.d.ts +48 -0
  35. package/dist/esm/latest-breach.js +32 -0
  36. package/dist/esm/latest-breach.js.map +1 -0
  37. package/dist/esm/paste-account.d.ts +5 -0
  38. package/dist/esm/paste-account.js +1 -0
  39. package/dist/esm/paste-account.js.map +1 -1
  40. package/dist/esm/pwned-password-range.d.ts +5 -0
  41. package/dist/esm/pwned-password-range.js +3 -1
  42. package/dist/esm/pwned-password-range.js.map +1 -1
  43. package/dist/esm/pwned-password.d.ts +5 -0
  44. package/dist/esm/pwned-password.js +1 -2
  45. package/dist/esm/pwned-password.js.map +1 -1
  46. package/dist/esm/search.d.ts +5 -0
  47. package/dist/esm/search.js +4 -2
  48. package/dist/esm/search.js.map +1 -1
  49. package/dist/esm/stealer-logs-by-email-domain.d.ts +73 -0
  50. package/dist/esm/stealer-logs-by-email-domain.js +61 -0
  51. package/dist/esm/stealer-logs-by-email-domain.js.map +1 -0
  52. package/dist/esm/stealer-logs-by-email.d.ts +76 -0
  53. package/dist/esm/stealer-logs-by-email.js +65 -0
  54. package/dist/esm/stealer-logs-by-email.js.map +1 -0
  55. package/dist/esm/stealer-logs-by-website-domain.d.ts +76 -0
  56. package/dist/esm/stealer-logs-by-website-domain.js +65 -0
  57. package/dist/esm/stealer-logs-by-website-domain.js.map +1 -0
  58. package/dist/esm/subscribed-domains.d.ts +78 -0
  59. package/dist/esm/subscribed-domains.js +66 -0
  60. package/dist/esm/subscribed-domains.js.map +1 -0
  61. package/dist/esm/subscription-status.d.ts +6 -0
  62. package/dist/esm/subscription-status.js +2 -0
  63. package/dist/esm/subscription-status.js.map +1 -1
  64. package/package.json +23 -27
package/API.md CHANGED
@@ -12,12 +12,27 @@
12
12
  without it will fail (unless you specify a <code>baseUrl</code> to a proxy that inserts
13
13
  a valid API key on your behalf).</p>
14
14
  </dd>
15
+ <dt><a href="#breachedDomain">breachedDomain(domain, [options])</a> ⇒ <code><a href="#breach--objectedDomainsByEmailAlias">Promise.&lt;BreachedDomainsByEmailAlias&gt;</a></code> | <code>Promise.&lt;null&gt;</code></dt>
16
+ <dd><p>Fetches all breached email addresses for a domain.</p>
17
+ <p>The result maps email aliases (the local-part before the &#39;@&#39;) to an array of
18
+ breach names. For example, querying <code>example.com</code> could return an object like
19
+ <code>{ &quot;john&quot;: [&quot;Adobe&quot;], &quot;jane&quot;: [&quot;Adobe&quot;, &quot;Gawker&quot;] }</code>, corresponding to
20
+ <code>john@example.com</code> and <code>jane@example.com</code>.</p>
21
+ <p>🔑 <code>haveibeenpwned.com</code> requires an API key from
22
+ <a href="https://haveibeenpwned.com/API/Key">https://haveibeenpwned.com/API/Key</a> for the <code>breacheddomain</code> endpoint. The
23
+ <code>apiKey</code> option here is not explicitly required, but direct requests made
24
+ without it will fail (unless you specify a <code>baseUrl</code> to a proxy that inserts
25
+ a valid API key on your behalf).</p>
26
+ </dd>
15
27
  <dt><a href="#breaches">breaches([options])</a> ⇒ <code><a href="#breach--object">Promise.&lt;Array.&lt;Breach&gt;&gt;</a></code></dt>
16
28
  <dd><p>Fetches all breach events in the system.</p>
17
29
  </dd>
18
30
  <dt><a href="#dataClasses">dataClasses([options])</a> ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> | <code>Promise.&lt;null&gt;</code></dt>
19
31
  <dd><p>Fetches all data classes in the system.</p>
20
32
  </dd>
33
+ <dt><a href="#latestBreach">latestBreach([options])</a> ⇒ <code><a href="#breach--object">Promise.&lt;Breach&gt;</a></code> | <code>Promise.&lt;null&gt;</code></dt>
34
+ <dd><p>Fetches the most recently added breach.</p>
35
+ </dd>
21
36
  <dt><a href="#pasteAccount">pasteAccount(email, [options])</a> ⇒ <code><a href="#paste--object">Promise.&lt;Array.&lt;Paste&gt;&gt;</a></code> | <code>Promise.&lt;null&gt;</code></dt>
22
37
  <dd><p>Fetches paste data for a specific account (email address).</p>
23
38
  <p>🔑 <code>haveibeenpwned.com</code> requires an API key from
@@ -54,6 +69,48 @@ convenience method is designed to mimic.</p>
54
69
  required, but direct requests made without it will fail (unless you specify a
55
70
  <code>baseUrl</code> to a proxy that inserts a valid API key on your behalf).</p>
56
71
  </dd>
72
+ <dt><a href="#stealerLogsByEmailDomain">stealerLogsByEmailDomain(emailDomain, [options])</a> ⇒ <code><a href="#StealerLogDomainsByEmailAlias">Promise.&lt;StealerLogDomainsByEmailAlias&gt;</a></code> | <code>Promise.&lt;null&gt;</code></dt>
73
+ <dd><p>Fetches all stealer log email aliases for an email domain.</p>
74
+ <p>The result maps email aliases (the local-part before the &#39;@&#39;) to an array of
75
+ email domains found in stealer logs. For example, querying <code>example.com</code>
76
+ could return an object like <code>{ &quot;andy&quot;: [&quot;netflix.com&quot;], &quot;jane&quot;: [&quot;netflix.com&quot;, &quot;spotify.com&quot;] }</code>, corresponding to <code>andy@example.com</code> and <code>jane@example.com</code>.</p>
77
+ <p>🔑 <code>haveibeenpwned.com</code> requires an API key from
78
+ <a href="https://haveibeenpwned.com/API/Key">https://haveibeenpwned.com/API/Key</a> for the <code>stealerlogsbyemaildomain</code> endpoint.
79
+ The <code>apiKey</code> option here is not explicitly required, but direct requests made
80
+ without it will fail (unless you specify a <code>baseUrl</code> to a proxy that inserts
81
+ a valid API key on your behalf).</p>
82
+ </dd>
83
+ <dt><a href="#stealerLogsByEmail">stealerLogsByEmail(emailAddress, [options])</a> ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> | <code>Promise.&lt;null&gt;</code></dt>
84
+ <dd><p>Fetches all stealer log domains for an email address.</p>
85
+ <p>Returns an array of domains for which stealer logs contain entries for the
86
+ supplied email address.</p>
87
+ <p>🔑 <code>haveibeenpwned.com</code> requires an API key from
88
+ <a href="https://haveibeenpwned.com/API/Key">https://haveibeenpwned.com/API/Key</a> for the <code>stealerlogsbyemail</code> endpoint. The
89
+ <code>apiKey</code> option here is not explicitly required, but direct requests made
90
+ without it will fail (unless you specify a <code>baseUrl</code> to a proxy that inserts
91
+ a valid API key on your behalf).</p>
92
+ </dd>
93
+ <dt><a href="#stealerLogsByWebsiteDomain">stealerLogsByWebsiteDomain(websiteDomain, [options])</a> ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> | <code>Promise.&lt;null&gt;</code></dt>
94
+ <dd><p>Fetches all stealer log email addresses for a website domain.</p>
95
+ <p>The result is an array of strings representing email addresses found in
96
+ stealer logs for the specified website domain (e.g., &quot;example.com&quot;).</p>
97
+ <p>🔑 <code>haveibeenpwned.com</code> requires an API key from
98
+ <a href="https://haveibeenpwned.com/API/Key">https://haveibeenpwned.com/API/Key</a> for the <code>stealerlogsbywebsitedomain</code>
99
+ endpoint. The <code>apiKey</code> option here is not explicitly required, but direct
100
+ requests made without it will fail (unless you specify a <code>baseUrl</code> to a proxy
101
+ that inserts a valid API key on your behalf).</p>
102
+ </dd>
103
+ <dt><a href="#subscribedDomains">subscribedDomains([options])</a> ⇒ <code><a href="#subscribeddomain--object">Promise.&lt;Array.&lt;SubscribedDomain&gt;&gt;</a></code></dt>
104
+ <dd><p>Fetches all subscribed domains for your HIBP account.</p>
105
+ <p>Returns domains that have been successfully added to the Domain Search dashboard
106
+ after verifying control. Each domain includes metadata about breach counts and
107
+ the next renewal date, where available.</p>
108
+ <p>🔑 <code>haveibeenpwned.com</code> requires an API key from
109
+ <a href="https://haveibeenpwned.com/API/Key">https://haveibeenpwned.com/API/Key</a> for the <code>subscribeddomains</code> endpoint. The
110
+ <code>apiKey</code> option here is not explicitly required, but direct requests made
111
+ without it will fail (unless you specify a <code>baseUrl</code> to a proxy that inserts
112
+ a valid API key on your behalf).</p>
113
+ </dd>
57
114
  <dt><a href="#subscriptionStatus">subscriptionStatus([options])</a> ⇒ <code><a href="#subscriptionstatus--object">Promise.&lt;SubscriptionStatus&gt;</a></code></dt>
58
115
  <dd><p>Fetches the current status of your HIBP subscription (API key).</p>
59
116
  <p>🔑 <code>haveibeenpwned.com</code> requires an API key from
@@ -70,6 +127,10 @@ a valid API key on your behalf).</p>
70
127
  <dt><a href="#breach--object">Breach</a> : <code>object</code></dt>
71
128
  <dd><p>An object representing a breach.</p>
72
129
  </dd>
130
+ <dt><a href="#breach--objectedDomainsByEmailAlias">BreachedDomainsByEmailAlias</a> : <code>Object.&lt;string, Array.&lt;string&gt;&gt;</code></dt>
131
+ <dd><p>An object mapping an email alias (local-part before the &#39;@&#39;) to the list of
132
+ breach names that alias has appeared in for the specified domain.</p>
133
+ </dd>
73
134
  <dt><a href="#Paste">Paste</a> : <code>object</code></dt>
74
135
  <dd><p>An object representing a paste.</p>
75
136
  </dd>
@@ -80,6 +141,14 @@ hash prefix) to how many times it occurred in the Pwned Passwords repository.</p
80
141
  <dt><a href="#SearchResults">SearchResults</a> : <code>object</code></dt>
81
142
  <dd><p>An object representing search results.</p>
82
143
  </dd>
144
+ <dt><a href="#StealerLogDomainsByEmailAlias">StealerLogDomainsByEmailAlias</a> : <code>Object.&lt;string, Array.&lt;string&gt;&gt;</code></dt>
145
+ <dd><p>An object mapping an email alias (local-part before the &#39;@&#39;) to the list of
146
+ email domains that alias has appeared in within stealer logs for the specified
147
+ email domain.</p>
148
+ </dd>
149
+ <dt><a href="#SubscribedDomain">SubscribedDomain</a> : <code>object</code></dt>
150
+ <dd><p>An object representing a subscribed domain.</p>
151
+ </dd>
83
152
  <dt><a href="#subscriptionstatus--object">SubscriptionStatus</a> : <code>object</code></dt>
84
153
  <dd><p>An object representing the status of your HIBP subscription.</p>
85
154
  </dd>
@@ -101,6 +170,7 @@ with an Error
101
170
  | [options] | <code>object</code> | a configuration object |
102
171
  | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
103
172
  | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
173
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
104
174
  | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
105
175
 
106
176
  **Example**
@@ -140,6 +210,7 @@ an Error
140
210
  | [options.domain] | <code>string</code> | a domain by which to filter the results (default: all domains) |
141
211
  | [options.includeUnverified] | <code>boolean</code> | include "unverified" breaches in the results (default: true) |
142
212
  | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
213
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
143
214
  | [options.truncate] | <code>boolean</code> | truncate the results to only include the name of each breach (default: true) |
144
215
  | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
145
216
  | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
@@ -191,6 +262,50 @@ try {
191
262
  // ...
192
263
  }
193
264
  ```
265
+ <a name="breachedDomain"></a>
266
+
267
+ ## breachedDomain(domain, [options]) ⇒ [<code>Promise.&lt;BreachedDomainsByEmailAlias&gt;</code>](#breach--objectedDomainsByEmailAlias) \| <code>Promise.&lt;null&gt;</code>
268
+ Fetches all breached email addresses for a domain.
269
+
270
+ The result maps email aliases (the local-part before the '@') to an array of
271
+ breach names. For example, querying `example.com` could return an object like
272
+ `{ "john": ["Adobe"], "jane": ["Adobe", "Gawker"] }`, corresponding to
273
+ `john@example.com` and `jane@example.com`.
274
+
275
+ 🔑 `haveibeenpwned.com` requires an API key from
276
+ https://haveibeenpwned.com/API/Key for the `breacheddomain` endpoint. The
277
+ `apiKey` option here is not explicitly required, but direct requests made
278
+ without it will fail (unless you specify a `baseUrl` to a proxy that inserts
279
+ a valid API key on your behalf).
280
+
281
+ **Kind**: global function
282
+ **Returns**: [<code>Promise.&lt;BreachedDomainsByEmailAlias&gt;</code>](#breach--objectedDomainsByEmailAlias) \| <code>Promise.&lt;null&gt;</code> - a Promise which
283
+ resolves to an object mapping aliases to breach name arrays (or null if no
284
+ results were found), or rejects with an Error
285
+
286
+ | Param | Type | Description |
287
+ | --- | --- | --- |
288
+ | domain | <code>string</code> | the domain to query (e.g., "example.com") |
289
+ | [options] | <code>object</code> | a configuration object |
290
+ | [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
291
+ | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
292
+ | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
293
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
294
+ | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
295
+
296
+ **Example**
297
+ ```js
298
+ try {
299
+ const data = await breachedDomain("example.com", { apiKey: "my-api-key" });
300
+ if (data) {
301
+ // { "john": ["Adobe"], "jane": ["Adobe", "Gawker"] }
302
+ } else {
303
+ // no results
304
+ }
305
+ } catch (err) {
306
+ // ...
307
+ }
308
+ ```
194
309
  <a name="breaches"></a>
195
310
 
196
311
  ## breaches([options]) ⇒ <code><a href="#breach--object">Promise.&lt;Array.&lt;Breach&gt;&gt;</a></code>
@@ -206,6 +321,7 @@ objects (an empty array if no breaches were found), or rejects with an Error
206
321
  | [options.domain] | <code>string</code> | a domain by which to filter the results (default: all domains) |
207
322
  | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
208
323
  | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
324
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
209
325
  | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
210
326
 
211
327
  **Example**
@@ -249,6 +365,7 @@ Error
249
365
  | [options] | <code>object</code> | a configuration object |
250
366
  | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
251
367
  | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
368
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
252
369
  | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
253
370
 
254
371
  **Example**
@@ -264,6 +381,37 @@ try {
264
381
  // ...
265
382
  }
266
383
  ```
384
+ <a name="latestBreach"></a>
385
+
386
+ ## latestBreach([options]) ⇒ [<code>Promise.&lt;Breach&gt;</code>](#breach--object) \| <code>Promise.&lt;null&gt;</code>
387
+ Fetches the most recently added breach.
388
+
389
+ **Kind**: global function
390
+ **Returns**: [<code>Promise.&lt;Breach&gt;</code>](#breach--object) \| <code>Promise.&lt;null&gt;</code> - a Promise which resolves to an
391
+ object representing a breach (or null if no breach was found), or rejects
392
+ with an Error
393
+
394
+ | Param | Type | Description |
395
+ | --- | --- | --- |
396
+ | [options] | <code>object</code> | a configuration object |
397
+ | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
398
+ | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
399
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
400
+ | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
401
+
402
+ **Example**
403
+ ```js
404
+ try {
405
+ const data = await latestBreach();
406
+ if (data) {
407
+ // ...
408
+ } else {
409
+ // ...
410
+ }
411
+ } catch (err) {
412
+ // ...
413
+ }
414
+ ```
267
415
  <a name="pasteAccount"></a>
268
416
 
269
417
  ## pasteAccount(email, [options]) ⇒ <code><a href="#paste--object">Promise.&lt;Array.&lt;Paste&gt;&gt;</a></code> \| <code>Promise.&lt;null&gt;</code>
@@ -287,6 +435,7 @@ Error
287
435
  | [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
288
436
  | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
289
437
  | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
438
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
290
439
  | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
291
440
 
292
441
  **Example**
@@ -344,6 +493,7 @@ password data set, or rejects with an Error
344
493
  | [options.mode] | <code>&#x27;sha1&#x27;</code> \| <code>&#x27;ntlm&#x27;</code> | return SHA-1 or NTLM hashes (default: `sha1`) |
345
494
  | [options.baseUrl] | <code>string</code> | a custom base URL for the pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`) |
346
495
  | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
496
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
347
497
  | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
348
498
 
349
499
  **Example**
@@ -389,6 +539,7 @@ the password has been exposed in a breach, or rejects with an Error
389
539
  | [options.addPadding] | <code>boolean</code> | ask the remote API to add padding to the response to obscure the password prefix (default: `false`) |
390
540
  | [options.baseUrl] | <code>string</code> | a custom base URL for the pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`) |
391
541
  | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
542
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
392
543
  | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
393
544
 
394
545
  **Example**
@@ -438,6 +589,7 @@ rejects with an Error
438
589
  | [options.truncate] | <code>boolean</code> | truncate the breach results to only include the name of each breach (default: true) |
439
590
  | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
440
591
  | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
592
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
441
593
  | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
442
594
 
443
595
  **Example**
@@ -469,6 +621,212 @@ try {
469
621
  // ...
470
622
  }
471
623
  ```
624
+ <a name="stealerLogsByEmailDomain"></a>
625
+
626
+ ## stealerLogsByEmailDomain(emailDomain, [options]) ⇒ [<code>Promise.&lt;StealerLogDomainsByEmailAlias&gt;</code>](#StealerLogDomainsByEmailAlias) \| <code>Promise.&lt;null&gt;</code>
627
+ Fetches all stealer log email aliases for an email domain.
628
+
629
+ The result maps email aliases (the local-part before the '@') to an array of
630
+ email domains found in stealer logs. For example, querying `example.com`
631
+ could return an object like `{ "andy": ["netflix.com"], "jane": ["netflix.com",
632
+ "spotify.com"] }`, corresponding to `andy@example.com` and `jane@example.com`.
633
+
634
+ 🔑 `haveibeenpwned.com` requires an API key from
635
+ https://haveibeenpwned.com/API/Key for the `stealerlogsbyemaildomain` endpoint.
636
+ The `apiKey` option here is not explicitly required, but direct requests made
637
+ without it will fail (unless you specify a `baseUrl` to a proxy that inserts
638
+ a valid API key on your behalf).
639
+
640
+ **Kind**: global function
641
+ **Returns**: [<code>Promise.&lt;StealerLogDomainsByEmailAlias&gt;</code>](#StealerLogDomainsByEmailAlias) \| <code>Promise.&lt;null&gt;</code> - a Promise
642
+ which resolves to an object mapping aliases to stealer log email domain arrays
643
+ (or null if no results were found), or rejects with an Error
644
+
645
+ | Param | Type | Description |
646
+ | --- | --- | --- |
647
+ | emailDomain | <code>string</code> | the email domain to query (e.g., "example.com") |
648
+ | [options] | <code>object</code> | a configuration object |
649
+ | [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
650
+ | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
651
+ | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
652
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
653
+ | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
654
+
655
+ **Example**
656
+ ```js
657
+ try {
658
+ const data = await stealerLogsByEmailDomain("example.com", { apiKey: "my-api-key" });
659
+ if (data) {
660
+ // { "andy": ["netflix.com"], "jane": ["netflix.com", "spotify.com"] }
661
+ } else {
662
+ // no results
663
+ }
664
+ } catch (err) {
665
+ // ...
666
+ }
667
+ ```
668
+ <a name="stealerLogsByEmail"></a>
669
+
670
+ ## stealerLogsByEmail(emailAddress, [options]) ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> \| <code>Promise.&lt;null&gt;</code>
671
+ Fetches all stealer log domains for an email address.
672
+
673
+ Returns an array of domains for which stealer logs contain entries for the
674
+ supplied email address.
675
+
676
+ 🔑 `haveibeenpwned.com` requires an API key from
677
+ https://haveibeenpwned.com/API/Key for the `stealerlogsbyemail` endpoint. The
678
+ `apiKey` option here is not explicitly required, but direct requests made
679
+ without it will fail (unless you specify a `baseUrl` to a proxy that inserts
680
+ a valid API key on your behalf).
681
+
682
+ **Kind**: global function
683
+ **Returns**: <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> \| <code>Promise.&lt;null&gt;</code> - a Promise which resolves to an
684
+ array of domain strings (or null if none were found), or rejects with an
685
+ Error
686
+
687
+ | Param | Type | Description |
688
+ | --- | --- | --- |
689
+ | emailAddress | <code>string</code> | the email address to query |
690
+ | [options] | <code>object</code> | a configuration object |
691
+ | [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
692
+ | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
693
+ | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
694
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
695
+ | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
696
+
697
+ **Example**
698
+ ```js
699
+ try {
700
+ const data = await stealerLogsByEmail("foo@bar.com", { apiKey: "my-api-key" });
701
+ if (data) {
702
+ // ...
703
+ } else {
704
+ // ...
705
+ }
706
+ } catch (err) {
707
+ // ...
708
+ }
709
+ ```
710
+ **Example**
711
+ ```js
712
+ try {
713
+ const data = await stealerLogsByEmail("foo@bar.com", {
714
+ baseUrl: "https://my-hibp-proxy:8080",
715
+ });
716
+ if (data) {
717
+ // ...
718
+ } else {
719
+ // ...
720
+ }
721
+ } catch (err) {
722
+ // ...
723
+ }
724
+ ```
725
+ <a name="stealerLogsByWebsiteDomain"></a>
726
+
727
+ ## stealerLogsByWebsiteDomain(websiteDomain, [options]) ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> \| <code>Promise.&lt;null&gt;</code>
728
+ Fetches all stealer log email addresses for a website domain.
729
+
730
+ The result is an array of strings representing email addresses found in
731
+ stealer logs for the specified website domain (e.g., "example.com").
732
+
733
+ 🔑 `haveibeenpwned.com` requires an API key from
734
+ https://haveibeenpwned.com/API/Key for the `stealerlogsbywebsitedomain`
735
+ endpoint. The `apiKey` option here is not explicitly required, but direct
736
+ requests made without it will fail (unless you specify a `baseUrl` to a proxy
737
+ that inserts a valid API key on your behalf).
738
+
739
+ **Kind**: global function
740
+ **Returns**: <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> \| <code>Promise.&lt;null&gt;</code> - a Promise which resolves to an
741
+ array of email addresses (or null if no results were found), or rejects with
742
+ an Error
743
+
744
+ | Param | Type | Description |
745
+ | --- | --- | --- |
746
+ | websiteDomain | <code>string</code> | the website domain to query (e.g., "example.com") |
747
+ | [options] | <code>object</code> | a configuration object |
748
+ | [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
749
+ | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
750
+ | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
751
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
752
+ | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
753
+
754
+ **Example**
755
+ ```js
756
+ try {
757
+ const data = await stealerLogsByWebsiteDomain("example.com", { apiKey: "my-api-key" });
758
+ if (data) {
759
+ // ["andy@gmail.com", "jane@gmail.com"]
760
+ } else {
761
+ // no results
762
+ }
763
+ } catch (err) {
764
+ // ...
765
+ }
766
+ ```
767
+ **Example**
768
+ ```js
769
+ try {
770
+ const data = await stealerLogsByWebsiteDomain("example.com", {
771
+ baseUrl: "https://my-hibp-proxy:8080",
772
+ });
773
+ if (data) {
774
+ // ...
775
+ } else {
776
+ // ...
777
+ }
778
+ } catch (err) {
779
+ // ...
780
+ }
781
+ ```
782
+ <a name="subscribedDomains"></a>
783
+
784
+ ## subscribedDomains([options]) ⇒ <code><a href="#subscribeddomain--object">Promise.&lt;Array.&lt;SubscribedDomain&gt;&gt;</a></code>
785
+ Fetches all subscribed domains for your HIBP account.
786
+
787
+ Returns domains that have been successfully added to the Domain Search dashboard
788
+ after verifying control. Each domain includes metadata about breach counts and
789
+ the next renewal date, where available.
790
+
791
+ 🔑 `haveibeenpwned.com` requires an API key from
792
+ https://haveibeenpwned.com/API/Key for the `subscribeddomains` endpoint. The
793
+ `apiKey` option here is not explicitly required, but direct requests made
794
+ without it will fail (unless you specify a `baseUrl` to a proxy that inserts
795
+ a valid API key on your behalf).
796
+
797
+ **Kind**: global function
798
+ **Returns**: <code><a href="#subscribeddomain--object">Promise.&lt;Array.&lt;SubscribedDomain&gt;&gt;</a></code> - a Promise which resolves to an array of
799
+ subscribed domain objects (an empty array if none), or rejects with an Error
800
+
801
+ | Param | Type | Description |
802
+ | --- | --- | --- |
803
+ | [options] | <code>object</code> | a configuration object |
804
+ | [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
805
+ | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
806
+ | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
807
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
808
+ | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
809
+
810
+ **Example**
811
+ ```js
812
+ try {
813
+ const data = await subscribedDomains({ apiKey: "my-api-key" });
814
+ // ...
815
+ } catch (err) {
816
+ // ...
817
+ }
818
+ ```
819
+ **Example**
820
+ ```js
821
+ try {
822
+ const data = await subscribedDomains({
823
+ baseUrl: "https://my-hibp-proxy:8080",
824
+ });
825
+ // ...
826
+ } catch (err) {
827
+ // ...
828
+ }
829
+ ```
472
830
  <a name="subscriptionStatus"></a>
473
831
 
474
832
  ## subscriptionStatus([options]) ⇒ [<code>Promise.&lt;SubscriptionStatus&gt;</code>](#subscriptionstatus--object)
@@ -490,6 +848,7 @@ subscription status object, or rejects with an Error
490
848
  | [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
491
849
  | [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
492
850
  | [options.timeoutMs] | <code>number</code> | timeout for the request in milliseconds (default: none) |
851
+ | [options.signal] | <code>AbortSignal</code> | an AbortSignal to cancel the request (default: none) |
493
852
  | [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
494
853
 
495
854
  **Example**
@@ -540,6 +899,13 @@ An object representing a breach.
540
899
  | IsSubscriptionFree | <code>boolean</code> |
541
900
  | LogoPath | <code>string</code> |
542
901
 
902
+ <a name="BreachedDomainsByEmailAlias"></a>
903
+
904
+ ## BreachedDomainsByEmailAlias : <code>Object.&lt;string, Array.&lt;string&gt;&gt;</code>
905
+ An object mapping an email alias (local-part before the '@') to the list of
906
+ breach names that alias has appeared in for the specified domain.
907
+
908
+ **Kind**: global typedef
543
909
  <a name="Paste"></a>
544
910
 
545
911
  ## Paste : <code>object</code>
@@ -576,6 +942,30 @@ An object representing search results.
576
942
  | breaches | [<code>Array.&lt;Breach&gt;</code>](#breach--object) \| <code>null</code> |
577
943
  | pastes | [<code>Array.&lt;Paste&gt;</code>](#Paste) \| <code>null</code> |
578
944
 
945
+ <a name="StealerLogDomainsByEmailAlias"></a>
946
+
947
+ ## StealerLogDomainsByEmailAlias : <code>Object.&lt;string, Array.&lt;string&gt;&gt;</code>
948
+ An object mapping an email alias (local-part before the '@') to the list of
949
+ email domains that alias has appeared in within stealer logs for the specified
950
+ email domain.
951
+
952
+ **Kind**: global typedef
953
+ <a name="SubscribedDomain"></a>
954
+
955
+ ## SubscribedDomain : <code>object</code>
956
+ An object representing a subscribed domain.
957
+
958
+ **Kind**: global typedef
959
+ **Properties**
960
+
961
+ | Name | Type | Description |
962
+ | --- | --- | --- |
963
+ | DomainName | <code>string</code> | the fully qualified domain name |
964
+ | PwnCount | <code>number</code> \| <code>null</code> | total breached addresses at last search |
965
+ | PwnCountExcludingSpamLists | <code>number</code> \| <code>null</code> | breached addresses excluding spam lists at last search |
966
+ | PwnCountExcludingSpamListsAtLastSubscriptionRenewal | <code>number</code> \| <code>null</code> | breached addresses excluding spam lists at the time of last subscription renewal |
967
+ | NextSubscriptionRenewal | <code>string</code> \| <code>null</code> | ISO 8601 datetime when the current subscription ends |
968
+
579
969
  <a name="SubscriptionStatus"></a>
580
970
 
581
971
  ## SubscriptionStatus : <code>object</code>
@@ -591,4 +981,5 @@ An object representing the status of your HIBP subscription.
591
981
  | SubscribedUntil | <code>string</code> |
592
982
  | Rpm | <code>number</code> |
593
983
  | DomainSearchMaxBreachedAccounts | <code>number</code> |
984
+ | IncludesStealerLogs | <code>boolean</code> |
594
985
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Change Log
2
2
 
3
+ ## 15.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#562](https://github.com/wKovacs64/hibp/pull/562) [`ab40e4a`](https://github.com/wKovacs64/hibp/commit/ab40e4a1a63809376dde86cc5341055558344d3f) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Add `signal` option to all modules for user-controlled request cancellation via `AbortSignal`.
8
+
9
+ ## 15.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#543](https://github.com/wKovacs64/hibp/pull/543) [`70db0e1`](https://github.com/wKovacs64/hibp/commit/70db0e181d050b89eee34b326d6fb6247a5075bd) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Add `stealerLogsByEmailDomain` module.
14
+
15
+ - [#541](https://github.com/wKovacs64/hibp/pull/541) [`655b473`](https://github.com/wKovacs64/hibp/commit/655b473741b6ef358684c2c56c0bd4746ba0baf5) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Add `stealerLogsByEmail` module.
16
+
17
+ - [#542](https://github.com/wKovacs64/hibp/pull/542) [`682cff7`](https://github.com/wKovacs64/hibp/commit/682cff74c56322b348afab607da6786ff4c01691) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Add `stealerLogsByWebsiteDomain` module.
18
+
19
+ - [#539](https://github.com/wKovacs64/hibp/pull/539) [`a0c6e9a`](https://github.com/wKovacs64/hibp/commit/a0c6e9a01ad25931320e8dc79993faf11b127524) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Add `subscribedDomains` module.
20
+
21
+ - [#537](https://github.com/wKovacs64/hibp/pull/537) [`e15c6a7`](https://github.com/wKovacs64/hibp/commit/e15c6a7e053ded3e79ac407a33a213890d642454) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Add `latestBreach` module.
22
+
23
+ - [#538](https://github.com/wKovacs64/hibp/pull/538) [`f08af27`](https://github.com/wKovacs64/hibp/commit/f08af2795aac451d2d4abd9bca144214554b2575) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Add `breachedDomain` module.
24
+
25
+ ### Patch Changes
26
+
27
+ - [#535](https://github.com/wKovacs64/hibp/pull/535) [`d47d462`](https://github.com/wKovacs64/hibp/commit/d47d46252c96990e35e785239189ca4834a80b4a) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Add `IncludesStealerLogs` field to `SubscriptionStatus` interface and docs.
28
+
3
29
  ## 15.0.1
4
30
 
5
31
  ### Patch Changes
@@ -11,9 +37,7 @@
11
37
  ### Major Changes
12
38
 
13
39
  - [#509](https://github.com/wKovacs64/hibp/pull/509) [`e8d4986`](https://github.com/wKovacs64/hibp/commit/e8d498622020fe0c99847f915839ce382bf4d817) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Drop support for Node 18 and remove the CommonJS and UMD builds:
14
-
15
40
  - Drop support for Node.js 18 as it is [end-of-life](https://nodejs.org/en/about/releases/), making the new minimum Node.js runtime v20.19.0. Please upgrade your Node.js environment if necessary, or continue using a previous release if you are unable to upgrade your environment.
16
-
17
41
  - This also allowed us to drop the `fetch` polyfill that was only necessary in Node 18, which reduced the bundle size by approximately 33%! 📉 The library now officially has **zero dependencies**. 🎉
18
42
 
19
43
  - Remove the CommonJS build since [you can now `require()` ESM as of Node v20.19.0](https://github.com/nodejs/node/releases/tag/v20.19.0). **Consumers in a CommonJS environment should still be able to use the library as before** (given the appropriate Node.js version).
package/MIGRATION.md CHANGED
@@ -17,7 +17,6 @@
17
17
  #### 9.0.3 → 10.0.0
18
18
 
19
19
  - The production/minified versions of the browser build targets have been renamed:
20
-
21
20
  - ESM for Browsers (`<script type="module">`)
22
21
  - `dist/browser/hibp.esm.min.js` → `dist/browser/hibp.module.js`
23
22
  - UMD
@@ -38,7 +37,6 @@
38
37
 
39
38
  - Output files for all build targets have been consolidated under the `dist` directory. This should
40
39
  be transparent if you followed the documentation, but the changes are as follows:
41
-
42
40
  - CommonJS
43
41
  - `lib/hibp.js` → `dist/cjs/hibp.js`
44
42
  - ECMAScript Modules
package/README.md CHANGED
@@ -36,16 +36,23 @@ browser.
36
36
 
37
37
  ## Features (🔑 = [requires][api-key-blog-post] an [API key][get-api-key])
38
38
 
39
+ - Get the most recently added breach
39
40
  - Get a single breach event
40
41
  - Get all breaches for an account 🔑
42
+ - Get all breached email addresses for a domain 🔑
41
43
  - Get all breach events in the system
42
44
  - Get all data classes
43
45
  - Get all pastes for an account 🔑
44
46
  - [Securely][search-by-range] check a password to see if it has been exposed in a data breach
45
47
  - Check a SHA-1 or NTLM prefix to see if it has been exposed in a data breach
46
48
  - Search for an account in both breaches and pastes at the same time 🔑
49
+ - Get all stealer log domains for an email address 🔑
50
+ - Get all stealer log email aliases for an email domain 🔑
51
+ - Get all stealer log email addresses for a website domain 🔑
52
+ - Get all subscribed domains 🔑
47
53
  - Get your subscription status 🔑
48
54
  - All queries return a Promise
55
+ - Provide your own `AbortSignal` to cancel in-flight requests
49
56
  - Available server-side (e.g., Node.js) and client-side (browser)
50
57
  - Written in TypeScript, so all modules come fully typed
51
58
 
@@ -63,12 +70,18 @@ The following modules are available:
63
70
 
64
71
  - [breach](API.md#breach)
65
72
  - [breachedAccount](API.md#breachedaccount)
73
+ - [breachedDomain](API.md#breacheddomain)
66
74
  - [breaches](API.md#breaches)
67
75
  - [dataClasses](API.md#dataclasses)
76
+ - [latestBreach](API.md#latestbreach)
68
77
  - [pasteAccount](API.md#pasteaccount)
69
78
  - [pwnedPassword](API.md#pwnedpassword)
70
79
  - [pwnedPasswordRange](API.md#pwnedpasswordrange)
71
80
  - [search](API.md#search)
81
+ - [stealerLogsByEmail](API.md#stealerlogsbyemail)
82
+ - [stealerLogsByEmailDomain](API.md#stealerlogsbyemaildomain)
83
+ - [stealerLogsByWebsiteDomain](API.md#stealerlogsbywebsitedomain)
84
+ - [subscribedDomains](API.md#subscribeddomains)
72
85
  - [subscriptionStatus](API.md#subscriptionstatus)
73
86
 
74
87
  Please see the [API reference](API.md) for more detailed usage information and examples.
@@ -170,7 +183,7 @@ This module is distributed under the [MIT License][license].
170
183
  [ci-url]: https://github.com/wKovacs64/hibp/actions?query=workflow%3Aci
171
184
  [coverage-image]: https://img.shields.io/codecov/c/github/wKovacs64/hibp/main.svg?style=flat-square
172
185
  [coverage-url]: https://codecov.io/gh/wKovacs64/hibp/branch/main
173
- [deno]: https://deno.land/
186
+ [deno]: https://deno.com/
174
187
  [troy]: https://www.troyhunt.com
175
188
  [haveibeenpwned]: https://haveibeenpwned.com
176
189
  [haveibeenpwned-rate-limiting]: https://haveibeenpwned.com/API/v3#RateLimiting