hibp 15.1.0 → 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.
- package/API.md +15 -0
- package/CHANGELOG.md +6 -0
- package/README.md +1 -0
- package/dist/browser/hibp.module.js +2 -2
- package/dist/esm/api/base-fetch.d.ts +11 -0
- package/dist/esm/api/base-fetch.js +44 -0
- package/dist/esm/api/base-fetch.js.map +1 -0
- package/dist/esm/api/haveibeenpwned/fetch-from-api.js +12 -20
- package/dist/esm/api/haveibeenpwned/fetch-from-api.js.map +1 -1
- package/dist/esm/api/haveibeenpwned/package-info.d.ts +1 -1
- package/dist/esm/api/haveibeenpwned/package-info.js +1 -1
- package/dist/esm/api/pwnedpasswords/fetch-from-api.js +15 -10
- package/dist/esm/api/pwnedpasswords/fetch-from-api.js.map +1 -1
- package/dist/esm/breach.d.ts +5 -0
- package/dist/esm/breach.js +1 -0
- package/dist/esm/breach.js.map +1 -1
- package/dist/esm/breached-account.d.ts +5 -0
- package/dist/esm/breached-account.js +3 -1
- package/dist/esm/breached-account.js.map +1 -1
- package/dist/esm/breached-domain.d.ts +5 -0
- package/dist/esm/breached-domain.js +3 -1
- package/dist/esm/breached-domain.js.map +1 -1
- package/dist/esm/breaches.d.ts +5 -0
- package/dist/esm/breaches.js +3 -1
- package/dist/esm/breaches.js.map +1 -1
- package/dist/esm/data-classes.d.ts +5 -0
- package/dist/esm/data-classes.js +1 -0
- package/dist/esm/data-classes.js.map +1 -1
- package/dist/esm/latest-breach.d.ts +5 -0
- package/dist/esm/latest-breach.js +1 -0
- package/dist/esm/latest-breach.js.map +1 -1
- package/dist/esm/paste-account.d.ts +5 -0
- package/dist/esm/paste-account.js +1 -0
- package/dist/esm/paste-account.js.map +1 -1
- package/dist/esm/pwned-password-range.d.ts +5 -0
- package/dist/esm/pwned-password-range.js +3 -1
- package/dist/esm/pwned-password-range.js.map +1 -1
- package/dist/esm/pwned-password.d.ts +5 -0
- package/dist/esm/pwned-password.js +1 -2
- package/dist/esm/pwned-password.js.map +1 -1
- package/dist/esm/search.d.ts +5 -0
- package/dist/esm/search.js +4 -2
- package/dist/esm/search.js.map +1 -1
- package/dist/esm/stealer-logs-by-email-domain.d.ts +5 -0
- package/dist/esm/stealer-logs-by-email-domain.js +3 -1
- package/dist/esm/stealer-logs-by-email-domain.js.map +1 -1
- package/dist/esm/stealer-logs-by-email.d.ts +5 -0
- package/dist/esm/stealer-logs-by-email.js +3 -1
- package/dist/esm/stealer-logs-by-email.js.map +1 -1
- package/dist/esm/stealer-logs-by-website-domain.d.ts +5 -0
- package/dist/esm/stealer-logs-by-website-domain.js +3 -1
- package/dist/esm/stealer-logs-by-website-domain.js.map +1 -1
- package/dist/esm/subscribed-domains.d.ts +5 -0
- package/dist/esm/subscribed-domains.js +3 -1
- package/dist/esm/subscribed-domains.js.map +1 -1
- package/dist/esm/subscription-status.d.ts +5 -0
- package/dist/esm/subscription-status.js +1 -0
- package/dist/esm/subscription-status.js.map +1 -1
- package/package.json +15 -18
package/API.md
CHANGED
|
@@ -170,6 +170,7 @@ with an Error
|
|
|
170
170
|
| [options] | <code>object</code> | a configuration object |
|
|
171
171
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
172
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) |
|
|
173
174
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
174
175
|
|
|
175
176
|
**Example**
|
|
@@ -209,6 +210,7 @@ an Error
|
|
|
209
210
|
| [options.domain] | <code>string</code> | a domain by which to filter the results (default: all domains) |
|
|
210
211
|
| [options.includeUnverified] | <code>boolean</code> | include "unverified" breaches in the results (default: true) |
|
|
211
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) |
|
|
212
214
|
| [options.truncate] | <code>boolean</code> | truncate the results to only include the name of each breach (default: true) |
|
|
213
215
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
214
216
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
@@ -288,6 +290,7 @@ results were found), or rejects with an Error
|
|
|
288
290
|
| [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
|
|
289
291
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
290
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) |
|
|
291
294
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
292
295
|
|
|
293
296
|
**Example**
|
|
@@ -318,6 +321,7 @@ objects (an empty array if no breaches were found), or rejects with an Error
|
|
|
318
321
|
| [options.domain] | <code>string</code> | a domain by which to filter the results (default: all domains) |
|
|
319
322
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
320
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) |
|
|
321
325
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
322
326
|
|
|
323
327
|
**Example**
|
|
@@ -361,6 +365,7 @@ Error
|
|
|
361
365
|
| [options] | <code>object</code> | a configuration object |
|
|
362
366
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
363
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) |
|
|
364
369
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
365
370
|
|
|
366
371
|
**Example**
|
|
@@ -391,6 +396,7 @@ with an Error
|
|
|
391
396
|
| [options] | <code>object</code> | a configuration object |
|
|
392
397
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
393
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) |
|
|
394
400
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
395
401
|
|
|
396
402
|
**Example**
|
|
@@ -429,6 +435,7 @@ Error
|
|
|
429
435
|
| [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
|
|
430
436
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
431
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) |
|
|
432
439
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
433
440
|
|
|
434
441
|
**Example**
|
|
@@ -486,6 +493,7 @@ password data set, or rejects with an Error
|
|
|
486
493
|
| [options.mode] | <code>'sha1'</code> \| <code>'ntlm'</code> | return SHA-1 or NTLM hashes (default: `sha1`) |
|
|
487
494
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`) |
|
|
488
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) |
|
|
489
497
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
490
498
|
|
|
491
499
|
**Example**
|
|
@@ -531,6 +539,7 @@ the password has been exposed in a breach, or rejects with an Error
|
|
|
531
539
|
| [options.addPadding] | <code>boolean</code> | ask the remote API to add padding to the response to obscure the password prefix (default: `false`) |
|
|
532
540
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`) |
|
|
533
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) |
|
|
534
543
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
535
544
|
|
|
536
545
|
**Example**
|
|
@@ -580,6 +589,7 @@ rejects with an Error
|
|
|
580
589
|
| [options.truncate] | <code>boolean</code> | truncate the breach results to only include the name of each breach (default: true) |
|
|
581
590
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
582
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) |
|
|
583
593
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
584
594
|
|
|
585
595
|
**Example**
|
|
@@ -639,6 +649,7 @@ which resolves to an object mapping aliases to stealer log email domain arrays
|
|
|
639
649
|
| [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
|
|
640
650
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
641
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) |
|
|
642
653
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
643
654
|
|
|
644
655
|
**Example**
|
|
@@ -680,6 +691,7 @@ Error
|
|
|
680
691
|
| [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
|
|
681
692
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
682
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) |
|
|
683
695
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
684
696
|
|
|
685
697
|
**Example**
|
|
@@ -736,6 +748,7 @@ an Error
|
|
|
736
748
|
| [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
|
|
737
749
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
738
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) |
|
|
739
752
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
740
753
|
|
|
741
754
|
**Example**
|
|
@@ -791,6 +804,7 @@ subscribed domain objects (an empty array if none), or rejects with an Error
|
|
|
791
804
|
| [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
|
|
792
805
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
793
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) |
|
|
794
808
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
795
809
|
|
|
796
810
|
**Example**
|
|
@@ -834,6 +848,7 @@ subscription status object, or rejects with an Error
|
|
|
834
848
|
| [options.apiKey] | <code>string</code> | an API key from https://haveibeenpwned.com/API/Key (default: undefined) |
|
|
835
849
|
| [options.baseUrl] | <code>string</code> | a custom base URL for the haveibeenpwned.com API endpoints (default: `https://haveibeenpwned.com/api/v3`) |
|
|
836
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) |
|
|
837
852
|
| [options.userAgent] | <code>string</code> | a custom string to send as the User-Agent field in the request headers (default: `hibp <version>`) |
|
|
838
853
|
|
|
839
854
|
**Example**
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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
|
+
|
|
3
9
|
## 15.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -52,6 +52,7 @@ browser.
|
|
|
52
52
|
- Get all subscribed domains 🔑
|
|
53
53
|
- Get your subscription status 🔑
|
|
54
54
|
- All queries return a Promise
|
|
55
|
+
- Provide your own `AbortSignal` to cancel in-flight requests
|
|
55
56
|
- Available server-side (e.g., Node.js) and client-side (browser)
|
|
56
57
|
- Written in TypeScript, so all modules come fully typed
|
|
57
58
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`).filter(Boolean).reduce((
|
|
1
|
+
var w="hibp",P="15.2.0";async function g({baseUrl:e,endpoint:t,headers:r,timeoutMs:s,signal:n,userAgent:o,queryParams:a}){let i={headers:I(o,r),signal:v(s,n)},c=M(e,t,a);return fetch(c,i)}function M(e,t,r){let s=e.replace(/\/$/g,""),n=t.startsWith("/")?t:`/${t}`,o=new URL(`${s}${n}`);if(r)for(let[a,i]of Object.entries(r))o.searchParams.set(a,i);return o.toString()}function I(e,t){let r={...t};return e?r["User-Agent"]=e:typeof navigator>"u"&&(r["User-Agent"]=`${w} ${P}`),r}function v(e,t){let r=[];if(e&&r.push(AbortSignal.timeout(e)),t&&r.push(t),r.length!==0)return r.length===1?r[0]:AbortSignal.any(r)}var b={status:400,statusText:"Bad request \u2014 the account does not comply with an acceptable format."},S={status:401,body:`Your request to the API couldn't be authorised. Check you have the right value in the "hibp-api-key" header, refer to the documentation for more: https://haveibeenpwned.com/API/v3#Authorisation`},f={status:403,statusText:"Forbidden - access denied."};var U={status:404},x={headers:new Map([["retry-after","2"]]),status:429,body:{statusCode:429,message:"Rate limit is exceeded. Try again in 2 seconds."}};var d=class extends Error{retryAfterSeconds;constructor(t,r,s){super(r,s),this.name=this.constructor.name,this.retryAfterSeconds=typeof t=="string"?Number.parseInt(t,10):void 0}};function K(e){return`Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ${e})`}async function m(e,t={}){let{apiKey:r,baseUrl:s="https://haveibeenpwned.com/api/v3",timeoutMs:n,signal:o,userAgent:a}=t,i={};r&&(i["HIBP-API-Key"]=r);let c=await g({baseUrl:s,endpoint:e,headers:i,timeoutMs:n,signal:o,userAgent:a});if(c.ok)return c.json();switch(c.status){case b.status:throw new Error(b.statusText);case S.status:{let p=await c.text();throw new Error(p)}case f.status:{let p=c.headers.get("cf-ray");throw p?new Error(K(p)):new Error(f.statusText)}case U.status:return null;case x.status:{let p=await c.json(),u=c.headers.get("retry-after");throw new d(u,p.message)}default:throw new Error(c.statusText)}}function C(e,t={}){return m(`/breach/${encodeURIComponent(e)}`,t)}function h(e,t={}){let{apiKey:r,domain:s,includeUnverified:n=!0,timeoutMs:o,signal:a,truncate:i=!0,baseUrl:c,userAgent:p}=t,u=`/breachedaccount/${encodeURIComponent(e)}?`,l=[];return s&&l.push(`domain=${encodeURIComponent(s)}`),n||l.push("includeUnverified=false"),i||l.push("truncateResponse=false"),m(`${u}${l.join("&")}`,{apiKey:r,baseUrl:c,timeoutMs:o,signal:a,userAgent:p})}function T(e,t={}){let{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a}=t,i=`/breacheddomain/${encodeURIComponent(e)}`;return m(i,{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a})}function F(e={}){let{domain:t,baseUrl:r,timeoutMs:s,signal:n,userAgent:o}=e,a="/breaches?",i=[];return t&&i.push(`domain=${encodeURIComponent(t)}`),m(`${a}${i.join("&")}`,{baseUrl:r,timeoutMs:s,signal:n,userAgent:o})}function $(e={}){return m("/dataclasses",e)}function j(e={}){return m("/latestbreach",e)}function y(e,t={}){return m(`/pasteaccount/${encodeURIComponent(e)}`,t)}var E={status:400,body:"The hash prefix was not in a valid format"};async function B(e,t={}){let{baseUrl:r="https://api.pwnedpasswords.com",timeoutMs:s,signal:n,userAgent:o,addPadding:a=!1,mode:i="sha1"}=t,c={};a&&(c["Add-Padding"]="true");let p=await g({baseUrl:r,endpoint:e,headers:c,timeoutMs:s,signal:n,userAgent:o,queryParams:{mode:i}});if(p.ok)return p.text();if(p.status===E.status){let u=await p.text();throw new Error(u)}throw new Error(p.statusText)}async function A(e,t={}){let{baseUrl:r,timeoutMs:s,signal:n,userAgent:o,addPadding:a=!1,mode:i="sha1"}=t;return(await B(`/range/${encodeURIComponent(e)}`,{baseUrl:r,timeoutMs:s,signal:n,userAgent:o,addPadding:a,mode:i})).split(`
|
|
2
|
+
`).filter(Boolean).reduce((u,l)=>{let[R,D]=l.split(":");return u[R]=Number.parseInt(D,10),u},{})}async function L(e,t={}){let[r,s]=await O(e);return(await A(r,t))[s]||0}async function O(e){if(typeof crypto=="object"&&crypto.subtle){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-1",t),n=Array.from(new Uint8Array(r)).map(o=>o.toString(16).padStart(2,"0")).join("").toUpperCase();return[n.slice(0,5),n.slice(5)]}throw new Error("The Web Crypto API is not available in this environment.")}async function N(e,t={}){let{apiKey:r,domain:s,truncate:n=!0,baseUrl:o,timeoutMs:a,signal:i,userAgent:c}=t,[p,u]=await Promise.all([h(e,{apiKey:r,domain:s,truncate:n,baseUrl:o,timeoutMs:a,signal:i,userAgent:c}),/^.+@.+$/.test(e)?y(e,{apiKey:r,baseUrl:o,timeoutMs:a,signal:i,userAgent:c}):null]);return{breaches:p,pastes:u}}function _(e,t={}){let{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a}=t,i=`/stealerlogsbyemail/${encodeURIComponent(e)}`;return m(i,{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a})}function H(e,t={}){let{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a}=t,i=`/stealerlogsbyemaildomain/${encodeURIComponent(e)}`;return m(i,{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a})}function k(e,t={}){let{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a}=t,i=`/stealerlogsbywebsitedomain/${encodeURIComponent(e)}`;return m(i,{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a})}function W(e={}){let{apiKey:t,baseUrl:r,timeoutMs:s,signal:n,userAgent:o}=e;return m("/subscribeddomains",{apiKey:t,baseUrl:r,timeoutMs:s,signal:n,userAgent:o})}async function q(e={}){return m("/subscription/status",e)}export{d as RateLimitError,C as breach,h as breachedAccount,T as breachedDomain,F as breaches,$ as dataClasses,j as latestBreach,y as pasteAccount,L as pwnedPassword,A as pwnedPasswordRange,N as search,_ as stealerLogsByEmail,H as stealerLogsByEmailDomain,k as stealerLogsByWebsiteDomain,W as subscribedDomains,q as subscriptionStatus};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function baseFetch({ baseUrl, endpoint, headers, timeoutMs, signal, userAgent, queryParams, }: {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
endpoint: string;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
userAgent?: string;
|
|
8
|
+
queryParams?: Record<string, string>;
|
|
9
|
+
}): Promise<Response>;
|
|
10
|
+
export declare function buildUrl(baseUrl: string, endpoint: string, queryParams?: Record<string, string>): string;
|
|
11
|
+
export declare function buildHeaders(userAgent?: string, extra?: Record<string, string>): Record<string, string>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @ts-ignore - package-info.js is generated
|
|
2
|
+
import { PACKAGE_NAME, PACKAGE_VERSION } from './haveibeenpwned/package-info.js';
|
|
3
|
+
export async function baseFetch({ baseUrl, endpoint, headers, timeoutMs, signal, userAgent, queryParams, }) {
|
|
4
|
+
const requestInit = {
|
|
5
|
+
headers: buildHeaders(userAgent, headers),
|
|
6
|
+
signal: buildSignal(timeoutMs, signal),
|
|
7
|
+
};
|
|
8
|
+
const url = buildUrl(baseUrl, endpoint, queryParams);
|
|
9
|
+
return fetch(url, requestInit);
|
|
10
|
+
}
|
|
11
|
+
export function buildUrl(baseUrl, endpoint, queryParams) {
|
|
12
|
+
const base = baseUrl.replace(/\/$/g, '');
|
|
13
|
+
const normalizedEndpoint = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
|
|
14
|
+
const url = new URL(`${base}${normalizedEndpoint}`);
|
|
15
|
+
if (queryParams) {
|
|
16
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
17
|
+
url.searchParams.set(key, value);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return url.toString();
|
|
21
|
+
}
|
|
22
|
+
export function buildHeaders(userAgent, extra) {
|
|
23
|
+
const headers = { ...extra };
|
|
24
|
+
if (userAgent) {
|
|
25
|
+
headers['User-Agent'] = userAgent;
|
|
26
|
+
}
|
|
27
|
+
else if (typeof navigator === 'undefined') {
|
|
28
|
+
headers['User-Agent'] = `${PACKAGE_NAME} ${PACKAGE_VERSION}`;
|
|
29
|
+
}
|
|
30
|
+
return headers;
|
|
31
|
+
}
|
|
32
|
+
function buildSignal(timeoutMs, signal) {
|
|
33
|
+
const signals = [];
|
|
34
|
+
if (timeoutMs)
|
|
35
|
+
signals.push(AbortSignal.timeout(timeoutMs));
|
|
36
|
+
if (signal)
|
|
37
|
+
signals.push(signal);
|
|
38
|
+
if (signals.length === 0)
|
|
39
|
+
return undefined;
|
|
40
|
+
if (signals.length === 1)
|
|
41
|
+
return signals[0];
|
|
42
|
+
return AbortSignal.any(signals);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=base-fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-fetch.js","sourceRoot":"","sources":["../../../src/api/base-fetch.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEjF,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,EAC9B,OAAO,EACP,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,SAAS,EACT,WAAW,GASZ;IACC,MAAM,WAAW,GAAgB;QAC/B,OAAO,EAAE,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC;QACzC,MAAM,EAAE,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC;KACvC,CAAC;IAEF,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAErD,OAAO,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,OAAe,EACf,QAAgB,EAChB,WAAoC;IAEpC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC;IAChF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,kBAAkB,EAAE,CAAC,CAAC;IAEpD,IAAI,WAAW,EAAE,CAAC;QAChB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACvD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,SAAkB,EAClB,KAA8B;IAE9B,MAAM,OAAO,GAA2B,EAAE,GAAG,KAAK,EAAE,CAAC;IAErD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;IACpC,CAAC;SAAM,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;QAC5C,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,YAAY,IAAI,eAAe,EAAE,CAAC;IAC/D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,WAAW,CAAC,SAAkB,EAAE,MAAoB;IAC3D,MAAM,OAAO,GAAkB,EAAE,CAAC;IAElC,IAAI,SAAS;QAAE,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5D,IAAI,MAAM;QAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEjC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IAE5C,OAAO,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { PACKAGE_NAME, PACKAGE_VERSION } from './package-info.js';
|
|
1
|
+
import { baseFetch } from '../base-fetch.js';
|
|
3
2
|
import { BAD_REQUEST, UNAUTHORIZED, FORBIDDEN, NOT_FOUND, TOO_MANY_REQUESTS } from './responses.js';
|
|
4
3
|
/**
|
|
5
4
|
* Custom error thrown when the haveibeenpwned.com API responds with 429 Too
|
|
@@ -19,9 +18,7 @@ export class RateLimitError extends Error {
|
|
|
19
18
|
super(message, options);
|
|
20
19
|
this.name = this.constructor.name;
|
|
21
20
|
this.retryAfterSeconds =
|
|
22
|
-
typeof retryAfter === 'string'
|
|
23
|
-
? Number.parseInt(retryAfter, 10) /* c8 ignore start */
|
|
24
|
-
: undefined; /* c8 ignore stop */
|
|
21
|
+
typeof retryAfter === 'string' ? Number.parseInt(retryAfter, 10) : undefined;
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
function blockedWithRayId(rayId) {
|
|
@@ -48,6 +45,7 @@ function blockedWithRayId(rayId) {
|
|
|
48
45
|
* `https://haveibeenpwned.com/api/v3`)
|
|
49
46
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
50
47
|
* (default: none)
|
|
48
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
51
49
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
52
50
|
* field in the request headers (default: `hibp <version>`)
|
|
53
51
|
* @returns {Promise<ApiData>} a Promise which resolves to the data resulting
|
|
@@ -55,24 +53,18 @@ function blockedWithRayId(rayId) {
|
|
|
55
53
|
* Error
|
|
56
54
|
*/
|
|
57
55
|
export async function fetchFromApi(endpoint, options = {}) {
|
|
58
|
-
const { apiKey, baseUrl = 'https://haveibeenpwned.com/api/v3', timeoutMs, userAgent } = options;
|
|
56
|
+
const { apiKey, baseUrl = 'https://haveibeenpwned.com/api/v3', timeoutMs, signal, userAgent, } = options;
|
|
59
57
|
const headers = {};
|
|
60
|
-
if (apiKey)
|
|
58
|
+
if (apiKey)
|
|
61
59
|
headers['HIBP-API-Key'] = apiKey;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
// Provide a default User-Agent when running outside the browser
|
|
67
|
-
if (!userAgent && typeof navigator === 'undefined') {
|
|
68
|
-
headers['User-Agent'] = `${PACKAGE_NAME} ${PACKAGE_VERSION}`;
|
|
69
|
-
}
|
|
70
|
-
const config = {
|
|
60
|
+
const response = await baseFetch({
|
|
61
|
+
baseUrl,
|
|
62
|
+
endpoint,
|
|
71
63
|
headers,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
timeoutMs,
|
|
65
|
+
signal,
|
|
66
|
+
userAgent,
|
|
67
|
+
});
|
|
76
68
|
if (response.ok)
|
|
77
69
|
return response.json();
|
|
78
70
|
switch (response.status) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-from-api.js","sourceRoot":"","sources":["../../../../src/api/haveibeenpwned/fetch-from-api.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"fetch-from-api.js","sourceRoot":"","sources":["../../../../src/api/haveibeenpwned/fetch-from-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGpG;;;;;;GAMG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC;;;;OAIG;IACI,iBAAiB,CAAqB;IAE7C,YACE,UAAsC,EACtC,OAA2B,EAC3B,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,iBAAiB;YACpB,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjF,CAAC;CACF;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,OAAO,0EAA0E,KAAK,GAAG,CAAC;AAC5F,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,QAAgB,EAChB,UAMI,EAAE;IAEN,MAAM,EACJ,MAAM,EACN,OAAO,GAAG,mCAAmC,EAC7C,SAAS,EACT,MAAM,EACN,SAAS,GACV,GAAG,OAAO,CAAC;IAEZ,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,IAAI,MAAM;QAAE,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC;IAE7C,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC;QAC/B,OAAO;QACP,QAAQ;QACR,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,EAAE;QAAE,OAAO,QAAQ,CAAC,IAAI,EAAsB,CAAC;IAE5D,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC;QACxB,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC1C,CAAC;QACD,KAAK,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;YACzB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YACtB,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC7C,IAAI,KAAK;gBAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;QACD,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YACtB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;YAC9B,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAyB,CAAC;YAC7D,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YACvD,MAAM,IAAI,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const PACKAGE_NAME = "hibp";
|
|
2
|
-
export declare const PACKAGE_VERSION = "15.
|
|
2
|
+
export declare const PACKAGE_VERSION = "15.2.0";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { baseFetch } from '../base-fetch.js';
|
|
1
2
|
import { BAD_REQUEST } from './responses.js';
|
|
2
3
|
/**
|
|
3
4
|
* Fetches data from the supplied API endpoint.
|
|
@@ -13,6 +14,7 @@ import { BAD_REQUEST } from './responses.js';
|
|
|
13
14
|
* pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)
|
|
14
15
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
15
16
|
* (default: none)
|
|
17
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
16
18
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
17
19
|
* field in the request headers (default: `hibp <version>`)
|
|
18
20
|
* @param {boolean} [options.addPadding] ask the remote API to add padding to
|
|
@@ -23,16 +25,19 @@ import { BAD_REQUEST } from './responses.js';
|
|
|
23
25
|
* from the query, or rejects with an Error
|
|
24
26
|
*/
|
|
25
27
|
export async function fetchFromApi(endpoint, options = {}) {
|
|
26
|
-
const { baseUrl = 'https://api.pwnedpasswords.com', timeoutMs, userAgent, addPadding = false, mode = 'sha1', } = options;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
const { baseUrl = 'https://api.pwnedpasswords.com', timeoutMs, signal, userAgent, addPadding = false, mode = 'sha1', } = options;
|
|
29
|
+
const headers = {};
|
|
30
|
+
if (addPadding)
|
|
31
|
+
headers['Add-Padding'] = 'true';
|
|
32
|
+
const response = await baseFetch({
|
|
33
|
+
baseUrl,
|
|
34
|
+
endpoint,
|
|
35
|
+
headers,
|
|
36
|
+
timeoutMs,
|
|
37
|
+
signal,
|
|
38
|
+
userAgent,
|
|
39
|
+
queryParams: { mode },
|
|
40
|
+
});
|
|
36
41
|
if (response.ok)
|
|
37
42
|
return response.text();
|
|
38
43
|
if (response.status === BAD_REQUEST.status) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-from-api.js","sourceRoot":"","sources":["../../../../src/api/pwnedpasswords/fetch-from-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"fetch-from-api.js","sourceRoot":"","sources":["../../../../src/api/pwnedpasswords/fetch-from-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,QAAgB,EAChB,UAOI,EAAE;IAEN,MAAM,EACJ,OAAO,GAAG,gCAAgC,EAC1C,SAAS,EACT,MAAM,EACN,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,MAAM,GACd,GAAG,OAAO,CAAC;IAEZ,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,IAAI,UAAU;QAAE,OAAO,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC;IAEhD,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC;QAC/B,OAAO;QACP,QAAQ;QACR,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;QACT,WAAW,EAAE,EAAE,IAAI,EAAE;KACtB,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,EAAE;QAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IAExC,IAAI,QAAQ,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/esm/breach.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ import type { Breach } from './api/haveibeenpwned/types.js';
|
|
|
31
31
|
* `https://haveibeenpwned.com/api/v3`)
|
|
32
32
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
33
33
|
* (default: none)
|
|
34
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
34
35
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
35
36
|
* field in the request headers (default: `hibp <version>`)
|
|
36
37
|
* @returns {(Promise<Breach>|Promise<null>)} a Promise which resolves to an
|
|
@@ -58,6 +59,10 @@ export declare function breach(breachName: string, options?: {
|
|
|
58
59
|
* timeout for the request in milliseconds (default: none)
|
|
59
60
|
*/
|
|
60
61
|
timeoutMs?: number;
|
|
62
|
+
/**
|
|
63
|
+
* an AbortSignal to cancel the request (default: none)
|
|
64
|
+
*/
|
|
65
|
+
signal?: AbortSignal;
|
|
61
66
|
/**
|
|
62
67
|
* a custom string to send as the User-Agent field in the request headers
|
|
63
68
|
* (default: `hibp <version>`)
|
package/dist/esm/breach.js
CHANGED
|
@@ -31,6 +31,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
31
31
|
* `https://haveibeenpwned.com/api/v3`)
|
|
32
32
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
33
33
|
* (default: none)
|
|
34
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
34
35
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
35
36
|
* field in the request headers (default: `hibp <version>`)
|
|
36
37
|
* @returns {(Promise<Breach>|Promise<null>)} a Promise which resolves to an
|
package/dist/esm/breach.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breach.js","sourceRoot":"","sources":["../../src/breach.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH
|
|
1
|
+
{"version":3,"file":"breach.js","sourceRoot":"","sources":["../../src/breach.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,MAAM,CACpB,UAAkB,EAClB,UAmBI,EAAE;IAEN,OAAO,YAAY,CACjB,WAAW,kBAAkB,CAAC,UAAU,CAAC,EAAE,EAC3C,OAAO,CACkB,CAAC;AAC9B,CAAC"}
|
|
@@ -18,6 +18,7 @@ import type { Breach } from './api/haveibeenpwned/types.js';
|
|
|
18
18
|
* the results (default: true)
|
|
19
19
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
20
20
|
* (default: none)
|
|
21
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
21
22
|
* @param {boolean} [options.truncate] truncate the results to only include
|
|
22
23
|
* the name of each breach (default: true)
|
|
23
24
|
* @param {string} [options.baseUrl] a custom base URL for the
|
|
@@ -87,6 +88,10 @@ export declare function breachedAccount(account: string, options?: {
|
|
|
87
88
|
* timeout for the request in milliseconds (default: none)
|
|
88
89
|
*/
|
|
89
90
|
timeoutMs?: number;
|
|
91
|
+
/**
|
|
92
|
+
* an AbortSignal to cancel the request (default: none)
|
|
93
|
+
*/
|
|
94
|
+
signal?: AbortSignal;
|
|
90
95
|
/**
|
|
91
96
|
* truncate the results to only include the name of each breach (default:
|
|
92
97
|
* true)
|
|
@@ -18,6 +18,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
18
18
|
* the results (default: true)
|
|
19
19
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
20
20
|
* (default: none)
|
|
21
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
21
22
|
* @param {boolean} [options.truncate] truncate the results to only include
|
|
22
23
|
* the name of each breach (default: true)
|
|
23
24
|
* @param {string} [options.baseUrl] a custom base URL for the
|
|
@@ -71,7 +72,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
71
72
|
* }
|
|
72
73
|
*/
|
|
73
74
|
export function breachedAccount(account, options = {}) {
|
|
74
|
-
const { apiKey, domain, includeUnverified = true, timeoutMs, truncate = true, baseUrl, userAgent, } = options;
|
|
75
|
+
const { apiKey, domain, includeUnverified = true, timeoutMs, signal, truncate = true, baseUrl, userAgent, } = options;
|
|
75
76
|
const endpoint = `/breachedaccount/${encodeURIComponent(account)}?`;
|
|
76
77
|
const params = [];
|
|
77
78
|
if (domain) {
|
|
@@ -87,6 +88,7 @@ export function breachedAccount(account, options = {}) {
|
|
|
87
88
|
apiKey,
|
|
88
89
|
baseUrl,
|
|
89
90
|
timeoutMs,
|
|
91
|
+
signal,
|
|
90
92
|
userAgent,
|
|
91
93
|
});
|
|
92
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breached-account.js","sourceRoot":"","sources":["../../src/breached-account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"breached-account.js","sourceRoot":"","sources":["../../src/breached-account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,UAoCI,EAAE;IAEN,MAAM,EACJ,MAAM,EACN,MAAM,EACN,iBAAiB,GAAG,IAAI,EACxB,SAAS,EACT,MAAM,EACN,QAAQ,GAAG,IAAI,EACf,OAAO,EACP,SAAS,GACV,GAAG,OAAO,CAAC;IACZ,MAAM,QAAQ,GAAG,oBAAoB,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC;IACpE,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,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,GAAG,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;QACpD,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAA6B,CAAC;AACjC,CAAC"}
|
|
@@ -28,6 +28,7 @@ import type { BreachedDomainsByEmailAlias } from './api/haveibeenpwned/types.js'
|
|
|
28
28
|
* `https://haveibeenpwned.com/api/v3`)
|
|
29
29
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
30
30
|
* (default: none)
|
|
31
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
31
32
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
32
33
|
* field in the request headers (default: `hibp <version>`)
|
|
33
34
|
* @returns {(Promise<BreachedDomainsByEmailAlias> | Promise<null>)} a Promise which
|
|
@@ -59,6 +60,10 @@ export declare function breachedDomain(domain: string, options?: {
|
|
|
59
60
|
* timeout for the request in milliseconds (default: none)
|
|
60
61
|
*/
|
|
61
62
|
timeoutMs?: number;
|
|
63
|
+
/**
|
|
64
|
+
* an AbortSignal to cancel the request (default: none)
|
|
65
|
+
*/
|
|
66
|
+
signal?: AbortSignal;
|
|
62
67
|
/**
|
|
63
68
|
* a custom string to send as the User-Agent field in the request headers
|
|
64
69
|
* (default: `hibp <version>`)
|
|
@@ -28,6 +28,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
28
28
|
* `https://haveibeenpwned.com/api/v3`)
|
|
29
29
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
30
30
|
* (default: none)
|
|
31
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
31
32
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
32
33
|
* field in the request headers (default: `hibp <version>`)
|
|
33
34
|
* @returns {(Promise<BreachedDomainsByEmailAlias> | Promise<null>)} a Promise which
|
|
@@ -46,12 +47,13 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
46
47
|
* }
|
|
47
48
|
*/
|
|
48
49
|
export function breachedDomain(domain, options = {}) {
|
|
49
|
-
const { apiKey, baseUrl, timeoutMs, userAgent } = options;
|
|
50
|
+
const { apiKey, baseUrl, timeoutMs, signal, userAgent } = options;
|
|
50
51
|
const endpoint = `/breacheddomain/${encodeURIComponent(domain)}`;
|
|
51
52
|
return fetchFromApi(endpoint, {
|
|
52
53
|
apiKey,
|
|
53
54
|
baseUrl,
|
|
54
55
|
timeoutMs,
|
|
56
|
+
signal,
|
|
55
57
|
userAgent,
|
|
56
58
|
});
|
|
57
59
|
}
|
|
@@ -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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,UAuBI,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"}
|
package/dist/esm/breaches.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { Breach } from './api/haveibeenpwned/types.js';
|
|
|
10
10
|
* `https://haveibeenpwned.com/api/v3`)
|
|
11
11
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
12
12
|
* (default: none)
|
|
13
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
13
14
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
14
15
|
* field in the request headers (default: `hibp <version>`)
|
|
15
16
|
* @returns {Promise<Breach[]>} a Promise which resolves to an array of breach
|
|
@@ -51,6 +52,10 @@ export declare function breaches(options?: {
|
|
|
51
52
|
* timeout for the request in milliseconds (default: none)
|
|
52
53
|
*/
|
|
53
54
|
timeoutMs?: number;
|
|
55
|
+
/**
|
|
56
|
+
* an AbortSignal to cancel the request (default: none)
|
|
57
|
+
*/
|
|
58
|
+
signal?: AbortSignal;
|
|
54
59
|
/**
|
|
55
60
|
* a custom string to send as the User-Agent field in the request headers
|
|
56
61
|
* (default: `hibp <version>`)
|
package/dist/esm/breaches.js
CHANGED
|
@@ -10,6 +10,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
10
10
|
* `https://haveibeenpwned.com/api/v3`)
|
|
11
11
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
12
12
|
* (default: none)
|
|
13
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
13
14
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
14
15
|
* field in the request headers (default: `hibp <version>`)
|
|
15
16
|
* @returns {Promise<Breach[]>} a Promise which resolves to an array of breach
|
|
@@ -38,7 +39,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
38
39
|
* }
|
|
39
40
|
*/
|
|
40
41
|
export function breaches(options = {}) {
|
|
41
|
-
const { domain, baseUrl, timeoutMs, userAgent } = options;
|
|
42
|
+
const { domain, baseUrl, timeoutMs, signal, userAgent } = options;
|
|
42
43
|
const endpoint = '/breaches?';
|
|
43
44
|
const params = [];
|
|
44
45
|
if (domain) {
|
|
@@ -47,6 +48,7 @@ export function breaches(options = {}) {
|
|
|
47
48
|
return fetchFromApi(`${endpoint}${params.join('&')}`, {
|
|
48
49
|
baseUrl,
|
|
49
50
|
timeoutMs,
|
|
51
|
+
signal,
|
|
50
52
|
userAgent,
|
|
51
53
|
});
|
|
52
54
|
}
|
package/dist/esm/breaches.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breaches.js","sourceRoot":"","sources":["../../src/breaches.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"breaches.js","sourceRoot":"","sources":["../../src/breaches.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,UAAU,QAAQ,CACtB,UAuBI,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,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,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"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* `https://haveibeenpwned.com/api/v3`)
|
|
8
8
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
9
9
|
* (default: none)
|
|
10
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
10
11
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
11
12
|
* field in the request headers (default: `hibp <version>`)
|
|
12
13
|
* @returns {(Promise<string[]> | Promise<null>)} a Promise which resolves to an
|
|
@@ -34,6 +35,10 @@ export declare function dataClasses(options?: {
|
|
|
34
35
|
* timeout for the request in milliseconds (default: none)
|
|
35
36
|
*/
|
|
36
37
|
timeoutMs?: number;
|
|
38
|
+
/**
|
|
39
|
+
* an AbortSignal to cancel the request (default: none)
|
|
40
|
+
*/
|
|
41
|
+
signal?: AbortSignal;
|
|
37
42
|
/**
|
|
38
43
|
* a custom string to send as the User-Agent field in the request headers
|
|
39
44
|
* (default: `hibp <version>`)
|
package/dist/esm/data-classes.js
CHANGED
|
@@ -8,6 +8,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
8
8
|
* `https://haveibeenpwned.com/api/v3`)
|
|
9
9
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
10
10
|
* (default: none)
|
|
11
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
11
12
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
12
13
|
* field in the request headers (default: `hibp <version>`)
|
|
13
14
|
* @returns {(Promise<string[]> | Promise<null>)} a Promise which resolves to an
|
|
@@ -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
|
|
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,UAmBI,EAAE;IAEN,OAAO,YAAY,CAAC,cAAc,EAAE,OAAO,CAA6B,CAAC;AAC3E,CAAC"}
|
|
@@ -8,6 +8,7 @@ import type { Breach } from './api/haveibeenpwned/types.js';
|
|
|
8
8
|
* `https://haveibeenpwned.com/api/v3`)
|
|
9
9
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
10
10
|
* (default: none)
|
|
11
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
11
12
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
12
13
|
* field in the request headers (default: `hibp <version>`)
|
|
13
14
|
* @returns {(Promise<Breach>|Promise<null>)} a Promise which resolves to an
|
|
@@ -35,6 +36,10 @@ export declare function latestBreach(options?: {
|
|
|
35
36
|
* timeout for the request in milliseconds (default: none)
|
|
36
37
|
*/
|
|
37
38
|
timeoutMs?: number;
|
|
39
|
+
/**
|
|
40
|
+
* an AbortSignal to cancel the request (default: none)
|
|
41
|
+
*/
|
|
42
|
+
signal?: AbortSignal;
|
|
38
43
|
/**
|
|
39
44
|
* a custom string to send as the User-Agent field in the request headers
|
|
40
45
|
* (default: `hibp <version>`)
|
|
@@ -8,6 +8,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
8
8
|
* `https://haveibeenpwned.com/api/v3`)
|
|
9
9
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
10
10
|
* (default: none)
|
|
11
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
11
12
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
12
13
|
* field in the request headers (default: `hibp <version>`)
|
|
13
14
|
* @returns {(Promise<Breach>|Promise<null>)} a Promise which resolves to an
|
|
@@ -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
|
|
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,UAmBI,EAAE;IAEN,OAAO,YAAY,CAAC,eAAe,EAAE,OAAO,CAA2B,CAAC;AAC1E,CAAC"}
|
|
@@ -27,6 +27,7 @@ import type { Paste } from './api/haveibeenpwned/types.js';
|
|
|
27
27
|
* `https://haveibeenpwned.com/api/v3`)
|
|
28
28
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
29
29
|
* (default: none)
|
|
30
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
30
31
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
31
32
|
* field in the request headers (default: `hibp <version>`)
|
|
32
33
|
* @returns {(Promise<Paste[]> | Promise<null>)} a Promise which resolves to an
|
|
@@ -71,6 +72,10 @@ export declare function pasteAccount(email: string, options?: {
|
|
|
71
72
|
* timeout for the request in milliseconds (default: none)
|
|
72
73
|
*/
|
|
73
74
|
timeoutMs?: number;
|
|
75
|
+
/**
|
|
76
|
+
* an AbortSignal to cancel the request (default: none)
|
|
77
|
+
*/
|
|
78
|
+
signal?: AbortSignal;
|
|
74
79
|
/**
|
|
75
80
|
* a custom string to send as the User-Agent field in the request headers
|
|
76
81
|
* (default: `hibp <version>`)
|
|
@@ -27,6 +27,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
27
27
|
* `https://haveibeenpwned.com/api/v3`)
|
|
28
28
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
29
29
|
* (default: none)
|
|
30
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
30
31
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
31
32
|
* field in the request headers (default: `hibp <version>`)
|
|
32
33
|
* @returns {(Promise<Paste[]> | Promise<null>)} a Promise which resolves to an
|
|
@@ -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
|
|
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,UAuBI,EAAE;IAEN,OAAO,YAAY,CAAC,iBAAiB,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAExE,CAAC;AACJ,CAAC"}
|
|
@@ -26,6 +26,7 @@ export type PwnedPasswordSuffixes = Record<string, number>;
|
|
|
26
26
|
* pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)
|
|
27
27
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
28
28
|
* (default: none)
|
|
29
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
29
30
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
30
31
|
* field in the request headers (default: `hibp <version>`)
|
|
31
32
|
* @returns {Promise<PwnedPasswordSuffixes>} a Promise which resolves to an
|
|
@@ -74,6 +75,10 @@ export declare function pwnedPasswordRange(prefix: string, options?: {
|
|
|
74
75
|
* timeout for the request in milliseconds (default: none)
|
|
75
76
|
*/
|
|
76
77
|
timeoutMs?: number;
|
|
78
|
+
/**
|
|
79
|
+
* an AbortSignal to cancel the request (default: none)
|
|
80
|
+
*/
|
|
81
|
+
signal?: AbortSignal;
|
|
77
82
|
/**
|
|
78
83
|
* a custom string to send as the User-Agent field in the request headers
|
|
79
84
|
* (default: `hibp <version>`)
|
|
@@ -26,6 +26,7 @@ import { fetchFromApi } from './api/pwnedpasswords/fetch-from-api.js';
|
|
|
26
26
|
* pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)
|
|
27
27
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
28
28
|
* (default: none)
|
|
29
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
29
30
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
30
31
|
* field in the request headers (default: `hibp <version>`)
|
|
31
32
|
* @returns {Promise<PwnedPasswordSuffixes>} a Promise which resolves to an
|
|
@@ -56,10 +57,11 @@ import { fetchFromApi } from './api/pwnedpasswords/fetch-from-api.js';
|
|
|
56
57
|
* @see https://haveibeenpwned.com/api/v3#SearchingPwnedPasswordsByRange
|
|
57
58
|
*/
|
|
58
59
|
export async function pwnedPasswordRange(prefix, options = {}) {
|
|
59
|
-
const { baseUrl, timeoutMs, userAgent, addPadding = false, mode = 'sha1' } = options;
|
|
60
|
+
const { baseUrl, timeoutMs, signal, userAgent, addPadding = false, mode = 'sha1' } = options;
|
|
60
61
|
const data = await fetchFromApi(`/range/${encodeURIComponent(prefix)}`, {
|
|
61
62
|
baseUrl,
|
|
62
63
|
timeoutMs,
|
|
64
|
+
signal,
|
|
63
65
|
userAgent,
|
|
64
66
|
addPadding,
|
|
65
67
|
mode,
|
|
@@ -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
|
|
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,UA4BI,EAAE;IAEN,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,GAAG,KAAK,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IAE7F,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,UAAU,kBAAkB,CAAC,MAAM,CAAC,EAAE,EAAE;QACtE,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;QACT,UAAU;QACV,IAAI;KACL,CAAC,CAAC;IAEH,mDAAmD;IACnD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEjD,+DAA+D;IAC/D,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;QAC/C,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)
|
|
12
12
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
13
13
|
* (default: none)
|
|
14
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
14
15
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
15
16
|
* field in the request headers (default: `hibp <version>`)
|
|
16
17
|
* @returns {Promise<number>} a Promise which resolves to the number of times
|
|
@@ -44,6 +45,10 @@ export declare function pwnedPassword(password: string, options?: {
|
|
|
44
45
|
* timeout for the request in milliseconds (default: none)
|
|
45
46
|
*/
|
|
46
47
|
timeoutMs?: number;
|
|
48
|
+
/**
|
|
49
|
+
* an AbortSignal to cancel the request (default: none)
|
|
50
|
+
*/
|
|
51
|
+
signal?: AbortSignal;
|
|
47
52
|
/**
|
|
48
53
|
* a custom string to send as the User-Agent field in the request headers
|
|
49
54
|
* (default: `hibp <version>`)
|
|
@@ -12,6 +12,7 @@ import { pwnedPasswordRange } from './pwned-password-range.js';
|
|
|
12
12
|
* pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)
|
|
13
13
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
14
14
|
* (default: none)
|
|
15
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
15
16
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
16
17
|
* field in the request headers (default: `hibp <version>`)
|
|
17
18
|
* @returns {Promise<number>} a Promise which resolves to the number of times
|
|
@@ -45,9 +46,7 @@ async function getPasswordHashParts(password) {
|
|
|
45
46
|
.join('')
|
|
46
47
|
.toUpperCase();
|
|
47
48
|
return [hashHex.slice(0, 5), hashHex.slice(5)];
|
|
48
|
-
/* c8 ignore start */
|
|
49
49
|
}
|
|
50
50
|
throw new Error('The Web Crypto API is not available in this environment.');
|
|
51
51
|
}
|
|
52
|
-
/* c8 ignore end */
|
|
53
52
|
//# 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
|
|
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,UAwBI,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,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;QACzD,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"}
|
package/dist/esm/search.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export interface SearchResults {
|
|
|
38
38
|
* `https://haveibeenpwned.com/api/v3`)
|
|
39
39
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
40
40
|
* (default: none)
|
|
41
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
41
42
|
* @param {string} [options.userAgent] a custom string to send as the
|
|
42
43
|
* User-Agent field in the request headers (default: `hibp <version>`)
|
|
43
44
|
* @returns {Promise<SearchResults>} a Promise which resolves to an object
|
|
@@ -94,6 +95,10 @@ export declare function search(account: string, options?: {
|
|
|
94
95
|
* timeout for the request in milliseconds (default: none)
|
|
95
96
|
*/
|
|
96
97
|
timeoutMs?: number;
|
|
98
|
+
/**
|
|
99
|
+
* an AbortSignal to cancel the request (default: none)
|
|
100
|
+
*/
|
|
101
|
+
signal?: AbortSignal;
|
|
97
102
|
/**
|
|
98
103
|
* a custom string to send as the User-Agent field in the request headers
|
|
99
104
|
* (default: `hibp <version>`)
|
package/dist/esm/search.js
CHANGED
|
@@ -35,6 +35,7 @@ import { pasteAccount } from './paste-account.js';
|
|
|
35
35
|
* `https://haveibeenpwned.com/api/v3`)
|
|
36
36
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
37
37
|
* (default: none)
|
|
38
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
38
39
|
* @param {string} [options.userAgent] a custom string to send as the
|
|
39
40
|
* User-Agent field in the request headers (default: `hibp <version>`)
|
|
40
41
|
* @returns {Promise<SearchResults>} a Promise which resolves to an object
|
|
@@ -69,7 +70,7 @@ import { pasteAccount } from './paste-account.js';
|
|
|
69
70
|
* @see https://haveibeenpwned.com/
|
|
70
71
|
*/
|
|
71
72
|
export async function search(account, options = {}) {
|
|
72
|
-
const { apiKey, domain, truncate = true, baseUrl, timeoutMs, userAgent } = options;
|
|
73
|
+
const { apiKey, domain, truncate = true, baseUrl, timeoutMs, signal, userAgent } = options;
|
|
73
74
|
const [breaches, pastes] = await Promise.all([
|
|
74
75
|
breachedAccount(account, {
|
|
75
76
|
apiKey,
|
|
@@ -77,11 +78,12 @@ export async function search(account, options = {}) {
|
|
|
77
78
|
truncate,
|
|
78
79
|
baseUrl,
|
|
79
80
|
timeoutMs,
|
|
81
|
+
signal,
|
|
80
82
|
userAgent,
|
|
81
83
|
}),
|
|
82
84
|
// This email regex is garbage but it seems to be what the API uses:
|
|
83
85
|
/^.+@.+$/.test(account)
|
|
84
|
-
? pasteAccount(account, { apiKey, baseUrl, timeoutMs, userAgent })
|
|
86
|
+
? pasteAccount(account, { apiKey, baseUrl, timeoutMs, signal, userAgent })
|
|
85
87
|
: null,
|
|
86
88
|
]);
|
|
87
89
|
return { breaches, pastes };
|
package/dist/esm/search.js.map
CHANGED
|
@@ -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;AAOlD;;;;;;GAMG;AAEH
|
|
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;AAOlD;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,OAAe,EACf,UAgCI,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAE3F,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC3C,eAAe,CAAC,OAAO,EAAE;YACvB,MAAM;YACN,MAAM;YACN,QAAQ;YACR,OAAO;YACP,SAAS;YACT,MAAM;YACN,SAAS;SACV,CAAC;QACF,oEAAoE;QACpE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;YACrB,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,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"}
|
|
@@ -29,6 +29,7 @@ import type { StealerLogDomainsByEmailAlias } from './api/haveibeenpwned/types.j
|
|
|
29
29
|
* `https://haveibeenpwned.com/api/v3`)
|
|
30
30
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
31
31
|
* (default: none)
|
|
32
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
32
33
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
33
34
|
* field in the request headers (default: `hibp <version>`)
|
|
34
35
|
* @returns {(Promise<StealerLogDomainsByEmailAlias> | Promise<null>)} a Promise
|
|
@@ -60,6 +61,10 @@ export declare function stealerLogsByEmailDomain(emailDomain: string, options?:
|
|
|
60
61
|
* timeout for the request in milliseconds (default: none)
|
|
61
62
|
*/
|
|
62
63
|
timeoutMs?: number;
|
|
64
|
+
/**
|
|
65
|
+
* an AbortSignal to cancel the request (default: none)
|
|
66
|
+
*/
|
|
67
|
+
signal?: AbortSignal;
|
|
63
68
|
/**
|
|
64
69
|
* a custom string to send as the User-Agent field in the request headers
|
|
65
70
|
* (default: `hibp <version>`)
|
|
@@ -29,6 +29,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
29
29
|
* `https://haveibeenpwned.com/api/v3`)
|
|
30
30
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
31
31
|
* (default: none)
|
|
32
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
32
33
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
33
34
|
* field in the request headers (default: `hibp <version>`)
|
|
34
35
|
* @returns {(Promise<StealerLogDomainsByEmailAlias> | Promise<null>)} a Promise
|
|
@@ -47,12 +48,13 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
47
48
|
* }
|
|
48
49
|
*/
|
|
49
50
|
export function stealerLogsByEmailDomain(emailDomain, options = {}) {
|
|
50
|
-
const { apiKey, baseUrl, timeoutMs, userAgent } = options;
|
|
51
|
+
const { apiKey, baseUrl, timeoutMs, signal, userAgent } = options;
|
|
51
52
|
const endpoint = `/stealerlogsbyemaildomain/${encodeURIComponent(emailDomain)}`;
|
|
52
53
|
return fetchFromApi(endpoint, {
|
|
53
54
|
apiKey,
|
|
54
55
|
baseUrl,
|
|
55
56
|
timeoutMs,
|
|
57
|
+
signal,
|
|
56
58
|
userAgent,
|
|
57
59
|
});
|
|
58
60
|
}
|
|
@@ -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
|
|
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"}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* `https://haveibeenpwned.com/api/v3`)
|
|
20
20
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
21
21
|
* (default: none)
|
|
22
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
22
23
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
23
24
|
* field in the request headers (default: `hibp <version>`)
|
|
24
25
|
* @returns {(Promise<string[]> | Promise<null>)} a Promise which resolves to an
|
|
@@ -63,6 +64,10 @@ export declare function stealerLogsByEmail(emailAddress: string, options?: {
|
|
|
63
64
|
* timeout for the request in milliseconds (default: none)
|
|
64
65
|
*/
|
|
65
66
|
timeoutMs?: number;
|
|
67
|
+
/**
|
|
68
|
+
* an AbortSignal to cancel the request (default: none)
|
|
69
|
+
*/
|
|
70
|
+
signal?: AbortSignal;
|
|
66
71
|
/**
|
|
67
72
|
* a custom string to send as the User-Agent field in the request headers
|
|
68
73
|
* (default: `hibp <version>`)
|
|
@@ -20,6 +20,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
20
20
|
* `https://haveibeenpwned.com/api/v3`)
|
|
21
21
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
22
22
|
* (default: none)
|
|
23
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
23
24
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
24
25
|
* field in the request headers (default: `hibp <version>`)
|
|
25
26
|
* @returns {(Promise<string[]> | Promise<null>)} a Promise which resolves to an
|
|
@@ -51,12 +52,13 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
51
52
|
* }
|
|
52
53
|
*/
|
|
53
54
|
export function stealerLogsByEmail(emailAddress, options = {}) {
|
|
54
|
-
const { apiKey, baseUrl, timeoutMs, userAgent } = options;
|
|
55
|
+
const { apiKey, baseUrl, timeoutMs, signal, userAgent } = options;
|
|
55
56
|
const endpoint = `/stealerlogsbyemail/${encodeURIComponent(emailAddress)}`;
|
|
56
57
|
return fetchFromApi(endpoint, {
|
|
57
58
|
apiKey,
|
|
58
59
|
baseUrl,
|
|
59
60
|
timeoutMs,
|
|
61
|
+
signal,
|
|
60
62
|
userAgent,
|
|
61
63
|
});
|
|
62
64
|
}
|
|
@@ -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
|
|
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"}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* `https://haveibeenpwned.com/api/v3`)
|
|
20
20
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
21
21
|
* (default: none)
|
|
22
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
22
23
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
23
24
|
* field in the request headers (default: `hibp <version>`)
|
|
24
25
|
* @returns {(Promise<string[]> | Promise<null>)} a Promise which resolves to an
|
|
@@ -63,6 +64,10 @@ export declare function stealerLogsByWebsiteDomain(websiteDomain: string, option
|
|
|
63
64
|
* timeout for the request in milliseconds (default: none)
|
|
64
65
|
*/
|
|
65
66
|
timeoutMs?: number;
|
|
67
|
+
/**
|
|
68
|
+
* an AbortSignal to cancel the request (default: none)
|
|
69
|
+
*/
|
|
70
|
+
signal?: AbortSignal;
|
|
66
71
|
/**
|
|
67
72
|
* a custom string to send as the User-Agent field in the request headers
|
|
68
73
|
* (default: `hibp <version>`)
|
|
@@ -20,6 +20,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
20
20
|
* `https://haveibeenpwned.com/api/v3`)
|
|
21
21
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
22
22
|
* (default: none)
|
|
23
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
23
24
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
24
25
|
* field in the request headers (default: `hibp <version>`)
|
|
25
26
|
* @returns {(Promise<string[]> | Promise<null>)} a Promise which resolves to an
|
|
@@ -51,12 +52,13 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
51
52
|
* }
|
|
52
53
|
*/
|
|
53
54
|
export function stealerLogsByWebsiteDomain(websiteDomain, options = {}) {
|
|
54
|
-
const { apiKey, baseUrl, timeoutMs, userAgent } = options;
|
|
55
|
+
const { apiKey, baseUrl, timeoutMs, signal, userAgent } = options;
|
|
55
56
|
const endpoint = `/stealerlogsbywebsitedomain/${encodeURIComponent(websiteDomain)}`;
|
|
56
57
|
return fetchFromApi(endpoint, {
|
|
57
58
|
apiKey,
|
|
58
59
|
baseUrl,
|
|
59
60
|
timeoutMs,
|
|
61
|
+
signal,
|
|
60
62
|
userAgent,
|
|
61
63
|
});
|
|
62
64
|
}
|
|
@@ -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
|
|
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"}
|
|
@@ -30,6 +30,7 @@ import type { SubscribedDomain } from './api/haveibeenpwned/types.js';
|
|
|
30
30
|
* `https://haveibeenpwned.com/api/v3`)
|
|
31
31
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
32
32
|
* (default: none)
|
|
33
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
33
34
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
34
35
|
* field in the request headers (default: `hibp <version>`)
|
|
35
36
|
* @returns {Promise<SubscribedDomain[]>} a Promise which resolves to an array of
|
|
@@ -65,6 +66,10 @@ export declare function subscribedDomains(options?: {
|
|
|
65
66
|
* timeout for the request in milliseconds (default: none)
|
|
66
67
|
*/
|
|
67
68
|
timeoutMs?: number;
|
|
69
|
+
/**
|
|
70
|
+
* an AbortSignal to cancel the request (default: none)
|
|
71
|
+
*/
|
|
72
|
+
signal?: AbortSignal;
|
|
68
73
|
/**
|
|
69
74
|
* a custom string to send as the User-Agent field in the request headers
|
|
70
75
|
* (default: `hibp <version>`)
|
|
@@ -30,6 +30,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
30
30
|
* `https://haveibeenpwned.com/api/v3`)
|
|
31
31
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
32
32
|
* (default: none)
|
|
33
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
33
34
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
34
35
|
* field in the request headers (default: `hibp <version>`)
|
|
35
36
|
* @returns {Promise<SubscribedDomain[]>} a Promise which resolves to an array of
|
|
@@ -52,12 +53,13 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
52
53
|
* }
|
|
53
54
|
*/
|
|
54
55
|
export function subscribedDomains(options = {}) {
|
|
55
|
-
const { apiKey, baseUrl, timeoutMs, userAgent } = options;
|
|
56
|
+
const { apiKey, baseUrl, timeoutMs, signal, userAgent } = options;
|
|
56
57
|
const endpoint = '/subscribeddomains';
|
|
57
58
|
return fetchFromApi(endpoint, {
|
|
58
59
|
apiKey,
|
|
59
60
|
baseUrl,
|
|
60
61
|
timeoutMs,
|
|
62
|
+
signal,
|
|
61
63
|
userAgent,
|
|
62
64
|
});
|
|
63
65
|
}
|
|
@@ -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
|
|
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"}
|
|
@@ -27,6 +27,7 @@ import type { SubscriptionStatus } from './api/haveibeenpwned/types.js';
|
|
|
27
27
|
* `https://haveibeenpwned.com/api/v3`)
|
|
28
28
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
29
29
|
* (default: none)
|
|
30
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
30
31
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
31
32
|
* field in the request headers (default: `hibp <version>`)
|
|
32
33
|
* @returns {Promise<SubscriptionStatus>} a Promise which resolves to a
|
|
@@ -62,6 +63,10 @@ export declare function subscriptionStatus(options?: {
|
|
|
62
63
|
* timeout for the request in milliseconds (default: none)
|
|
63
64
|
*/
|
|
64
65
|
timeoutMs?: number;
|
|
66
|
+
/**
|
|
67
|
+
* an AbortSignal to cancel the request (default: none)
|
|
68
|
+
*/
|
|
69
|
+
signal?: AbortSignal;
|
|
65
70
|
/**
|
|
66
71
|
* a custom string to send as the User-Agent field in the request headers
|
|
67
72
|
* (default: `hibp <version>`)
|
|
@@ -27,6 +27,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
27
27
|
* `https://haveibeenpwned.com/api/v3`)
|
|
28
28
|
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
29
29
|
* (default: none)
|
|
30
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
30
31
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
31
32
|
* field in the request headers (default: `hibp <version>`)
|
|
32
33
|
* @returns {Promise<SubscriptionStatus>} a Promise which resolves to a
|
|
@@ -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
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hibp",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.2.0",
|
|
4
4
|
"description": "An unofficial TypeScript SDK for the 'Have I been pwned?' service.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"haveibeenpwned",
|
|
@@ -82,33 +82,30 @@
|
|
|
82
82
|
"@arethetypeswrong/cli": "0.18.2",
|
|
83
83
|
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
84
84
|
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
|
|
85
|
-
"@babel/preset-env": "7.28.
|
|
86
|
-
"@babel/preset-typescript": "7.
|
|
87
|
-
"@changesets/changelog-github": "0.5.
|
|
88
|
-
"@changesets/cli": "2.29.
|
|
89
|
-
"@playwright/test": "1.
|
|
85
|
+
"@babel/preset-env": "7.28.5",
|
|
86
|
+
"@babel/preset-typescript": "7.28.5",
|
|
87
|
+
"@changesets/changelog-github": "0.5.2",
|
|
88
|
+
"@changesets/cli": "2.29.8",
|
|
89
|
+
"@playwright/test": "1.57.0",
|
|
90
90
|
"@types/common-tags": "1.8.4",
|
|
91
|
-
"@types/
|
|
92
|
-
"@
|
|
93
|
-
"@
|
|
94
|
-
"@vitest/coverage-v8": "3.2.4",
|
|
95
|
-
"@wkovacs64/eslint-config": "7.10.0",
|
|
91
|
+
"@types/node": "24.10.1",
|
|
92
|
+
"@vitest/coverage-v8": "4.0.14",
|
|
93
|
+
"@wkovacs64/eslint-config": "7.11.1",
|
|
96
94
|
"@wkovacs64/prettier-config": "4.2.2",
|
|
97
95
|
"bundlewatch": "0.4.1",
|
|
98
96
|
"common-tags": "1.8.2",
|
|
99
97
|
"cross-env": "10.1.0",
|
|
100
|
-
"esbuild": "0.
|
|
101
|
-
"eslint": "9.
|
|
98
|
+
"esbuild": "0.27.0",
|
|
99
|
+
"eslint": "9.39.1",
|
|
102
100
|
"jsdoc-babel": "0.5.0",
|
|
103
101
|
"jsdoc-to-markdown": "9.1.3",
|
|
104
|
-
"msw": "2.
|
|
102
|
+
"msw": "2.12.3",
|
|
105
103
|
"npm-run-all2": "8.0.4",
|
|
106
104
|
"pathe": "2.0.3",
|
|
107
|
-
"prettier": "3.
|
|
108
|
-
"rimraf": "6.
|
|
105
|
+
"prettier": "3.7.3",
|
|
106
|
+
"rimraf": "6.1.2",
|
|
109
107
|
"serve": "14.2.5",
|
|
110
|
-
"type-fest": "5.0.1",
|
|
111
108
|
"typescript": "5.9.3",
|
|
112
|
-
"vitest": "
|
|
109
|
+
"vitest": "4.0.14"
|
|
113
110
|
}
|
|
114
111
|
}
|