{"id":13452595,"url":"https://github.com/wKovacs64/hibp","last_synced_at":"2025-03-23T19:34:32.869Z","repository":{"id":37451174,"uuid":"55811054","full_name":"wKovacs64/hibp","owner":"wKovacs64","description":"An unofficial TypeScript SDK for the 'Have I been pwned?' service.","archived":false,"fork":false,"pushed_at":"2025-03-22T01:53:41.000Z","size":18898,"stargazers_count":116,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-22T10:35:19.892Z","etag":null,"topics":["breach","breach-events","breaches","data-breach","deno","dump","hack","haveibeenpwned","hibp","javascript","passwords","pastes","promise","pwned","security","typescript"],"latest_commit_sha":null,"homepage":"https://wkovacs64.github.io/hibp","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wKovacs64.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG-7.x.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"wKovacs64"}},"created_at":"2016-04-08T21:33:43.000Z","updated_at":"2025-03-22T01:53:44.000Z","dependencies_parsed_at":"2023-09-24T02:05:24.083Z","dependency_job_id":"571ead9c-57b7-4796-989b-bc185be271aa","html_url":"https://github.com/wKovacs64/hibp","commit_stats":{"total_commits":3976,"total_committers":9,"mean_commits":"441.77777777777777","dds":0.5186116700201207,"last_synced_commit":"06b1ff9db6c3337a1347387c264b2d62454915c9"},"previous_names":[],"tags_count":67,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wKovacs64%2Fhibp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wKovacs64%2Fhibp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wKovacs64%2Fhibp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wKovacs64%2Fhibp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wKovacs64","download_url":"https://codeload.github.com/wKovacs64/hibp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245090875,"owners_count":20559298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["breach","breach-events","breaches","data-breach","deno","dump","hack","haveibeenpwned","hibp","javascript","passwords","pastes","promise","pwned","security","typescript"],"created_at":"2024-07-31T07:01:28.609Z","updated_at":"2025-03-23T19:34:32.850Z","avatar_url":"https://github.com/wKovacs64.png","language":"TypeScript","funding_links":["https://github.com/sponsors/wKovacs64"],"categories":["TypeScript","typescript"],"sub_categories":[],"readme":"\u003ca href=\"https://wkovacs64.github.io/hibp\"\u003e\n  \u003cimg\n    alt=\"logo\"\n    title=\"logo\"\n    src=\"https://wkovacs64.github.io/hibp/logo.png\"\n    align=\"right\"\n    width=\"85\"\n  /\u003e\n\u003c/a\u003e\n\n# hibp\n\n_An unofficial TypeScript SDK for [Troy Hunt][troy]'s [Have I been pwned?][haveibeenpwned] service._\n\n[![npm Version][npm-image]][npm-url] [![Build Status][ci-image]][ci-url]\n[![Code Coverage][coverage-image]][coverage-url]\n[![All Contributors](https://img.shields.io/github/all-contributors/wKovacs64/hibp?style=flat-square)](#contributors-)\n\n## Installation\n\nIn Node.js:\n\n```shell\nnpm install hibp\n```\n\nIn [Deno][deno]:\n\n```ts\n// Replace x.y.z with the desired hibp version\nimport * as hibp from 'npm:hibp@x.y.z';\n```\n\nSee the [browser](#using-in-the-browser) section below for information on how to use it in the\nbrowser.\n\n## Features (🔑 = [requires][api-key-blog-post] an [API key][get-api-key])\n\n- Get a single breach event\n- Get all breaches for an account 🔑\n- Get all breach events in the system\n- Get all data classes\n- Get all pastes for an account 🔑\n- [Securely][search-by-range] check a password to see if it has been exposed in a data breach\n- Check a SHA-1 or NTLM prefix to see if it has been exposed in a data breach\n- Search for an account in both breaches and pastes at the same time 🔑\n- Get your subscription status 🔑\n- All queries return a Promise\n- Available server-side (Node.js) and client-side (browser)\n- Written in TypeScript, so all modules come fully typed\n\n## Usage\n\n##### ECMAScript module syntax:\n\n```javascript\n// import individual modules as needed\nimport { dataClasses, search } from 'hibp';\n// or, import all modules into a local namespace\nimport * as hibp from 'hibp';\n```\n\n##### CommonJS module syntax:\n\n```javascript\n// require individual modules as needed\nconst { dataClasses, search } = require('hibp');\n// or, require all modules into a local namespace\nconst hibp = require('hibp');\n```\n\nThe following modules are available:\n\n- [breach](API.md#breach)\n- [breachedAccount](API.md#breachedaccount)\n- [breaches](API.md#breaches)\n- [dataClasses](API.md#dataclasses)\n- [pasteAccount](API.md#pasteaccount)\n- [pwnedPassword](API.md#pwnedpassword)\n- [pwnedPasswordRange](API.md#pwnedpasswordrange)\n- [search](API.md#search)\n- [subscriptionStatus](API.md#subscriptionstatus)\n\nPlease see the [API reference](API.md) for more detailed usage information and examples.\n\n#### Quick-Start Example\n\n```javascript\nimport { search } from 'hibp';\n\nasync function main() {\n  try {\n    const data = await search('someAccountOrEmail', { apiKey: 'my-api-key' });\n    if (data.breaches || data.pastes) {\n      // Bummer...\n      console.log(data);\n    } else {\n      // Phew! We're clear.\n      console.log('Good news — no pwnage found!');\n    }\n  } catch (err) {\n    // Something went wrong.\n    console.log(err.message);\n  }\n}\n\nmain();\n```\n\n#### Rate Limiting\n\nThe haveibeenpwned.com API [rate limits][haveibeenpwned-rate-limiting] requests to prevent abuse. In\nthe event you get rate limited, the module will throw a custom `RateLimitError` which will include a\n`retryAfterSeconds` property so you know when you can try the call again (as a `number`, unless the\nremote API did not provide one, in which case it will be `undefined` - but that _should_ never\nhappen).\n\n#### Using in the browser\n\nYou have several options for using this library in a browser environment:\n\n1. Bundled\n\n   The most efficient and recommended method is to bundle it with client-side code using a module\n   bundler like [webpack][webpack] or, more likely, whatever your framework of choice uses under the\n   hood.\n\n1. UMD\n\n   There is also a Universal Module Definition (UMD) build provided for usage in the browser. When\n   using this build, an `hibp` object will be added to the browser's `window` object.\n\n   The recommended way to include the UMD build (when using a `\u003cscript\u003e` tag) is to use the\n   [unpkg][unpkg] CDN, specifying the exact version you want. If you don't specify a version, the\n   `latest` tag will be used, which could be dangerous if/when there are breaking changes made to\n   the API. See [unpkg][unpkg] for details and advanced version specification, but generally you\n   will want to do the following (replacing `x.y.z` with the version you want):\n\n   ```html\n   \u003cscript src=\"https://unpkg.com/hibp@x.y.z\"\u003e\u003c/script\u003e\n   ```\n\n1. ESM for Browsers\n\n   Modern browsers now [support][caniuse-esm] importing ECMAScript modules via\n   `\u003cscript type=\"module\"\u003e` tags. Like the UMD option above, this build is also available the\n   [unpkg][unpkg] CDN (and the same versioning rules apply), but you must specify the full path\n   (including the file extension). For example:\n\n   ```html\n   \u003cscript type=\"module\"\u003e\n     // Replace x.y.z with the desired hibp version      ↓ ↓ ↓\n     import { dataClasses } from 'https://unpkg.com/hibp@x.y.z/dist/browser/hibp.module.js';\n\n     const logDataClasses = async () =\u003e {\n       console.table(await dataClasses());\n     };\n\n     logDataClasses();\n   \u003c/script\u003e\n   ```\n\n   For more information on ESM in the browser, check out [Using JS modules in the\n   browser][js-modules].\n\n## Try It Out\n\n[Test hibp in your browser with StackBlitz.][stackblitz]\n\n## Projects Using hibp\n\n- [pwned][pwned] - a command-line tool for querying the '[Have I been pwned?][haveibeenpwned]'\n  service\n- [Password Lense][pwl] - a static web application to reveal character types in a password\n- [Plasmic](https://www.plasmic.app/) - the open-source visual builder for your tech stack\n- [Medplum](https://www.medplum.com/) - fast and easy healthcare dev\n- [Hasura Backend Plus](https://nhost.github.io/hasura-backend-plus/) - Authentication \u0026 Storage for\n  Hasura\n- [Staart API](https://staart.js.org/api/) - a Node.js backend starter for SaaS startups\n- [BanManager-WebUI](https://github.com/BanManagement/BanManager-WebUI) - Web interface for\n  BanManager\n\nSend me a [PR][pulls] or an email and I'll add yours to the list!\n\n## License\n\nThis module is distributed under the [MIT License][license].\n\n[npm-image]: https://img.shields.io/npm/v/hibp.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/hibp\n[ci-image]:\n  https://img.shields.io/github/actions/workflow/status/wKovacs64/hibp/ci.yml?logo=github\u0026style=flat-square\n[ci-url]: https://github.com/wKovacs64/hibp/actions?query=workflow%3Aci\n[coverage-image]: https://img.shields.io/codecov/c/github/wKovacs64/hibp/main.svg?style=flat-square\n[coverage-url]: https://codecov.io/gh/wKovacs64/hibp/branch/main\n[deno]: https://deno.land/\n[troy]: https://www.troyhunt.com\n[haveibeenpwned]: https://haveibeenpwned.com\n[haveibeenpwned-rate-limiting]: https://haveibeenpwned.com/API/v3#RateLimiting\n[search-by-range]: https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange\n[api-key-blog-post]: https://www.troyhunt.com/authentication-and-the-have-i-been-pwned-api/\n[get-api-key]: https://haveibeenpwned.com/API/Key\n[unpkg]: https://unpkg.com\n[caniuse-esm]: https://caniuse.com/#feat=es6-module\n[js-modules]: https://v8.dev/features/modules#browser\n[webpack]: https://webpack.js.org\n[stackblitz]: https://stackblitz.com/edit/stackblitz-starters-atyrc52c?file=index.js\n[pwned]: https://github.com/wKovacs64/pwned\n[pulls]: https://github.com/wKovacs64/hibp/pulls\n[pwl]: https://pwl.netlify.com/\n[license]: https://github.com/wKovacs64/hibp/tree/main/LICENSE.txt\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/wKovacs64\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1288694?v=4?s=100\" width=\"100px;\" alt=\"Justin Hall\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJustin Hall\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/wKovacs64/hibp/commits?author=wKovacs64\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/wKovacs64/hibp/commits?author=wKovacs64\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#infra-wKovacs64\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e \u003ca href=\"#maintenance-wKovacs64\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/wKovacs64/hibp/pulls?q=is%3Apr+reviewed-by%3AwKovacs64\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e \u003ca href=\"https://github.com/wKovacs64/hibp/commits?author=wKovacs64\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://www.troyhunt.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/273244?v=4?s=100\" width=\"100px;\" alt=\"Troy Hunt\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eTroy Hunt\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#data-troyhunt\" title=\"Data\"\u003e🔣\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://jellekralt.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/214558?v=4?s=100\" width=\"100px;\" alt=\"Jelle Kralt\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJelle Kralt\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/wKovacs64/hibp/commits?author=jellekralt\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/timaschew\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/110870?v=4?s=100\" width=\"100px;\" alt=\"Anton W\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAnton W\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/wKovacs64/hibp/issues?q=author%3Atimaschew\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/danieladams456\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/3953840?v=4?s=100\" width=\"100px;\" alt=\"Daniel Adams\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDaniel Adams\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/wKovacs64/hibp/commits?author=danieladams456\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://twitter.com/d0gb3r7\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/454308?v=4?s=100\" width=\"100px;\" alt=\"Markus Dolic\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMarkus Dolic\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/wKovacs64/hibp/issues?q=author%3Ayelworc\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/textbook/about\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/785939?v=4?s=100\" width=\"100px;\" alt=\"Jonathan Sharpe\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJonathan Sharpe\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/wKovacs64/hibp/commits?author=textbook\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/ArcadeRenegade\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/13874898?v=4?s=100\" width=\"100px;\" alt=\"Ryan\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRyan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/wKovacs64/hibp/issues?q=author%3AArcadeRenegade\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/PodStuart\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/107403965?v=4?s=100\" width=\"100px;\" alt=\"Stuart McGregor\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eStuart McGregor\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/wKovacs64/hibp/issues?q=author%3APodStuart\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors)\nspecification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FwKovacs64%2Fhibp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FwKovacs64%2Fhibp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FwKovacs64%2Fhibp/lists"}