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.
Files changed (84) hide show
  1. package/API.md +433 -126
  2. package/CHANGELOG.md +50 -0
  3. package/MIGRATION.md +7 -5
  4. package/README.md +53 -27
  5. package/dist/browser/hibp.module.js +2 -2
  6. package/dist/esm/api/base-fetch.d.ts +3 -1
  7. package/dist/esm/api/base-fetch.js +20 -7
  8. package/dist/esm/api/base-fetch.js.map +1 -1
  9. package/dist/esm/api/haveibeenpwned/fetch-from-api.d.ts +1 -1
  10. package/dist/esm/api/haveibeenpwned/fetch-from-api.js +71 -24
  11. package/dist/esm/api/haveibeenpwned/fetch-from-api.js.map +1 -1
  12. package/dist/esm/api/haveibeenpwned/package-info.d.ts +1 -1
  13. package/dist/esm/api/haveibeenpwned/package-info.js +1 -1
  14. package/dist/esm/api/haveibeenpwned/post-to-api.d.ts +1 -0
  15. package/dist/esm/api/haveibeenpwned/post-to-api.js +31 -0
  16. package/dist/esm/api/haveibeenpwned/post-to-api.js.map +1 -0
  17. package/dist/esm/api/haveibeenpwned/responses.js +8 -7
  18. package/dist/esm/api/haveibeenpwned/responses.js.map +1 -1
  19. package/dist/esm/api/haveibeenpwned/types.d.ts +22 -2
  20. package/dist/esm/api/pwnedpasswords/fetch-from-api.js +4 -4
  21. package/dist/esm/api/pwnedpasswords/fetch-from-api.js.map +1 -1
  22. package/dist/esm/api/pwnedpasswords/responses.js +1 -1
  23. package/dist/esm/breach.d.ts +8 -1
  24. package/dist/esm/breach.js +8 -1
  25. package/dist/esm/breach.js.map +1 -1
  26. package/dist/esm/breached-account-range.d.ts +73 -0
  27. package/dist/esm/breached-account-range.js +60 -0
  28. package/dist/esm/breached-account-range.js.map +1 -0
  29. package/dist/esm/breached-account.d.ts +56 -45
  30. package/dist/esm/breached-account.js +4 -76
  31. package/dist/esm/breached-account.js.map +1 -1
  32. package/dist/esm/breached-domain.d.ts +2 -3
  33. package/dist/esm/breached-domain.js +2 -3
  34. package/dist/esm/breached-domain.js.map +1 -1
  35. package/dist/esm/breaches.d.ts +9 -2
  36. package/dist/esm/breaches.js +10 -5
  37. package/dist/esm/breaches.js.map +1 -1
  38. package/dist/esm/data-class-descriptions.d.ts +55 -0
  39. package/dist/esm/data-class-descriptions.js +39 -0
  40. package/dist/esm/data-class-descriptions.js.map +1 -0
  41. package/dist/esm/data-classes.js +2 -2
  42. package/dist/esm/data-classes.js.map +1 -1
  43. package/dist/esm/generate-dns-token.d.ts +67 -0
  44. package/dist/esm/generate-dns-token.js +48 -0
  45. package/dist/esm/generate-dns-token.js.map +1 -0
  46. package/dist/esm/hibp.d.ts +28 -18
  47. package/dist/esm/hibp.js +23 -18
  48. package/dist/esm/hibp.js.map +1 -1
  49. package/dist/esm/latest-breach.d.ts +1 -1
  50. package/dist/esm/latest-breach.js +2 -2
  51. package/dist/esm/latest-breach.js.map +1 -1
  52. package/dist/esm/paste-account.d.ts +8 -8
  53. package/dist/esm/paste-account.js +8 -8
  54. package/dist/esm/paste-account.js.map +1 -1
  55. package/dist/esm/pwned-password-range.d.ts +1 -1
  56. package/dist/esm/pwned-password-range.js +4 -4
  57. package/dist/esm/pwned-password-range.js.map +1 -1
  58. package/dist/esm/pwned-password.js +6 -6
  59. package/dist/esm/pwned-password.js.map +1 -1
  60. package/dist/esm/search.d.ts +57 -40
  61. package/dist/esm/search.js +3 -72
  62. package/dist/esm/search.js.map +1 -1
  63. package/dist/esm/send-email.d.ts +69 -0
  64. package/dist/esm/send-email.js +49 -0
  65. package/dist/esm/send-email.js.map +1 -0
  66. package/dist/esm/stealer-logs-by-email-domain.d.ts +8 -9
  67. package/dist/esm/stealer-logs-by-email-domain.js +8 -9
  68. package/dist/esm/stealer-logs-by-email-domain.js.map +1 -1
  69. package/dist/esm/stealer-logs-by-email.d.ts +4 -5
  70. package/dist/esm/stealer-logs-by-email.js +5 -6
  71. package/dist/esm/stealer-logs-by-email.js.map +1 -1
  72. package/dist/esm/stealer-logs-by-website-domain.d.ts +4 -5
  73. package/dist/esm/stealer-logs-by-website-domain.js +5 -6
  74. package/dist/esm/stealer-logs-by-website-domain.js.map +1 -1
  75. package/dist/esm/subscribed-domains.d.ts +2 -3
  76. package/dist/esm/subscribed-domains.js +3 -4
  77. package/dist/esm/subscribed-domains.js.map +1 -1
  78. package/dist/esm/subscription-status.d.ts +11 -6
  79. package/dist/esm/subscription-status.js +12 -7
  80. package/dist/esm/subscription-status.js.map +1 -1
  81. package/dist/esm/verify-dns-token.d.ts +60 -0
  82. package/dist/esm/verify-dns-token.js +41 -0
  83. package/dist/esm/verify-dns-token.js.map +1 -0
  84. package/package.json +74 -75
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Verifies a domain's published HIBP TXT record.
3
+ *
4
+ * Generate the value with `generateDnsToken`, publish it at your DNS provider,
5
+ * and allow time for DNS propagation first. The record can be removed after
6
+ * verification succeeds.
7
+ *
8
+ * Requires a Pro API key from https://haveibeenpwned.com/API/Key. The `apiKey`
9
+ * option here is not explicitly required, but direct requests made without it
10
+ * will fail (unless you specify a `baseUrl` to a proxy that inserts a valid API
11
+ * key on your behalf).
12
+ *
13
+ * @see https://haveibeenpwned.com/API/v3#VerifyDomainViaDns
14
+ * @param {string} domain the domain to verify (e.g., "example.com")
15
+ * @param {object} [options] a configuration object
16
+ * @param {string} [options.apiKey] an API key from
17
+ * https://haveibeenpwned.com/API/Key (default: undefined)
18
+ * @param {string} [options.baseUrl] a custom base URL for the
19
+ * haveibeenpwned.com API endpoints (default:
20
+ * `https://haveibeenpwned.com/api/v3`)
21
+ * @param {number} [options.timeoutMs] timeout for the request in milliseconds
22
+ * (default: none)
23
+ * @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
24
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
25
+ * field in the request headers (default: `hibp <version>`)
26
+ * @returns {Promise<void>} a Promise which resolves without parsing the
27
+ * response body when verification succeeds, or rejects with an Error
28
+ * containing the upstream failure reason
29
+ * @example
30
+ * try {
31
+ * await verifyDnsToken("example.com", { apiKey: "my-api-key" });
32
+ * // ...
33
+ * } catch (err) {
34
+ * // ...
35
+ * }
36
+ */
37
+ export declare function verifyDnsToken(domain: string, options?: {
38
+ /**
39
+ * an API key from https://haveibeenpwned.com/API/Key (default: undefined)
40
+ */
41
+ apiKey?: string;
42
+ /**
43
+ * a custom base URL for the haveibeenpwned.com API endpoints (default:
44
+ * `https://haveibeenpwned.com/api/v3`)
45
+ */
46
+ baseUrl?: string;
47
+ /**
48
+ * timeout for the request in milliseconds (default: none)
49
+ */
50
+ timeoutMs?: number;
51
+ /**
52
+ * an AbortSignal to cancel the request (default: none)
53
+ */
54
+ signal?: AbortSignal;
55
+ /**
56
+ * a custom string to send as the User-Agent field in the request headers
57
+ * (default: `hibp <version>`)
58
+ */
59
+ userAgent?: string;
60
+ }): Promise<void>;
@@ -0,0 +1,41 @@
1
+ import { postToApi } from "./api/haveibeenpwned/post-to-api.js";
2
+ /**
3
+ * Verifies a domain's published HIBP TXT record.
4
+ *
5
+ * Generate the value with `generateDnsToken`, publish it at your DNS provider,
6
+ * and allow time for DNS propagation first. The record can be removed after
7
+ * verification succeeds.
8
+ *
9
+ * Requires a Pro API key from https://haveibeenpwned.com/API/Key. The `apiKey`
10
+ * option here is not explicitly required, but direct requests made without it
11
+ * will fail (unless you specify a `baseUrl` to a proxy that inserts a valid API
12
+ * key on your behalf).
13
+ *
14
+ * @see https://haveibeenpwned.com/API/v3#VerifyDomainViaDns
15
+ * @param {string} domain the domain to verify (e.g., "example.com")
16
+ * @param {object} [options] a configuration object
17
+ * @param {string} [options.apiKey] an API key from
18
+ * https://haveibeenpwned.com/API/Key (default: undefined)
19
+ * @param {string} [options.baseUrl] a custom base URL for the
20
+ * haveibeenpwned.com API endpoints (default:
21
+ * `https://haveibeenpwned.com/api/v3`)
22
+ * @param {number} [options.timeoutMs] timeout for the request in milliseconds
23
+ * (default: none)
24
+ * @param {AbortSignal} [options.signal] an AbortSignal to cancel the request (default: none)
25
+ * @param {string} [options.userAgent] a custom string to send as the User-Agent
26
+ * field in the request headers (default: `hibp <version>`)
27
+ * @returns {Promise<void>} a Promise which resolves without parsing the
28
+ * response body when verification succeeds, or rejects with an Error
29
+ * containing the upstream failure reason
30
+ * @example
31
+ * try {
32
+ * await verifyDnsToken("example.com", { apiKey: "my-api-key" });
33
+ * // ...
34
+ * } catch (err) {
35
+ * // ...
36
+ * }
37
+ */
38
+ export async function verifyDnsToken(domain, options = {}) {
39
+ await postToApi("/domainVerification/verifyDnsToken", { DomainName: domain }, options);
40
+ }
41
+ //# sourceMappingURL=verify-dns-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-dns-token.js","sourceRoot":"","sources":["../../src/verify-dns-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,OAAO,GAuBH,EAAE;IAEN,MAAM,SAAS,CACb,oCAAoC,EACpC,EAAE,UAAU,EAAE,MAAM,EAAE,EACtB,OAAO,CACR,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,111 +1,110 @@
1
1
  {
2
2
  "name": "hibp",
3
- "version": "15.2.0",
3
+ "version": "16.0.0",
4
+ "private": false,
4
5
  "description": "An unofficial TypeScript SDK for the 'Have I been pwned?' service.",
5
6
  "keywords": [
7
+ "breach",
8
+ "client",
9
+ "dump",
10
+ "hack",
6
11
  "haveibeenpwned",
7
12
  "hibp",
8
- "pwned",
9
- "security",
10
- "hack",
11
- "dump",
12
- "breach",
13
- "pastes",
14
13
  "passwords",
15
- "client"
14
+ "pastes",
15
+ "pwned",
16
+ "security"
16
17
  ],
18
+ "homepage": "https://wkovacs64.github.io/hibp",
19
+ "bugs": {
20
+ "url": "https://github.com/wKovacs64/hibp/issues"
21
+ },
22
+ "license": "MIT",
17
23
  "author": {
18
24
  "name": "Justin Hall",
19
25
  "email": "justin.r.hall@gmail.com"
20
26
  },
21
- "license": "MIT",
22
- "exports": {
23
- ".": {
24
- "browser": "./dist/browser/hibp.module.js",
25
- "default": "./dist/esm/hibp.js"
26
- },
27
- "./package.json": "./package.json"
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/wKovacs64/hibp.git"
28
30
  },
29
- "type": "module",
30
- "main": "dist/esm/hibp.js",
31
- "module": "dist/esm/hibp.js",
32
31
  "files": [
33
32
  "dist",
34
33
  "API.md",
35
34
  "CHANGELOG.md",
36
35
  "MIGRATION.md"
37
36
  ],
37
+ "type": "module",
38
38
  "sideEffects": false,
39
+ "main": "dist/esm/hibp.js",
40
+ "module": "dist/esm/hibp.js",
41
+ "exports": {
42
+ ".": {
43
+ "browser": "./dist/browser/hibp.module.js",
44
+ "default": "./dist/esm/hibp.js"
45
+ },
46
+ "./package.json": "./package.json"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "devDependencies": {
52
+ "@arethetypeswrong/cli": "0.18.5",
53
+ "@babel/core": "8.0.9",
54
+ "@babel/preset-env": "8.0.7",
55
+ "@babel/preset-typescript": "8.0.7",
56
+ "@changesets/changelog-github": "1.0.1",
57
+ "@changesets/cli": "3.0.3",
58
+ "@playwright/test": "1.64.1",
59
+ "@types/common-tags": "1.8.4",
60
+ "@types/node": "22.20.5",
61
+ "@vitest/coverage-v8": "5.0.5",
62
+ "@wkovacs64/oxlint-config": "0.4.0",
63
+ "bundlewatch": "1.1.0",
64
+ "common-tags": "1.8.2",
65
+ "cross-env": "10.1.0",
66
+ "esbuild": "0.28.2",
67
+ "jsdoc-babel": "0.5.0",
68
+ "jsdoc-to-markdown": "9.1.3",
69
+ "msw": "3.0.3",
70
+ "npm-run-all2": "9.0.4",
71
+ "oxfmt": "0.74.0",
72
+ "oxlint": "1.89.0",
73
+ "oxlint-tsgolint": "7.0.2005",
74
+ "pathe": "2.0.3",
75
+ "rimraf": "6.1.3",
76
+ "serve": "14.2.6",
77
+ "typescript": "7.0.2",
78
+ "vitest": "5.0.5"
79
+ },
80
+ "engines": {
81
+ "node": ">= 22.12.0"
82
+ },
39
83
  "scripts": {
40
84
  "build": "run-s --silent build:package-info build:lib build:browser build:docs",
41
85
  "build:package-info": "node --experimental-strip-types scripts/build-package-info.ts",
42
86
  "build:lib": "tsc --project tsconfig.tsc.json",
43
87
  "build:browser": "esbuild src/hibp.ts --minify --bundle --format=esm --platform=browser --tsconfig=tsconfig.esbuild.json --outfile=dist/browser/hibp.module.js",
44
- "build:docs": "jsdoc2md --no-cache --files src/*.ts --configure jsdoc2md.json > API.md && node scripts/fix-api-docs.js",
88
+ "build:docs": "jsdoc2md --no-cache --files 'src/*.ts' --configure jsdoc2md.json > API.md && node scripts/fix-api-docs.js",
45
89
  "changeset": "changeset",
46
- "changeset:version": "changeset version && npm install --package-lock-only",
90
+ "changeset:version": "changeset version && pnpm install",
47
91
  "changeset:publish": "changeset publish",
48
92
  "typecheck": "tsc --noEmit",
49
93
  "clean": "rimraf dist coverage",
50
- "format": "prettier --cache --write .",
51
- "format:check": "prettier --cache --check .",
52
- "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
53
- "prebuild": "npm run --silent clean",
54
- "prepublishOnly": "npm run build",
94
+ "format": "oxfmt --write .",
95
+ "format:check": "oxfmt --check .",
96
+ "lint": "oxlint",
97
+ "prebuild": "pnpm run --silent clean",
55
98
  "size": "bundlewatch --config .bundlewatch.config.json",
56
- "pretest": "npm run --silent build:package-info",
99
+ "pretest": "pnpm run --silent build:package-info",
57
100
  "test": "vitest run",
58
- "pretest:coverage": "npm run --silent build:package-info",
101
+ "pretest:coverage": "pnpm run --silent build:package-info",
59
102
  "test:coverage": "vitest run --coverage",
60
- "pretest:browser:open": "run-s --silent build:package-info build:browser",
103
+ "pretest:browser:open": "pnpm run --silent build:package-info && pnpm run --silent build:browser",
61
104
  "test:browser:open": "playwright test --ui",
62
- "pretest:browser:run": "run-s --silent build:package-info build:browser",
105
+ "pretest:browser:run": "pnpm run --silent build:package-info && pnpm run --silent build:browser",
63
106
  "test:browser:run": "playwright test",
64
- "pretest:watch": "npm run --silent build:package-info",
107
+ "pretest:watch": "pnpm run --silent build:package-info",
65
108
  "test:watch": "vitest watch"
66
- },
67
- "private": false,
68
- "publishConfig": {
69
- "access": "public"
70
- },
71
- "repository": {
72
- "url": "git+https://github.com/wKovacs64/hibp.git"
73
- },
74
- "bugs": {
75
- "url": "https://github.com/wKovacs64/hibp/issues"
76
- },
77
- "homepage": "https://wkovacs64.github.io/hibp",
78
- "engines": {
79
- "node": ">= 20.19.0"
80
- },
81
- "devDependencies": {
82
- "@arethetypeswrong/cli": "0.18.2",
83
- "@babel/plugin-proposal-class-properties": "7.18.6",
84
- "@babel/plugin-proposal-object-rest-spread": "7.20.7",
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
- "@types/common-tags": "1.8.4",
91
- "@types/node": "24.10.1",
92
- "@vitest/coverage-v8": "4.0.14",
93
- "@wkovacs64/eslint-config": "7.11.1",
94
- "@wkovacs64/prettier-config": "4.2.2",
95
- "bundlewatch": "0.4.1",
96
- "common-tags": "1.8.2",
97
- "cross-env": "10.1.0",
98
- "esbuild": "0.27.0",
99
- "eslint": "9.39.1",
100
- "jsdoc-babel": "0.5.0",
101
- "jsdoc-to-markdown": "9.1.3",
102
- "msw": "2.12.3",
103
- "npm-run-all2": "8.0.4",
104
- "pathe": "2.0.3",
105
- "prettier": "3.7.3",
106
- "rimraf": "6.1.2",
107
- "serve": "14.2.5",
108
- "typescript": "5.9.3",
109
- "vitest": "4.0.14"
110
109
  }
111
- }
110
+ }