hibp 15.2.0 → 16.0.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 +433 -126
- package/CHANGELOG.md +50 -0
- package/MIGRATION.md +7 -5
- package/README.md +53 -27
- package/dist/browser/hibp.module.js +2 -2
- package/dist/esm/api/base-fetch.d.ts +3 -1
- package/dist/esm/api/base-fetch.js +20 -7
- package/dist/esm/api/base-fetch.js.map +1 -1
- package/dist/esm/api/haveibeenpwned/fetch-from-api.d.ts +1 -1
- package/dist/esm/api/haveibeenpwned/fetch-from-api.js +71 -24
- 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/haveibeenpwned/post-to-api.d.ts +1 -0
- package/dist/esm/api/haveibeenpwned/post-to-api.js +31 -0
- package/dist/esm/api/haveibeenpwned/post-to-api.js.map +1 -0
- package/dist/esm/api/haveibeenpwned/responses.js +8 -7
- package/dist/esm/api/haveibeenpwned/responses.js.map +1 -1
- package/dist/esm/api/haveibeenpwned/types.d.ts +22 -2
- package/dist/esm/api/pwnedpasswords/fetch-from-api.js +4 -4
- package/dist/esm/api/pwnedpasswords/fetch-from-api.js.map +1 -1
- package/dist/esm/api/pwnedpasswords/responses.js +1 -1
- package/dist/esm/breach.d.ts +8 -1
- package/dist/esm/breach.js +8 -1
- package/dist/esm/breach.js.map +1 -1
- package/dist/esm/breached-account-range.d.ts +73 -0
- package/dist/esm/breached-account-range.js +60 -0
- package/dist/esm/breached-account-range.js.map +1 -0
- package/dist/esm/breached-account.d.ts +56 -45
- package/dist/esm/breached-account.js +4 -76
- package/dist/esm/breached-account.js.map +1 -1
- package/dist/esm/breached-domain.d.ts +2 -3
- package/dist/esm/breached-domain.js +2 -3
- package/dist/esm/breached-domain.js.map +1 -1
- package/dist/esm/breaches.d.ts +9 -2
- package/dist/esm/breaches.js +10 -5
- package/dist/esm/breaches.js.map +1 -1
- package/dist/esm/data-class-descriptions.d.ts +55 -0
- package/dist/esm/data-class-descriptions.js +39 -0
- package/dist/esm/data-class-descriptions.js.map +1 -0
- package/dist/esm/data-classes.js +2 -2
- package/dist/esm/data-classes.js.map +1 -1
- package/dist/esm/generate-dns-token.d.ts +67 -0
- package/dist/esm/generate-dns-token.js +48 -0
- package/dist/esm/generate-dns-token.js.map +1 -0
- package/dist/esm/hibp.d.ts +28 -18
- package/dist/esm/hibp.js +23 -18
- package/dist/esm/hibp.js.map +1 -1
- package/dist/esm/latest-breach.d.ts +1 -1
- package/dist/esm/latest-breach.js +2 -2
- package/dist/esm/latest-breach.js.map +1 -1
- package/dist/esm/paste-account.d.ts +8 -8
- package/dist/esm/paste-account.js +8 -8
- package/dist/esm/paste-account.js.map +1 -1
- package/dist/esm/pwned-password-range.d.ts +1 -1
- package/dist/esm/pwned-password-range.js +4 -4
- package/dist/esm/pwned-password-range.js.map +1 -1
- package/dist/esm/pwned-password.js +6 -6
- package/dist/esm/pwned-password.js.map +1 -1
- package/dist/esm/search.d.ts +57 -40
- package/dist/esm/search.js +3 -72
- package/dist/esm/search.js.map +1 -1
- package/dist/esm/send-email.d.ts +69 -0
- package/dist/esm/send-email.js +49 -0
- package/dist/esm/send-email.js.map +1 -0
- package/dist/esm/stealer-logs-by-email-domain.d.ts +8 -9
- package/dist/esm/stealer-logs-by-email-domain.js +8 -9
- package/dist/esm/stealer-logs-by-email-domain.js.map +1 -1
- package/dist/esm/stealer-logs-by-email.d.ts +4 -5
- package/dist/esm/stealer-logs-by-email.js +5 -6
- package/dist/esm/stealer-logs-by-email.js.map +1 -1
- package/dist/esm/stealer-logs-by-website-domain.d.ts +4 -5
- package/dist/esm/stealer-logs-by-website-domain.js +5 -6
- package/dist/esm/stealer-logs-by-website-domain.js.map +1 -1
- package/dist/esm/subscribed-domains.d.ts +2 -3
- package/dist/esm/subscribed-domains.js +3 -4
- package/dist/esm/subscribed-domains.js.map +1 -1
- package/dist/esm/subscription-status.d.ts +11 -6
- package/dist/esm/subscription-status.js +12 -7
- package/dist/esm/subscription-status.js.map +1 -1
- package/dist/esm/verify-dns-token.d.ts +60 -0
- package/dist/esm/verify-dns-token.js +41 -0
- package/dist/esm/verify-dns-token.js.map +1 -0
- package/package.json +74 -75
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
/** @internal */
|
|
12
12
|
export const BAD_REQUEST = {
|
|
13
13
|
status: 400,
|
|
14
|
-
statusText:
|
|
14
|
+
statusText: "Bad request — the account does not comply with an acceptable format.",
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* A plain-text body for this response type. The live API sends a JSON object
|
|
18
|
+
* containing a human-readable message instead. Manually populating the message
|
|
19
|
+
* here purely for use in tests.
|
|
19
20
|
*
|
|
20
21
|
* @internal
|
|
21
22
|
*/
|
|
@@ -26,11 +27,11 @@ export const UNAUTHORIZED = {
|
|
|
26
27
|
/** @internal */
|
|
27
28
|
export const FORBIDDEN = {
|
|
28
29
|
status: 403,
|
|
29
|
-
statusText:
|
|
30
|
+
statusText: "Forbidden - access denied.",
|
|
30
31
|
};
|
|
31
32
|
/** @internal */
|
|
32
33
|
export const BLOCKED = {
|
|
33
|
-
headers: new Map([[
|
|
34
|
+
headers: new Map([["cf-ray", "someRayId"]]),
|
|
34
35
|
status: 403,
|
|
35
36
|
};
|
|
36
37
|
/** @internal */
|
|
@@ -45,11 +46,11 @@ export const NOT_FOUND = {
|
|
|
45
46
|
* @internal
|
|
46
47
|
*/
|
|
47
48
|
export const TOO_MANY_REQUESTS = {
|
|
48
|
-
headers: new Map([[
|
|
49
|
+
headers: new Map([["retry-after", "2"]]),
|
|
49
50
|
status: 429,
|
|
50
51
|
body: {
|
|
51
52
|
statusCode: 429,
|
|
52
|
-
message:
|
|
53
|
+
message: "Rate limit is exceeded. Try again in 2 seconds.",
|
|
53
54
|
},
|
|
54
55
|
};
|
|
55
56
|
//# sourceMappingURL=responses.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../../src/api/haveibeenpwned/responses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,gBAAgB;AAChB,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,GAAY;IACpB,UAAU,
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../../src/api/haveibeenpwned/responses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,gBAAgB;AAChB,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,GAAY;IACpB,UAAU,EACR,sEAAsE;CACzE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,GAAY;IACpB,IAAI,EAAE,mMAAmM;CAC1M,CAAC;AAEF,gBAAgB;AAChB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE,GAAY;IACpB,UAAU,EAAE,4BAA4B;CACzC,CAAC;AAEF,gBAAgB;AAChB,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAC3C,MAAM,EAAE,GAAY;CACrB,CAAC;AAEF,gBAAgB;AAChB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE,GAAY;CACrB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC;IACxC,MAAM,EAAE,GAAY;IACpB,IAAI,EAAE;QACJ,UAAU,EAAE,GAAY;QACxB,OAAO,EAAE,iDAAiD;KAC3D;CACF,CAAC"}
|
|
@@ -14,23 +14,35 @@ export interface Breach {
|
|
|
14
14
|
IsRetired: boolean;
|
|
15
15
|
IsSpamList: boolean;
|
|
16
16
|
IsMalware: boolean;
|
|
17
|
+
IsStealerLog: boolean;
|
|
17
18
|
IsSubscriptionFree: boolean;
|
|
18
19
|
LogoPath: string;
|
|
20
|
+
Attribution: string | null;
|
|
21
|
+
DisclosureUrl: string | null;
|
|
19
22
|
}
|
|
20
23
|
export interface Paste {
|
|
21
24
|
Id: string;
|
|
22
25
|
Source: string;
|
|
23
|
-
Title
|
|
24
|
-
Date: string;
|
|
26
|
+
Title?: string;
|
|
27
|
+
Date: string | null;
|
|
25
28
|
EmailCount: number;
|
|
26
29
|
}
|
|
30
|
+
export interface DataClassDescription {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
}
|
|
27
34
|
export interface SubscriptionStatus {
|
|
28
35
|
SubscriptionName: string;
|
|
29
36
|
Description: string;
|
|
30
37
|
SubscribedUntil: string;
|
|
31
38
|
Rpm: number;
|
|
32
39
|
DomainSearchMaxBreachedAccounts: number;
|
|
40
|
+
MaxBreachedDomains: number | null;
|
|
33
41
|
IncludesStealerLogs: boolean;
|
|
42
|
+
IncludesBulkDomainAdd: boolean;
|
|
43
|
+
IncludesAutoSubdomainVerification: boolean;
|
|
44
|
+
IncludesCustomerDomains: boolean;
|
|
45
|
+
IncludesKAnon: boolean;
|
|
34
46
|
}
|
|
35
47
|
export interface SubscribedDomain {
|
|
36
48
|
DomainName: string;
|
|
@@ -39,5 +51,13 @@ export interface SubscribedDomain {
|
|
|
39
51
|
PwnCountExcludingSpamListsAtLastSubscriptionRenewal: number | null;
|
|
40
52
|
NextSubscriptionRenewal: string | null;
|
|
41
53
|
}
|
|
54
|
+
export interface DnsToken {
|
|
55
|
+
txtRecordValue: string;
|
|
56
|
+
}
|
|
57
|
+
export type EmailAlias = "admin" | "hostmaster" | "info" | "security" | "webmaster";
|
|
42
58
|
export type BreachedDomainsByEmailAlias = Record<string, string[]>;
|
|
59
|
+
export interface BreachedAccountRangeResult {
|
|
60
|
+
hashSuffix: string;
|
|
61
|
+
websites: string[];
|
|
62
|
+
}
|
|
43
63
|
export type StealerLogDomainsByEmailAlias = Record<string, string[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { baseFetch } from
|
|
2
|
-
import { BAD_REQUEST } from
|
|
1
|
+
import { baseFetch } from "../base-fetch.js";
|
|
2
|
+
import { BAD_REQUEST } from "./responses.js";
|
|
3
3
|
/**
|
|
4
4
|
* Fetches data from the supplied API endpoint.
|
|
5
5
|
*
|
|
@@ -25,10 +25,10 @@ import { BAD_REQUEST } from './responses.js';
|
|
|
25
25
|
* from the query, or rejects with an Error
|
|
26
26
|
*/
|
|
27
27
|
export async function fetchFromApi(endpoint, options = {}) {
|
|
28
|
-
const { baseUrl =
|
|
28
|
+
const { baseUrl = "https://api.pwnedpasswords.com", timeoutMs, signal, userAgent, addPadding = false, mode = "sha1", } = options;
|
|
29
29
|
const headers = {};
|
|
30
30
|
if (addPadding)
|
|
31
|
-
headers[
|
|
31
|
+
headers["Add-Padding"] = "true";
|
|
32
32
|
const response = await baseFetch({
|
|
33
33
|
baseUrl,
|
|
34
34
|
endpoint,
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,OAAO,GAOH,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
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type { Breach } from
|
|
1
|
+
import type { Breach } from "./api/haveibeenpwned/types.js";
|
|
2
2
|
/**
|
|
3
3
|
* An object representing a breach.
|
|
4
4
|
*
|
|
5
|
+
* `Attribution` and `DisclosureUrl` may be null. See the
|
|
6
|
+
* [breach model](https://haveibeenpwned.com/API/v3#BreachModel) and the
|
|
7
|
+
* [breach catalogue](https://haveibeenpwned.com/api/v3/breaches).
|
|
8
|
+
*
|
|
5
9
|
* @typedef {object} Breach
|
|
6
10
|
* @property {string} Name
|
|
7
11
|
* @property {string} Title
|
|
@@ -18,8 +22,11 @@ import type { Breach } from './api/haveibeenpwned/types.js';
|
|
|
18
22
|
* @property {boolean} IsRetired
|
|
19
23
|
* @property {boolean} IsSpamList
|
|
20
24
|
* @property {boolean} IsMalware
|
|
25
|
+
* @property {boolean} IsStealerLog whether the breach is sourced from stealer logs
|
|
21
26
|
* @property {boolean} IsSubscriptionFree
|
|
22
27
|
* @property {string} LogoPath
|
|
28
|
+
* @property {(string | null)} Attribution credit requested by the data provider, or null
|
|
29
|
+
* @property {(string | null)} DisclosureUrl breach disclosure URL, or null
|
|
23
30
|
*/
|
|
24
31
|
/**
|
|
25
32
|
* Fetches data for a specific breach event.
|
package/dist/esm/breach.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { fetchFromApi } from
|
|
1
|
+
import { fetchFromApi } from "./api/haveibeenpwned/fetch-from-api.js";
|
|
2
2
|
/**
|
|
3
3
|
* An object representing a breach.
|
|
4
4
|
*
|
|
5
|
+
* `Attribution` and `DisclosureUrl` may be null. See the
|
|
6
|
+
* [breach model](https://haveibeenpwned.com/API/v3#BreachModel) and the
|
|
7
|
+
* [breach catalogue](https://haveibeenpwned.com/api/v3/breaches).
|
|
8
|
+
*
|
|
5
9
|
* @typedef {object} Breach
|
|
6
10
|
* @property {string} Name
|
|
7
11
|
* @property {string} Title
|
|
@@ -18,8 +22,11 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
18
22
|
* @property {boolean} IsRetired
|
|
19
23
|
* @property {boolean} IsSpamList
|
|
20
24
|
* @property {boolean} IsMalware
|
|
25
|
+
* @property {boolean} IsStealerLog whether the breach is sourced from stealer logs
|
|
21
26
|
* @property {boolean} IsSubscriptionFree
|
|
22
27
|
* @property {string} LogoPath
|
|
28
|
+
* @property {(string | null)} Attribution credit requested by the data provider, or null
|
|
29
|
+
* @property {(string | null)} DisclosureUrl breach disclosure URL, or null
|
|
23
30
|
*/
|
|
24
31
|
/**
|
|
25
32
|
* Fetches data for a specific breach event.
|
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
|
|
1
|
+
{"version":3,"file":"breach.js","sourceRoot":"","sources":["../../src/breach.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,MAAM,CACpB,UAAkB,EAClB,OAAO,GAmBH,EAAE;IAEN,OAAO,YAAY,CACjB,WAAW,kBAAkB,CAAC,UAAU,CAAC,EAAE,EAC3C,OAAO,CACkB,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { BreachedAccountRangeResult } from "./api/haveibeenpwned/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A breached email hash suffix and the breach names associated with it.
|
|
4
|
+
*
|
|
5
|
+
* @typedef {Object} BreachedAccountRangeResult
|
|
6
|
+
* @property {string} hashSuffix the remaining 34 characters of a SHA-1 email hash
|
|
7
|
+
* @property {string[]} websites breach names, not website domains or URLs
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Fetches breached email hash suffixes for a six-character SHA-1 email hash
|
|
11
|
+
* prefix.
|
|
12
|
+
*
|
|
13
|
+
* Requires a Pro or High RPM API key from https://haveibeenpwned.com/API/Key.
|
|
14
|
+
* The `apiKey` option here is not explicitly required, but direct requests made
|
|
15
|
+
* without it will fail (unless you specify a `baseUrl` to a proxy that inserts
|
|
16
|
+
* a valid API key on your behalf).
|
|
17
|
+
*
|
|
18
|
+
* Compare suffixes locally against the intended email hash. Per the
|
|
19
|
+
* haveibeenpwned.com terms of use, discard unrelated results immediately
|
|
20
|
+
* without storing or further processing them.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} prefix the first six characters of a SHA-1 email hash
|
|
23
|
+
* (case-insensitive)
|
|
24
|
+
* @param {object} [options] a configuration object
|
|
25
|
+
* @param {string} [options.apiKey] an API key from
|
|
26
|
+
* https://haveibeenpwned.com/API/Key (default: undefined)
|
|
27
|
+
* @param {string} [options.baseUrl] a custom base URL for the
|
|
28
|
+
* haveibeenpwned.com API endpoints (default:
|
|
29
|
+
* `https://haveibeenpwned.com/api/v3`)
|
|
30
|
+
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
31
|
+
* (default: none)
|
|
32
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
33
|
+
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
34
|
+
* field in the request headers (default: `hibp <version>`)
|
|
35
|
+
* @returns {(Promise<BreachedAccountRangeResult[]> | Promise<null>)} a Promise
|
|
36
|
+
* which resolves to an array of range results (or null if none were found), or
|
|
37
|
+
* rejects with an Error
|
|
38
|
+
* @example
|
|
39
|
+
* try {
|
|
40
|
+
* const data = await breachedAccountRange("6B5917", { apiKey: "my-api-key" });
|
|
41
|
+
* const match = data?.find(
|
|
42
|
+
* ({ hashSuffix }) => hashSuffix === "C6C0AADE0C085843D66E4944E108C4A4CD",
|
|
43
|
+
* );
|
|
44
|
+
* // match?.websites: ["Adobe", "Gawker", "Stratfor"] in the documented example
|
|
45
|
+
* } catch (err) {
|
|
46
|
+
* // ...
|
|
47
|
+
* }
|
|
48
|
+
* @see https://haveibeenpwned.com/API/v3#BreachesForHashRange
|
|
49
|
+
*/
|
|
50
|
+
export declare function breachedAccountRange(prefix: string, options?: {
|
|
51
|
+
/**
|
|
52
|
+
* an API key from https://haveibeenpwned.com/API/Key (default: undefined)
|
|
53
|
+
*/
|
|
54
|
+
apiKey?: string;
|
|
55
|
+
/**
|
|
56
|
+
* a custom base URL for the haveibeenpwned.com API endpoints (default:
|
|
57
|
+
* `https://haveibeenpwned.com/api/v3`)
|
|
58
|
+
*/
|
|
59
|
+
baseUrl?: string;
|
|
60
|
+
/**
|
|
61
|
+
* timeout for the request in milliseconds (default: none)
|
|
62
|
+
*/
|
|
63
|
+
timeoutMs?: number;
|
|
64
|
+
/**
|
|
65
|
+
* an AbortSignal to cancel the request (default: none)
|
|
66
|
+
*/
|
|
67
|
+
signal?: AbortSignal;
|
|
68
|
+
/**
|
|
69
|
+
* a custom string to send as the User-Agent field in the request headers
|
|
70
|
+
* (default: `hibp <version>`)
|
|
71
|
+
*/
|
|
72
|
+
userAgent?: string;
|
|
73
|
+
}): Promise<BreachedAccountRangeResult[] | null>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { fetchFromApi } from "./api/haveibeenpwned/fetch-from-api.js";
|
|
2
|
+
/**
|
|
3
|
+
* A breached email hash suffix and the breach names associated with it.
|
|
4
|
+
*
|
|
5
|
+
* @typedef {Object} BreachedAccountRangeResult
|
|
6
|
+
* @property {string} hashSuffix the remaining 34 characters of a SHA-1 email hash
|
|
7
|
+
* @property {string[]} websites breach names, not website domains or URLs
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Fetches breached email hash suffixes for a six-character SHA-1 email hash
|
|
11
|
+
* prefix.
|
|
12
|
+
*
|
|
13
|
+
* Requires a Pro or High RPM API key from https://haveibeenpwned.com/API/Key.
|
|
14
|
+
* The `apiKey` option here is not explicitly required, but direct requests made
|
|
15
|
+
* without it will fail (unless you specify a `baseUrl` to a proxy that inserts
|
|
16
|
+
* a valid API key on your behalf).
|
|
17
|
+
*
|
|
18
|
+
* Compare suffixes locally against the intended email hash. Per the
|
|
19
|
+
* haveibeenpwned.com terms of use, discard unrelated results immediately
|
|
20
|
+
* without storing or further processing them.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} prefix the first six characters of a SHA-1 email hash
|
|
23
|
+
* (case-insensitive)
|
|
24
|
+
* @param {object} [options] a configuration object
|
|
25
|
+
* @param {string} [options.apiKey] an API key from
|
|
26
|
+
* https://haveibeenpwned.com/API/Key (default: undefined)
|
|
27
|
+
* @param {string} [options.baseUrl] a custom base URL for the
|
|
28
|
+
* haveibeenpwned.com API endpoints (default:
|
|
29
|
+
* `https://haveibeenpwned.com/api/v3`)
|
|
30
|
+
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
31
|
+
* (default: none)
|
|
32
|
+
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
33
|
+
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
34
|
+
* field in the request headers (default: `hibp <version>`)
|
|
35
|
+
* @returns {(Promise<BreachedAccountRangeResult[]> | Promise<null>)} a Promise
|
|
36
|
+
* which resolves to an array of range results (or null if none were found), or
|
|
37
|
+
* rejects with an Error
|
|
38
|
+
* @example
|
|
39
|
+
* try {
|
|
40
|
+
* const data = await breachedAccountRange("6B5917", { apiKey: "my-api-key" });
|
|
41
|
+
* const match = data?.find(
|
|
42
|
+
* ({ hashSuffix }) => hashSuffix === "C6C0AADE0C085843D66E4944E108C4A4CD",
|
|
43
|
+
* );
|
|
44
|
+
* // match?.websites: ["Adobe", "Gawker", "Stratfor"] in the documented example
|
|
45
|
+
* } catch (err) {
|
|
46
|
+
* // ...
|
|
47
|
+
* }
|
|
48
|
+
* @see https://haveibeenpwned.com/API/v3#BreachesForHashRange
|
|
49
|
+
*/
|
|
50
|
+
export function breachedAccountRange(prefix, options = {}) {
|
|
51
|
+
const { apiKey, baseUrl, timeoutMs, signal, userAgent } = options;
|
|
52
|
+
return fetchFromApi(`/breachedaccount/range/${encodeURIComponent(prefix)}`, {
|
|
53
|
+
apiKey,
|
|
54
|
+
baseUrl,
|
|
55
|
+
timeoutMs,
|
|
56
|
+
signal,
|
|
57
|
+
userAgent,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=breached-account-range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breached-account-range.js","sourceRoot":"","sources":["../../src/breached-account-range.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAc,EACd,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,OAAO,YAAY,CAAC,0BAA0B,kBAAkB,CAAC,MAAM,CAAC,EAAE,EAAE;QAC1E,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAiD,CAAC;AACrD,CAAC"}
|
|
@@ -1,12 +1,52 @@
|
|
|
1
|
-
import type { Breach } from
|
|
1
|
+
import type { Breach } from "./api/haveibeenpwned/types.js";
|
|
2
|
+
interface BreachedAccountOptions {
|
|
3
|
+
/**
|
|
4
|
+
* an API key from https://haveibeenpwned.com/API/Key (default: undefined)
|
|
5
|
+
*/
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
/**
|
|
8
|
+
* a domain by which to filter the results (default: all domains)
|
|
9
|
+
*/
|
|
10
|
+
domain?: string;
|
|
11
|
+
/**
|
|
12
|
+
* include "unverified" breaches in the results (default: true)
|
|
13
|
+
*/
|
|
14
|
+
includeUnverified?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* timeout for the request in milliseconds (default: none)
|
|
17
|
+
*/
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
/**
|
|
20
|
+
* an AbortSignal to cancel the request (default: none)
|
|
21
|
+
*/
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
/**
|
|
24
|
+
* truncate the results to only include the name of each breach (default:
|
|
25
|
+
* true)
|
|
26
|
+
*/
|
|
27
|
+
truncate?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* a custom base URL for the haveibeenpwned.com API endpoints (default:
|
|
30
|
+
* `https://haveibeenpwned.com/api/v3`)
|
|
31
|
+
*/
|
|
32
|
+
baseUrl?: string;
|
|
33
|
+
/**
|
|
34
|
+
* a custom string to send as the User-Agent field in the request headers
|
|
35
|
+
* (default: `hibp <version>`)
|
|
36
|
+
*/
|
|
37
|
+
userAgent?: string;
|
|
38
|
+
}
|
|
2
39
|
/**
|
|
3
40
|
* Fetches breach data for a specific account.
|
|
4
41
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
42
|
+
* Results contain only `Name` by default; pass `truncate: false` for full
|
|
43
|
+
* breaches.
|
|
44
|
+
*
|
|
45
|
+
* Requires a Core, Pro, or High RPM API key from
|
|
46
|
+
* https://haveibeenpwned.com/API/Key. The `apiKey` option here is not
|
|
47
|
+
* explicitly required, but direct requests made without it will fail (unless
|
|
48
|
+
* you specify a `baseUrl` to a proxy that inserts a valid API key on your
|
|
49
|
+
* behalf).
|
|
10
50
|
*
|
|
11
51
|
* @param {string} account a username or email address
|
|
12
52
|
* @param {object} [options] a configuration object
|
|
@@ -26,9 +66,9 @@ import type { Breach } from './api/haveibeenpwned/types.js';
|
|
|
26
66
|
* `https://haveibeenpwned.com/api/v3`)
|
|
27
67
|
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
28
68
|
* field in the request headers (default: `hibp <version>`)
|
|
29
|
-
* @returns {(Promise<Breach[]> | Promise<null>)} a Promise which
|
|
30
|
-
*
|
|
31
|
-
* an Error
|
|
69
|
+
* @returns {(Promise<Breach[]> | Promise<null>)} a Promise which
|
|
70
|
+
* resolves to name-only breaches by default, full breaches with
|
|
71
|
+
* `truncate: false`, or null if no breaches were found; rejects with an Error
|
|
32
72
|
* @example
|
|
33
73
|
* try {
|
|
34
74
|
* const data = await breachedAccount("foo", { apiKey: "my-api-key" });
|
|
@@ -71,40 +111,11 @@ import type { Breach } from './api/haveibeenpwned/types.js';
|
|
|
71
111
|
* // ...
|
|
72
112
|
* }
|
|
73
113
|
*/
|
|
74
|
-
export declare function breachedAccount(account: string, options?: {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* a domain by which to filter the results (default: all domains)
|
|
81
|
-
*/
|
|
82
|
-
domain?: string;
|
|
83
|
-
/**
|
|
84
|
-
* include "unverified" breaches in the results (default: true)
|
|
85
|
-
*/
|
|
86
|
-
includeUnverified?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* timeout for the request in milliseconds (default: none)
|
|
89
|
-
*/
|
|
90
|
-
timeoutMs?: number;
|
|
91
|
-
/**
|
|
92
|
-
* an AbortSignal to cancel the request (default: none)
|
|
93
|
-
*/
|
|
94
|
-
signal?: AbortSignal;
|
|
95
|
-
/**
|
|
96
|
-
* truncate the results to only include the name of each breach (default:
|
|
97
|
-
* true)
|
|
98
|
-
*/
|
|
99
|
-
truncate?: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* a custom base URL for the haveibeenpwned.com API endpoints (default:
|
|
102
|
-
* `https://haveibeenpwned.com/api/v3`)
|
|
103
|
-
*/
|
|
104
|
-
baseUrl?: string;
|
|
105
|
-
/**
|
|
106
|
-
* a custom string to send as the User-Agent field in the request headers
|
|
107
|
-
* (default: `hibp <version>`)
|
|
108
|
-
*/
|
|
109
|
-
userAgent?: string;
|
|
114
|
+
export declare function breachedAccount(account: string, options?: BreachedAccountOptions & {
|
|
115
|
+
truncate?: true;
|
|
116
|
+
}): Promise<Pick<Breach, "Name">[] | null>;
|
|
117
|
+
export declare function breachedAccount(account: string, options: BreachedAccountOptions & {
|
|
118
|
+
truncate: false;
|
|
110
119
|
}): Promise<Breach[] | null>;
|
|
120
|
+
export declare function breachedAccount(account: string, options?: BreachedAccountOptions): Promise<Breach[] | Pick<Breach, "Name">[] | null>;
|
|
121
|
+
export {};
|
|
@@ -1,76 +1,4 @@
|
|
|
1
|
-
import { fetchFromApi } from
|
|
2
|
-
/**
|
|
3
|
-
* Fetches breach data for a specific account.
|
|
4
|
-
*
|
|
5
|
-
* 🔑 `haveibeenpwned.com` requires an API key from
|
|
6
|
-
* https://haveibeenpwned.com/API/Key for the `breachedaccount` endpoint. The
|
|
7
|
-
* `apiKey` option here is not explicitly required, but direct requests made
|
|
8
|
-
* without it will fail (unless you specify a `baseUrl` to a proxy that inserts
|
|
9
|
-
* a valid API key on your behalf).
|
|
10
|
-
*
|
|
11
|
-
* @param {string} account a username or email address
|
|
12
|
-
* @param {object} [options] a configuration object
|
|
13
|
-
* @param {string} [options.apiKey] an API key from
|
|
14
|
-
* https://haveibeenpwned.com/API/Key (default: undefined)
|
|
15
|
-
* @param {string} [options.domain] a domain by which to filter the results
|
|
16
|
-
* (default: all domains)
|
|
17
|
-
* @param {boolean} [options.includeUnverified] include "unverified" breaches in
|
|
18
|
-
* the results (default: true)
|
|
19
|
-
* @param {number} [options.timeoutMs] timeout for the request in milliseconds
|
|
20
|
-
* (default: none)
|
|
21
|
-
* @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
|
|
22
|
-
* @param {boolean} [options.truncate] truncate the results to only include
|
|
23
|
-
* the name of each breach (default: true)
|
|
24
|
-
* @param {string} [options.baseUrl] a custom base URL for the
|
|
25
|
-
* haveibeenpwned.com API endpoints (default:
|
|
26
|
-
* `https://haveibeenpwned.com/api/v3`)
|
|
27
|
-
* @param {string} [options.userAgent] a custom string to send as the User-Agent
|
|
28
|
-
* field in the request headers (default: `hibp <version>`)
|
|
29
|
-
* @returns {(Promise<Breach[]> | Promise<null>)} a Promise which resolves to an
|
|
30
|
-
* array of breach objects (or null if no breaches were found), or rejects with
|
|
31
|
-
* an Error
|
|
32
|
-
* @example
|
|
33
|
-
* try {
|
|
34
|
-
* const data = await breachedAccount("foo", { apiKey: "my-api-key" });
|
|
35
|
-
* if (data) {
|
|
36
|
-
* // ...
|
|
37
|
-
* } else {
|
|
38
|
-
* // ...
|
|
39
|
-
* }
|
|
40
|
-
* } catch (err) {
|
|
41
|
-
* // ...
|
|
42
|
-
* }
|
|
43
|
-
* @example
|
|
44
|
-
* try {
|
|
45
|
-
* const data = await breachedAccount("bar", {
|
|
46
|
-
* includeUnverified: false,
|
|
47
|
-
* baseUrl: "https://my-hibp-proxy:8080",
|
|
48
|
-
* });
|
|
49
|
-
* if (data) {
|
|
50
|
-
* // ...
|
|
51
|
-
* } else {
|
|
52
|
-
* // ...
|
|
53
|
-
* }
|
|
54
|
-
* } catch (err) {
|
|
55
|
-
* // ...
|
|
56
|
-
* }
|
|
57
|
-
* @example
|
|
58
|
-
* try {
|
|
59
|
-
* const data = await breachedAccount("baz", {
|
|
60
|
-
* apiKey: "my-api-key",
|
|
61
|
-
* domain: "adobe.com",
|
|
62
|
-
* truncate: false,
|
|
63
|
-
* userAgent: "my-app 1.0",
|
|
64
|
-
* });
|
|
65
|
-
* if (data) {
|
|
66
|
-
* // ...
|
|
67
|
-
* } else {
|
|
68
|
-
* // ...
|
|
69
|
-
* }
|
|
70
|
-
* } catch (err) {
|
|
71
|
-
* // ...
|
|
72
|
-
* }
|
|
73
|
-
*/
|
|
1
|
+
import { fetchFromApi } from "./api/haveibeenpwned/fetch-from-api.js";
|
|
74
2
|
export function breachedAccount(account, options = {}) {
|
|
75
3
|
const { apiKey, domain, includeUnverified = true, timeoutMs, signal, truncate = true, baseUrl, userAgent, } = options;
|
|
76
4
|
const endpoint = `/breachedaccount/${encodeURIComponent(account)}?`;
|
|
@@ -79,12 +7,12 @@ export function breachedAccount(account, options = {}) {
|
|
|
79
7
|
params.push(`domain=${encodeURIComponent(domain)}`);
|
|
80
8
|
}
|
|
81
9
|
if (!includeUnverified) {
|
|
82
|
-
params.push(
|
|
10
|
+
params.push("includeUnverified=false");
|
|
83
11
|
}
|
|
84
12
|
if (!truncate) {
|
|
85
|
-
params.push(
|
|
13
|
+
params.push("truncateResponse=false");
|
|
86
14
|
}
|
|
87
|
-
return fetchFromApi(`${endpoint}${params.join(
|
|
15
|
+
return fetchFromApi(`${endpoint}${params.join("&")}`, {
|
|
88
16
|
apiKey,
|
|
89
17
|
baseUrl,
|
|
90
18
|
timeoutMs,
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"breached-account.js","sourceRoot":"","sources":["../../src/breached-account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AA+HtE,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,OAAO,GAA2B,EAAE;IAEpC,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,CAAsD,CAAC;AAC1D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BreachedDomainsByEmailAlias } from
|
|
1
|
+
import type { BreachedDomainsByEmailAlias } from "./api/haveibeenpwned/types.js";
|
|
2
2
|
/**
|
|
3
3
|
* An object mapping an email alias (local-part before the '@') to the list of
|
|
4
4
|
* breach names that alias has appeared in for the specified domain.
|
|
@@ -13,8 +13,7 @@ import type { BreachedDomainsByEmailAlias } from './api/haveibeenpwned/types.js'
|
|
|
13
13
|
* `{ "john": ["Adobe"], "jane": ["Adobe", "Gawker"] }`, corresponding to
|
|
14
14
|
* `john@example.com` and `jane@example.com`.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* https://haveibeenpwned.com/API/Key for the `breacheddomain` endpoint. The
|
|
16
|
+
* Requires a Core or Pro API key from https://haveibeenpwned.com/API/Key. The
|
|
18
17
|
* `apiKey` option here is not explicitly required, but direct requests made
|
|
19
18
|
* without it will fail (unless you specify a `baseUrl` to a proxy that inserts
|
|
20
19
|
* a valid API key on your behalf).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fetchFromApi } from
|
|
1
|
+
import { fetchFromApi } from "./api/haveibeenpwned/fetch-from-api.js";
|
|
2
2
|
/**
|
|
3
3
|
* An object mapping an email alias (local-part before the '@') to the list of
|
|
4
4
|
* breach names that alias has appeared in for the specified domain.
|
|
@@ -13,8 +13,7 @@ import { fetchFromApi } from './api/haveibeenpwned/fetch-from-api.js';
|
|
|
13
13
|
* `{ "john": ["Adobe"], "jane": ["Adobe", "Gawker"] }`, corresponding to
|
|
14
14
|
* `john@example.com` and `jane@example.com`.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* https://haveibeenpwned.com/API/Key for the `breacheddomain` endpoint. The
|
|
16
|
+
* Requires a Core or Pro API key from https://haveibeenpwned.com/API/Key. The
|
|
18
17
|
* `apiKey` option here is not explicitly required, but direct requests made
|
|
19
18
|
* without it will fail (unless you specify a `baseUrl` to a proxy that inserts
|
|
20
19
|
* a valid API key on your behalf).
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,OAAO,GAuBH,EAAE;IAEN,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,QAAQ,GAAG,mBAAmB,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;IAEjE,OAAO,YAAY,CAAC,QAAQ,EAAE;QAC5B,MAAM;QACN,OAAO;QACP,SAAS;QACT,MAAM;QACN,SAAS;KACV,CAAgD,CAAC;AACpD,CAAC"}
|
package/dist/esm/breaches.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { Breach } from
|
|
1
|
+
import type { Breach } from "./api/haveibeenpwned/types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Fetches all breach events in the system.
|
|
4
4
|
*
|
|
5
5
|
* @param {object} [options] a configuration object
|
|
6
6
|
* @param {string} [options.domain] a domain by which to filter the results
|
|
7
7
|
* (default: all domains)
|
|
8
|
+
* @param {boolean} [options.isSpamList] true for only spam-list breaches, false
|
|
9
|
+
* for only non-spam-list breaches (default: no spam-list filter)
|
|
8
10
|
* @param {string} [options.baseUrl] a custom base URL for the
|
|
9
11
|
* haveibeenpwned.com API endpoints (default:
|
|
10
12
|
* `https://haveibeenpwned.com/api/v3`)
|
|
@@ -28,7 +30,7 @@ import type { Breach } from './api/haveibeenpwned/types.js';
|
|
|
28
30
|
* }
|
|
29
31
|
* @example
|
|
30
32
|
* try {
|
|
31
|
-
* const data = await breaches({ domain: "adobe.com" });
|
|
33
|
+
* const data = await breaches({ domain: "adobe.com", isSpamList: false });
|
|
32
34
|
* if (data) {
|
|
33
35
|
* // ...
|
|
34
36
|
* } else {
|
|
@@ -43,6 +45,11 @@ export declare function breaches(options?: {
|
|
|
43
45
|
* a domain by which to filter the results (default: all domains)
|
|
44
46
|
*/
|
|
45
47
|
domain?: string;
|
|
48
|
+
/**
|
|
49
|
+
* true for only spam-list breaches, false for only non-spam-list breaches
|
|
50
|
+
* (default: no spam-list filter)
|
|
51
|
+
*/
|
|
52
|
+
isSpamList?: boolean;
|
|
46
53
|
/**
|
|
47
54
|
* a custom base URL for the haveibeenpwned.com API endpoints (default:
|
|
48
55
|
* `https://haveibeenpwned.com/api/v3`)
|