hibp 11.0.0 → 11.1.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/README.md +10 -0
- package/dist/browser/hibp.module.js +1 -1
- package/dist/browser/hibp.module.js.map +1 -1
- package/dist/browser/hibp.umd.js +1 -1
- package/dist/browser/hibp.umd.js.map +1 -1
- package/dist/cjs/api/haveibeenpwned/fetchFromApi.js +33 -5
- package/dist/cjs/api/haveibeenpwned/fetchFromApi.js.map +1 -1
- package/dist/cjs/api/haveibeenpwned/index.js +1 -0
- package/dist/cjs/api/haveibeenpwned/index.js.map +1 -1
- package/dist/cjs/api/haveibeenpwned/responses.js +1 -1
- package/dist/cjs/api/haveibeenpwned/responses.js.map +1 -1
- package/dist/cjs/api/pwnedpasswords/fetchFromApi.js +2 -4
- package/dist/cjs/api/pwnedpasswords/fetchFromApi.js.map +1 -1
- package/dist/cjs/api/pwnedpasswords/responses.js.map +1 -1
- package/dist/cjs/breach.js.map +1 -1
- package/dist/cjs/breachedAccount.js.map +1 -1
- package/dist/cjs/breaches.js.map +1 -1
- package/dist/cjs/dataClasses.js.map +1 -1
- package/dist/cjs/hibp.js +3 -0
- package/dist/cjs/hibp.js.map +1 -1
- package/dist/cjs/package.json.js +1 -1
- package/dist/cjs/pasteAccount.js.map +1 -1
- package/dist/cjs/pwnedPassword.js +1 -1
- package/dist/cjs/pwnedPassword.js.map +1 -1
- package/dist/cjs/pwnedPasswordRange.js +1 -1
- package/dist/cjs/pwnedPasswordRange.js.map +1 -1
- package/dist/cjs/search.js.map +1 -1
- package/dist/esm/api/haveibeenpwned/fetchFromApi.mjs +31 -5
- package/dist/esm/api/haveibeenpwned/fetchFromApi.mjs.map +1 -1
- package/dist/esm/api/haveibeenpwned/index.mjs +1 -1
- package/dist/esm/api/haveibeenpwned/responses.mjs +1 -1
- package/dist/esm/api/haveibeenpwned/responses.mjs.map +1 -1
- package/dist/esm/api/pwnedpasswords/fetchFromApi.mjs +1 -3
- package/dist/esm/api/pwnedpasswords/fetchFromApi.mjs.map +1 -1
- package/dist/esm/api/pwnedpasswords/responses.mjs.map +1 -1
- package/dist/esm/breach.mjs.map +1 -1
- package/dist/esm/breachedAccount.mjs.map +1 -1
- package/dist/esm/breaches.mjs.map +1 -1
- package/dist/esm/dataClasses.mjs.map +1 -1
- package/dist/esm/hibp.mjs +1 -0
- package/dist/esm/hibp.mjs.map +1 -1
- package/dist/esm/package.mjs +1 -1
- package/dist/esm/pasteAccount.mjs.map +1 -1
- package/dist/esm/pwnedPassword.mjs.map +1 -1
- package/dist/esm/pwnedPasswordRange.mjs +1 -1
- package/dist/esm/pwnedPasswordRange.mjs.map +1 -1
- package/dist/esm/search.mjs.map +1 -1
- package/dist/hibp.d.ts +22 -1
- package/package.json +49 -53
- package/CHANGELOG.md +0 -356
package/README.md
CHANGED
|
@@ -106,6 +106,15 @@ search('someAccountOrEmail', { apiKey: 'my-api-key' })
|
|
|
106
106
|
});
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
+
#### Rate Limiting
|
|
110
|
+
|
|
111
|
+
The haveibeenpwned.com API [rate limits][haveibeenpwned-rate-limiting] requests
|
|
112
|
+
to prevent abuse. In the event you get rate limited, the module will throw a
|
|
113
|
+
custom `RateLimitError` which will include a `retryAfterSeconds` property so you
|
|
114
|
+
know when you can try the call again (as a `number`, unless the remote API did
|
|
115
|
+
not provide one, in which case it will be `undefined` - but that _should_ never
|
|
116
|
+
happen).
|
|
117
|
+
|
|
109
118
|
#### Using in the browser
|
|
110
119
|
|
|
111
120
|
**Prerequisite:** This module requires a Promise implementation to exist in the
|
|
@@ -202,6 +211,7 @@ This module is distributed under the [MIT License][license].
|
|
|
202
211
|
[skypack]: https://www.skypack.dev/
|
|
203
212
|
[troy]: https://www.troyhunt.com
|
|
204
213
|
[haveibeenpwned]: https://haveibeenpwned.com
|
|
214
|
+
[haveibeenpwned-rate-limiting]: https://haveibeenpwned.com/API/v3#RateLimiting
|
|
205
215
|
[search-by-range]:
|
|
206
216
|
https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange
|
|
207
217
|
[api-key-blog-post]:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})})),e}var e=t(Object.freeze({__proto__:null,default:function(t,e){return e=e||{},new Promise((function(n,r){var s=new XMLHttpRequest,o=[],i=[],u={},h=function(){return{ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:h,headers:{keys:function(){return o},entries:function(){return i},get:function(t){return u[t.toLowerCase()]},has:function(t){return t.toLowerCase()in u}}}};for(var a in s.open(e.method||"get",t,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(t,e,n){o.push(e=e.toLowerCase()),i.push([e,n]),u[e]=u[e]?u[e]+","+n:n})),n(h())},s.onerror=r,s.withCredentials="include"==e.credentials,e.headers)s.setRequestHeader(a,e.headers[a]);s.send(e.body||null)}))}})),n=self.fetch||(self.fetch=e.default||e);new Map;const r=400,s="Bad request — the account does not comply with an acceptable format.",o=401,i=403,u="Forbidden - access denied.",h=404,a=429;function c(t,{apiKey:e,baseUrl:c="https://haveibeenpwned.com/api/v3",userAgent:f}={}){const l={};e&&(l["HIBP-API-Key"]=e),f&&(l["User-Agent"]=f),f||"undefined"!=typeof navigator||(l["User-Agent"]="hibp 11.0.0");const p={headers:l},d=`${c.replace(/\/$/g,"")}${t}`;return n(d,p).then(t=>{if(t.ok)return t.json();switch(t.status){case r:throw Error(s);case o:return t.json().then(t=>{throw Error(t.message)});case i:{const e=t.headers.get("cf-ray");if(e)throw Error(function(t){return`Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ${t})`}(e));throw Error(u)}case h:return null;case a:return t.json().then(t=>{throw Error(t.message)});default:throw Error(t.statusText)}})}function f(t,e={}){return c("/breach/"+encodeURIComponent(t),e)}function l(t,e={includeUnverified:!0,truncate:!0}){const n=`/breachedaccount/${encodeURIComponent(t)}?`,r=[];return e.domain&&r.push("domain="+encodeURIComponent(e.domain)),!1===e.includeUnverified&&r.push("includeUnverified=false"),!1===e.truncate&&r.push("truncateResponse=false"),c(`${n}${r.join("&")}`,{apiKey:e.apiKey,baseUrl:e.baseUrl,userAgent:e.userAgent})}function p(t={}){const e=[];return t.domain&&e.push("domain="+encodeURIComponent(t.domain)),c("/breaches?"+e.join("&"),{baseUrl:t.baseUrl,userAgent:t.userAgent})}function d(t={}){return c("/dataclasses",t)}function g(t,e={}){return c("/pasteaccount/"+encodeURIComponent(t),{apiKey:e.apiKey,baseUrl:e.baseUrl,userAgent:e.userAgent})}const A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function U(t,e,n,r){let s,o,i;const u=e||[0],h=(n=n||0)>>>3,a=-1===r?3:0;for(s=0;t.length>s;s+=1)i=s+h,o=i>>>2,o>=u.length&&u.push(0),u[o]|=t[s]<<8*(a+r*(i%4));return{value:u,binLen:8*t.length+n}}function m(t,e,n){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":return function(t,e,r){return function(t,e,n,r){let s,o,i,u;if(0!=t.length%2)throw Error("String of HEX type must be in byte increments");const h=e||[0],a=(n=n||0)>>>3,c=-1===r?3:0;for(s=0;t.length>s;s+=2){if(o=parseInt(t.substr(s,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(u=(s>>>1)+a,i=u>>>2;i>=h.length;)h.push(0);h[i]|=o<<8*(c+r*(u%4))}return{value:h,binLen:4*t.length+n}}(t,e,r,n)};case"TEXT":return function(t,r,s){return function(t,e,n,r,s){let o,i,u,h,a,c,f,l,p=0;const d=n||[0],g=(r=r||0)>>>3;if("UTF8"===e)for(f=-1===s?3:0,u=0;t.length>u;u+=1)for(o=t.charCodeAt(u),i=[],128>o?i.push(o):2048>o?(i.push(192|o>>>6),i.push(128|63&o)):55296>o||o>=57344?i.push(224|o>>>12,128|o>>>6&63,128|63&o):(u+=1,o=65536+((1023&o)<<10|1023&t.charCodeAt(u)),i.push(240|o>>>18,128|o>>>12&63,128|o>>>6&63,128|63&o)),h=0;i.length>h;h+=1){for(c=p+g,a=c>>>2;a>=d.length;)d.push(0);d[a]|=i[h]<<8*(f+s*(c%4)),p+=1}else for(f=-1===s?2:0,l="UTF16LE"===e&&1!==s||"UTF16LE"!==e&&1===s,u=0;t.length>u;u+=1){for(o=t.charCodeAt(u),!0===l&&(h=255&o,o=h<<8|o>>>8),c=p+g,a=c>>>2;a>=d.length;)d.push(0);d[a]|=o<<8*(f+s*(c%4)),p+=2}return{value:d,binLen:8*p+r}}(t,e,r,s,n)};case"B64":return function(t,e,r){return function(t,e,n,r){let s,o,i,u,h,a,c,f=0;const l=e||[0],p=(n=n||0)>>>3,d=-1===r?3:0,g=t.indexOf("=");if(-1===t.search(/^[a-zA-Z0-9=+/]+$/))throw Error("Invalid character in base-64 string");if(t=t.replace(/=/g,""),-1!==g&&t.length>g)throw Error("Invalid '=' found in base-64 string");for(o=0;t.length>o;o+=4){for(h=t.substr(o,4),u=0,i=0;h.length>i;i+=1)s=A.indexOf(h.charAt(i)),u|=s<<18-6*i;for(i=0;h.length-1>i;i+=1){for(c=f+p,a=c>>>2;a>=l.length;)l.push(0);l[a]|=(u>>>16-8*i&255)<<8*(d+r*(c%4)),f+=1}}return{value:l,binLen:8*f+n}}(t,e,r,n)};case"BYTES":return function(t,e,r){return function(t,e,n,r){let s,o,i,u;const h=e||[0],a=(n=n||0)>>>3,c=-1===r?3:0;for(o=0;t.length>o;o+=1)s=t.charCodeAt(o),u=o+a,i=u>>>2,i>=h.length&&h.push(0),h[i]|=s<<8*(c+r*(u%4));return{value:h,binLen:8*t.length+n}}(t,e,r,n)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}return function(t,e,r){return function(t,e,n,r){return U(new Uint8Array(t),e,n,r)}(t,e,r,n)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}return function(t,e,r){return U(t,e,r,n)};default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function b(t,e,n,r){switch(t){case"HEX":return function(t){return function(t,e,n,r){let s,o,i="";const u=e/8,h=-1===n?3:0;for(s=0;u>s;s+=1)o=t[s>>>2]>>>8*(h+n*(s%4)),i+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return r.outputUpper?i.toUpperCase():i}(t,e,n,r)};case"B64":return function(t){return function(t,e,n,r){let s,o,i,u,h,a="";const c=e/8,f=-1===n?3:0;for(s=0;c>s;s+=3)for(u=c>s+1?t[s+1>>>2]:0,h=c>s+2?t[s+2>>>2]:0,i=(t[s>>>2]>>>8*(f+n*(s%4))&255)<<16|(u>>>8*(f+n*((s+1)%4))&255)<<8|h>>>8*(f+n*((s+2)%4))&255,o=0;4>o;o+=1)a+=8*s+6*o>e?r.b64Pad:A.charAt(i>>>6*(3-o)&63);return a}(t,e,n,r)};case"BYTES":return function(t){return function(t,e,n){let r,s,o="";const i=e/8,u=-1===n?3:0;for(r=0;i>r;r+=1)s=t[r>>>2]>>>8*(u+n*(r%4))&255,o+=String.fromCharCode(s);return o}(t,e,n)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}return function(t){return function(t,e,n){let r;const s=e/8,o=new ArrayBuffer(s),i=new Uint8Array(o),u=-1===n?3:0;for(r=0;s>r;r+=1)i[r]=t[r>>>2]>>>8*(u+n*(r%4))&255;return o}(t,e,n)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}return function(t){return function(t,e,n){let r;const s=e/8,o=-1===n?3:0,i=new Uint8Array(s);for(r=0;s>r;r+=1)i[r]=t[r>>>2]>>>8*(o+n*(r%4))&255;return i}(t,e,n)};default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function w(t){const e={outputUpper:!1,b64Pad:"=",outputLen:-1},n=t||{},r="Output length must be a multiple of 8";if(e.outputUpper=n.outputUpper||!1,n.b64Pad&&(e.b64Pad=n.b64Pad),n.outputLen){if(n.outputLen%8!=0)throw Error(r);e.outputLen=n.outputLen}else if(n.shakeLen){if(n.shakeLen%8!=0)throw Error(r);e.outputLen=n.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function E(t,e){return t<<e|t>>>32-e}function R(t,e,n){return t^e^n}function v(t,e,n){return t&e^t&n^e&n}function y(t,e){const n=(65535&t)+(65535&e);return(65535&(t>>>16)+(e>>>16)+(n>>>16))<<16|65535&n}function T(t,e,n,r,s){const o=(65535&t)+(65535&e)+(65535&n)+(65535&r)+(65535&s);return(65535&(t>>>16)+(e>>>16)+(n>>>16)+(r>>>16)+(s>>>16)+(o>>>16))<<16|65535&o}function C(t){return[1732584193,4023233417,2562383102,271733878,3285377520]}function F(t,e){let n,r,s,o,i,u,h;const a=[];for(n=e[0],r=e[1],s=e[2],o=e[3],i=e[4],h=0;80>h;h+=1)a[h]=16>h?t[h]:E(a[h-3]^a[h-8]^a[h-14]^a[h-16],1),u=20>h?T(E(n,5),(c=r)&s^~c&o,i,1518500249,a[h]):40>h?T(E(n,5),R(r,s,o),i,1859775393,a[h]):60>h?T(E(n,5),v(r,s,o),i,2400959708,a[h]):T(E(n,5),R(r,s,o),i,3395469782,a[h]),i=o,o=s,s=E(r,30),r=n,n=u;var c;return e[0]=y(n,e[0]),e[1]=y(r,e[1]),e[2]=y(s,e[2]),e[3]=y(o,e[3]),e[4]=y(i,e[4]),e}function L(t,e,n,r){let s;const o=15+(e+65>>>9<<4),i=e+n;for(;o>=t.length;)t.push(0);for(t[e>>>5]|=128<<24-e%32,t[o]=4294967295&i,t[o-1]=i/4294967296|0,s=0;t.length>s;s+=16)r=F(t.slice(s,s+16),r);return r}class H extends class{constructor(t,e,n){const r=n||{};if(this.t=e,this.i=r.encoding||"UTF8",this.numRounds=r.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw Error("numRounds must a integer >= 1");this.s=t,this.o=[],this.h=0,this.u=!1,this.l=0,this.A=!1,this.p=[],this.R=[]}update(t){let e,n=0;const r=this.U>>>5,s=this.T(t,this.o,this.h),o=s.binLen,i=s.value,u=o>>>5;for(e=0;u>e;e+=r)o>=n+this.U&&(this.F=this.m(i.slice(e,e+r),this.F),n+=this.U);this.l+=n,this.o=i.slice(n>>>5),this.h=o%this.U,this.u=!0}getHash(t,e){let n,r,s=this.g;const o=w(e);if(this.B){if(-1===o.outputLen)throw Error("Output length must be specified in options");s=o.outputLen}const i=b(t,s,this.v,o);if(this.A&&this.Y)return i(this.Y(o));for(r=this.H(this.o.slice(),this.h,this.l,this.C(this.F),s),n=1;this.numRounds>n;n+=1)this.B&&s%32!=0&&(r[r.length-1]&=16777215>>>24-s%32),r=this.H(r,s,0,this.I(this.s),s);return i(r)}setHMACKey(t,e,n){if(!this.L)throw Error("Variant does not support HMAC");if(this.u)throw Error("Cannot set MAC key after calling update");const r=m(e,(n||{}).encoding||"UTF8",this.v);this.M(r(t))}M(t){const e=this.U>>>3,n=e/4-1;let r;if(1!==this.numRounds)throw Error("Cannot set numRounds with MAC");if(this.A)throw Error("MAC key already set");for(t.binLen/8>e&&(t.value=this.H(t.value,t.binLen,0,this.I(this.s),this.g));n>=t.value.length;)t.value.push(0);for(r=0;n>=r;r+=1)this.p[r]=909522486^t.value[r],this.R[r]=1549556828^t.value[r];this.F=this.m(this.p,this.F),this.l=this.U,this.A=!0}getHMAC(t,e){const n=w(e);return b(t,this.g,this.v,n)(this.N())}N(){let t;if(!this.A)throw Error("Cannot call getHMAC without first setting MAC key");const e=this.H(this.o.slice(),this.h,this.l,this.C(this.F),this.g);return t=this.m(this.R,this.I(this.s)),t=this.H(e,this.g,this.U,t,this.g),t}}{constructor(t,e,n){if("SHA-1"!==t)throw Error("Chosen SHA variant is not supported");super(t,e,n);const r=n||{};this.L=!0,this.Y=this.N,this.v=-1,this.T=m(this.t,this.i,this.v),this.m=F,this.C=function(t){return t.slice()},this.I=C,this.H=L,this.F=[1732584193,4023233417,2562383102,271733878,3285377520],this.U=512,this.g=160,this.B=!1,r.hmacKey&&this.M(function(t,e,n,r){const s="hmacKey must include a value and format";if(!e)throw Error(s);if(void 0===e.value||!e.format)throw Error(s);return m(e.format,e.encoding||"UTF8",n)(e.value)}(0,r.hmacKey,this.v))}}const I=400;function B(t,e={}){return function(t,{baseUrl:e="https://api.pwnedpasswords.com",userAgent:r}={}){const s=Object.assign({},r?{headers:{"User-Agent":r}}:{}),o=`${e.replace(/\/$/g,"")}${t}`;return n(o,s).then(t=>{if(t.ok)return t.text();if(t.status===I)return t.text().then(t=>{throw Error(t)});throw Error(t.statusText)})}("/range/"+encodeURIComponent(t),e).then(t=>t.split("\n")).then(t=>t.reduce((t,e)=>{const[n,r]=e.split(":");return t[n]=parseInt(r,10),t},{}))}function Y(t,e={}){const n=new H("SHA-1","TEXT");n.update(t);const r=n.getHash("HEX",{outputUpper:!0}),s=r.slice(0,5),o=r.slice(5);return B(s,e).then(t=>t[o]||0)}function P(t,e={truncate:!0}){const{apiKey:n,baseUrl:r,userAgent:s}=e;return Promise.all([l(t,e),/^.+@.+$/.test(t)?g(t,{apiKey:n,baseUrl:r,userAgent:s}):null]).then(t=>({breaches:t[0],pastes:t[1]}))}export{f as breach,l as breachedAccount,p as breaches,d as dataClasses,g as pasteAccount,Y as pwnedPassword,B as pwnedPasswordRange,P as search};
|
|
1
|
+
function t(t){var e=t.default;if("function"==typeof e){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var e=Object.freeze({__proto__:null,default:function(t,e){return e=e||{},new Promise((function(n,r){var s=new XMLHttpRequest,o=[],i=[],u={},h=function(){return{ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:h,headers:{keys:function(){return o},entries:function(){return i},get:function(t){return u[t.toLowerCase()]},has:function(t){return t.toLowerCase()in u}}}};for(var a in s.open(e.method||"get",t,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(t,e,n){o.push(e=e.toLowerCase()),i.push([e,n]),u[e]=u[e]?u[e]+","+n:n})),n(h())},s.onerror=r,s.withCredentials="include"==e.credentials,e.headers)s.setRequestHeader(a,e.headers[a]);s.send(e.body||null)}))}}),n=t(e),r=self.fetch||(self.fetch=n.default||n);new Map;const s=400,o="Bad request — the account does not comply with an acceptable format.",i=401,u=403,h="Forbidden - access denied.",a=404,c=(new Map([["retry-after","2"]]),429);class f extends Error{retryAfterSeconds;constructor(t,e,n){super(e,n),this.name=this.constructor.name,this.retryAfterSeconds="string"==typeof t?Number.parseInt(t,10):void 0}}function l(t,{apiKey:e,baseUrl:n="https://haveibeenpwned.com/api/v3",userAgent:l}={}){const p={};e&&(p["HIBP-API-Key"]=e),l&&(p["User-Agent"]=l),l||"undefined"!=typeof navigator||(p["User-Agent"]="hibp 11.1.0");const d={headers:p},g=`${n.replace(/\/$/g,"")}${t}`;return r(g,d).then((t=>{if(t.ok)return t.json();switch(t.status){case s:throw Error(o);case i:return t.json().then((t=>{throw Error(t.message)}));case u:{const e=t.headers.get("cf-ray");if(e)throw Error(function(t){return`Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ${t})`}(e));throw Error(h)}case a:return null;case c:return t.json().then((e=>{const n=t.headers.get("retry-after");throw new f(n,e.message)}));default:throw Error(t.statusText)}}))}function p(t,e={}){return l("/breach/"+encodeURIComponent(t),e)}function d(t,e={includeUnverified:!0,truncate:!0}){const n=`/breachedaccount/${encodeURIComponent(t)}?`,r=[];return e.domain&&r.push("domain="+encodeURIComponent(e.domain)),!1===e.includeUnverified&&r.push("includeUnverified=false"),!1===e.truncate&&r.push("truncateResponse=false"),l(`${n}${r.join("&")}`,{apiKey:e.apiKey,baseUrl:e.baseUrl,userAgent:e.userAgent})}function g(t={}){const e=[];return t.domain&&e.push("domain="+encodeURIComponent(t.domain)),l("/breaches?"+e.join("&"),{baseUrl:t.baseUrl,userAgent:t.userAgent})}function A(t={}){return l("/dataclasses",t)}function m(t,e={}){return l("/pasteaccount/"+encodeURIComponent(t),{apiKey:e.apiKey,baseUrl:e.baseUrl,userAgent:e.userAgent})}const U="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function b(t,e,n,r){let s,o,i;const u=e||[0],h=(n=n||0)>>>3,a=-1===r?3:0;for(s=0;t.length>s;s+=1)i=s+h,o=i>>>2,o>=u.length&&u.push(0),u[o]|=t[s]<<8*(a+r*(i%4));return{value:u,binLen:8*t.length+n}}function w(t,e,n){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":return function(t,e,r){return function(t,e,n,r){let s,o,i,u;if(0!=t.length%2)throw Error("String of HEX type must be in byte increments");const h=e||[0],a=(n=n||0)>>>3,c=-1===r?3:0;for(s=0;t.length>s;s+=2){if(o=parseInt(t.substr(s,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(u=(s>>>1)+a,i=u>>>2;i>=h.length;)h.push(0);h[i]|=o<<8*(c+r*(u%4))}return{value:h,binLen:4*t.length+n}}(t,e,r,n)};case"TEXT":return function(t,r,s){return function(t,e,n,r,s){let o,i,u,h,a,c,f,l,p=0;const d=n||[0],g=(r=r||0)>>>3;if("UTF8"===e)for(f=-1===s?3:0,u=0;t.length>u;u+=1)for(o=t.charCodeAt(u),i=[],128>o?i.push(o):2048>o?(i.push(192|o>>>6),i.push(128|63&o)):55296>o||o>=57344?i.push(224|o>>>12,128|o>>>6&63,128|63&o):(u+=1,o=65536+((1023&o)<<10|1023&t.charCodeAt(u)),i.push(240|o>>>18,128|o>>>12&63,128|o>>>6&63,128|63&o)),h=0;i.length>h;h+=1){for(c=p+g,a=c>>>2;a>=d.length;)d.push(0);d[a]|=i[h]<<8*(f+s*(c%4)),p+=1}else for(f=-1===s?2:0,l="UTF16LE"===e&&1!==s||"UTF16LE"!==e&&1===s,u=0;t.length>u;u+=1){for(o=t.charCodeAt(u),!0===l&&(h=255&o,o=h<<8|o>>>8),c=p+g,a=c>>>2;a>=d.length;)d.push(0);d[a]|=o<<8*(f+s*(c%4)),p+=2}return{value:d,binLen:8*p+r}}(t,e,r,s,n)};case"B64":return function(t,e,r){return function(t,e,n,r){let s,o,i,u,h,a,c,f=0;const l=e||[0],p=(n=n||0)>>>3,d=-1===r?3:0,g=t.indexOf("=");if(-1===t.search(/^[a-zA-Z0-9=+/]+$/))throw Error("Invalid character in base-64 string");if(t=t.replace(/=/g,""),-1!==g&&t.length>g)throw Error("Invalid '=' found in base-64 string");for(o=0;t.length>o;o+=4){for(h=t.substr(o,4),u=0,i=0;h.length>i;i+=1)s=U.indexOf(h.charAt(i)),u|=s<<18-6*i;for(i=0;h.length-1>i;i+=1){for(c=f+p,a=c>>>2;a>=l.length;)l.push(0);l[a]|=(u>>>16-8*i&255)<<8*(d+r*(c%4)),f+=1}}return{value:l,binLen:8*f+n}}(t,e,r,n)};case"BYTES":return function(t,e,r){return function(t,e,n,r){let s,o,i,u;const h=e||[0],a=(n=n||0)>>>3,c=-1===r?3:0;for(o=0;t.length>o;o+=1)s=t.charCodeAt(o),u=o+a,i=u>>>2,i>=h.length&&h.push(0),h[i]|=s<<8*(c+r*(u%4));return{value:h,binLen:8*t.length+n}}(t,e,r,n)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}return function(t,e,r){return function(t,e,n,r){return b(new Uint8Array(t),e,n,r)}(t,e,r,n)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}return function(t,e,r){return b(t,e,r,n)};default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function E(t,e,n,r){switch(t){case"HEX":return function(t){return function(t,e,n,r){let s,o,i="";const u=e/8,h=-1===n?3:0;for(s=0;u>s;s+=1)o=t[s>>>2]>>>8*(h+n*(s%4)),i+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return r.outputUpper?i.toUpperCase():i}(t,e,n,r)};case"B64":return function(t){return function(t,e,n,r){let s,o,i,u,h,a="";const c=e/8,f=-1===n?3:0;for(s=0;c>s;s+=3)for(u=c>s+1?t[s+1>>>2]:0,h=c>s+2?t[s+2>>>2]:0,i=(t[s>>>2]>>>8*(f+n*(s%4))&255)<<16|(u>>>8*(f+n*((s+1)%4))&255)<<8|h>>>8*(f+n*((s+2)%4))&255,o=0;4>o;o+=1)a+=8*s+6*o>e?r.b64Pad:U.charAt(i>>>6*(3-o)&63);return a}(t,e,n,r)};case"BYTES":return function(t){return function(t,e,n){let r,s,o="";const i=e/8,u=-1===n?3:0;for(r=0;i>r;r+=1)s=t[r>>>2]>>>8*(u+n*(r%4))&255,o+=String.fromCharCode(s);return o}(t,e,n)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}return function(t){return function(t,e,n){let r;const s=e/8,o=new ArrayBuffer(s),i=new Uint8Array(o),u=-1===n?3:0;for(r=0;s>r;r+=1)i[r]=t[r>>>2]>>>8*(u+n*(r%4))&255;return o}(t,e,n)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}return function(t){return function(t,e,n){let r;const s=e/8,o=-1===n?3:0,i=new Uint8Array(s);for(r=0;s>r;r+=1)i[r]=t[r>>>2]>>>8*(o+n*(r%4))&255;return i}(t,e,n)};default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function y(t){const e={outputUpper:!1,b64Pad:"=",outputLen:-1},n=t||{},r="Output length must be a multiple of 8";if(e.outputUpper=n.outputUpper||!1,n.b64Pad&&(e.b64Pad=n.b64Pad),n.outputLen){if(n.outputLen%8!=0)throw Error(r);e.outputLen=n.outputLen}else if(n.shakeLen){if(n.shakeLen%8!=0)throw Error(r);e.outputLen=n.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function R(t,e){return t<<e|t>>>32-e}function v(t,e,n){return t^e^n}function T(t,e,n){return t&e^t&n^e&n}function C(t,e){const n=(65535&t)+(65535&e);return(65535&(t>>>16)+(e>>>16)+(n>>>16))<<16|65535&n}function F(t,e,n,r,s){const o=(65535&t)+(65535&e)+(65535&n)+(65535&r)+(65535&s);return(65535&(t>>>16)+(e>>>16)+(n>>>16)+(r>>>16)+(s>>>16)+(o>>>16))<<16|65535&o}function L(t){return[1732584193,4023233417,2562383102,271733878,3285377520]}function I(t,e){let n,r,s,o,i,u,h;const a=[];for(n=e[0],r=e[1],s=e[2],o=e[3],i=e[4],h=0;80>h;h+=1)a[h]=16>h?t[h]:R(a[h-3]^a[h-8]^a[h-14]^a[h-16],1),u=20>h?F(R(n,5),(c=r)&s^~c&o,i,1518500249,a[h]):40>h?F(R(n,5),v(r,s,o),i,1859775393,a[h]):60>h?F(R(n,5),T(r,s,o),i,2400959708,a[h]):F(R(n,5),v(r,s,o),i,3395469782,a[h]),i=o,o=s,s=R(r,30),r=n,n=u;var c;return e[0]=C(n,e[0]),e[1]=C(r,e[1]),e[2]=C(s,e[2]),e[3]=C(o,e[3]),e[4]=C(i,e[4]),e}function B(t,e,n,r){let s;const o=15+(e+65>>>9<<4),i=e+n;for(;o>=t.length;)t.push(0);for(t[e>>>5]|=128<<24-e%32,t[o]=4294967295&i,t[o-1]=i/4294967296|0,s=0;t.length>s;s+=16)r=I(t.slice(s,s+16),r);return r}class H extends class{constructor(t,e,n){const r=n||{};if(this.t=e,this.i=r.encoding||"UTF8",this.numRounds=r.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw Error("numRounds must a integer >= 1");this.s=t,this.o=[],this.h=0,this.u=!1,this.l=0,this.A=!1,this.p=[],this.R=[]}update(t){let e,n=0;const r=this.U>>>5,s=this.T(t,this.o,this.h),o=s.binLen,i=s.value,u=o>>>5;for(e=0;u>e;e+=r)o>=n+this.U&&(this.F=this.m(i.slice(e,e+r),this.F),n+=this.U);this.l+=n,this.o=i.slice(n>>>5),this.h=o%this.U,this.u=!0}getHash(t,e){let n,r,s=this.g;const o=y(e);if(this.B){if(-1===o.outputLen)throw Error("Output length must be specified in options");s=o.outputLen}const i=E(t,s,this.v,o);if(this.A&&this.Y)return i(this.Y(o));for(r=this.H(this.o.slice(),this.h,this.l,this.C(this.F),s),n=1;this.numRounds>n;n+=1)this.B&&s%32!=0&&(r[r.length-1]&=16777215>>>24-s%32),r=this.H(r,s,0,this.I(this.s),s);return i(r)}setHMACKey(t,e,n){if(!this.L)throw Error("Variant does not support HMAC");if(this.u)throw Error("Cannot set MAC key after calling update");const r=w(e,(n||{}).encoding||"UTF8",this.v);this.M(r(t))}M(t){const e=this.U>>>3,n=e/4-1;let r;if(1!==this.numRounds)throw Error("Cannot set numRounds with MAC");if(this.A)throw Error("MAC key already set");for(t.binLen/8>e&&(t.value=this.H(t.value,t.binLen,0,this.I(this.s),this.g));n>=t.value.length;)t.value.push(0);for(r=0;n>=r;r+=1)this.p[r]=909522486^t.value[r],this.R[r]=1549556828^t.value[r];this.F=this.m(this.p,this.F),this.l=this.U,this.A=!0}getHMAC(t,e){const n=y(e);return E(t,this.g,this.v,n)(this.N())}N(){let t;if(!this.A)throw Error("Cannot call getHMAC without first setting MAC key");const e=this.H(this.o.slice(),this.h,this.l,this.C(this.F),this.g);return t=this.m(this.R,this.I(this.s)),t=this.H(e,this.g,this.U,t,this.g),t}}{constructor(t,e,n){if("SHA-1"!==t)throw Error("Chosen SHA variant is not supported");super(t,e,n);const r=n||{};this.L=!0,this.Y=this.N,this.v=-1,this.T=w(this.t,this.i,this.v),this.m=I,this.C=function(t){return t.slice()},this.I=L,this.H=B,this.F=[1732584193,4023233417,2562383102,271733878,3285377520],this.U=512,this.g=160,this.B=!1,r.hmacKey&&this.M(function(t,e,n,r){const s="hmacKey must include a value and format";if(!e)throw Error(s);if(void 0===e.value||!e.format)throw Error(s);return w(e.format,e.encoding||"UTF8",n)(e.value)}(0,r.hmacKey,this.v))}}const Y=400;function P(t,e={}){return function(t,{baseUrl:e="https://api.pwnedpasswords.com",userAgent:n}={}){const s=Object.assign({},n?{headers:{"User-Agent":n}}:{}),o=`${e.replace(/\/$/g,"")}${t}`;return r(o,s).then((t=>{if(t.ok)return t.text();if(t.status===Y)return t.text().then((t=>{throw Error(t)}));throw Error(t.statusText)}))}("/range/"+encodeURIComponent(t),e).then((t=>t.split("\n").filter(Boolean))).then((t=>t.reduce(((t,e)=>{const[n,r]=e.split(":");return t[n]=parseInt(r,10),t}),{})))}function M(t,e={}){const n=new H("SHA-1","TEXT");n.update(t);const r=n.getHash("HEX",{outputUpper:!0}),s=r.slice(0,5),o=r.slice(5);return P(s,e).then((t=>t[o]||0))}function N(t,e={truncate:!0}){const{apiKey:n,baseUrl:r,userAgent:s}=e;return Promise.all([d(t,e),/^.+@.+$/.test(t)?m(t,{apiKey:n,baseUrl:r,userAgent:s}):null]).then((t=>({breaches:t[0],pastes:t[1]})))}export{f as RateLimitError,p as breach,d as breachedAccount,g as breaches,A as dataClasses,m as pasteAccount,M as pwnedPassword,P as pwnedPasswordRange,N as search};
|
|
2
2
|
//# sourceMappingURL=hibp.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hibp.module.js","sources":["../../node_modules/unfetch/dist/unfetch.module.js","../../node_modules/isomorphic-unfetch/browser.js","../../src/api/haveibeenpwned/responses.ts","../../src/api/haveibeenpwned/fetchFromApi.ts","../../src/breach.ts","../../src/breachedAccount.ts","../../src/breaches.ts","../../src/dataClasses.ts","../../src/pasteAccount.ts","../../node_modules/jssha/dist/sha1.mjs","../../src/api/pwnedpasswords/responses.ts","../../src/pwnedPasswordRange.ts","../../src/api/pwnedpasswords/fetchFromApi.ts","../../src/pwnedPassword.ts","../../src/search.ts"],"sourcesContent":["export default function(e,n){return n=n||{},new Promise(function(t,r){var s=new XMLHttpRequest,o=[],u=[],i={},a=function(){return{ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:a,headers:{keys:function(){return o},entries:function(){return u},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}};for(var l in s.open(n.method||\"get\",e,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\\S\\n]*([\\s\\S]*?)$/gm,function(e,n,t){o.push(n=n.toLowerCase()),u.push([n,t]),i[n]=i[n]?i[n]+\",\"+t:t}),t(a())},s.onerror=r,s.withCredentials=\"include\"==n.credentials,n.headers)s.setRequestHeader(l,n.headers[l]);s.send(n.body||null)})}\n//# sourceMappingURL=unfetch.module.js.map\n","module.exports = self.fetch || (self.fetch = require('unfetch').default || require('unfetch'));\n","/**\n * Known potential responses from the remote API.\n *\n * Unfortunately, the API does not send a decent human-readable message back\n * with each response, but they are documented on the website:\n * https://haveibeenpwned.com/api/v3#ResponseCodes\n *\n * These objects simply provide a mapping between the HTTP response status code\n * and the corresponding human-readable message so we can throw a more\n * descriptive error for the consumer. (They are also leveraged in our tests.)\n */\n\nimport { ResponseBody } from './types';\n\n/** @internal */\nexport interface HaveIBeenPwnedApiResponse {\n headers: Map<string, string>;\n status: number;\n statusText?: string;\n body?: ResponseBody;\n}\n\nconst emptyHeaders = new Map<string, string>();\n\n/** @internal */\nexport const OK: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 200,\n};\n\n/** @internal */\nexport const BAD_REQUEST: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 400,\n statusText:\n 'Bad request — the account does not comply with an acceptable format.',\n};\n\n/**\n * This response has unique behavior. For some reason, the API includes an\n * object in the response body for this one, containing a human-readable\n * message. Manually populating the message here purely for use in tests.\n *\n * @internal\n */\nexport const UNAUTHORIZED: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 401,\n body: {\n statusCode: 401,\n message: 'Access denied due to missing hibp-api-key.',\n },\n};\n\n/** @internal */\nexport const FORBIDDEN: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 403,\n statusText: 'Forbidden - access denied.',\n};\n\n/** @internal */\nexport const BLOCKED: HaveIBeenPwnedApiResponse = {\n headers: new Map([['cf-ray', 'someRayId']]),\n status: 403,\n};\n\n/** @internal */\nexport const NOT_FOUND: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 404,\n};\n\n/**\n * This response has unique behavior. For some reason, the API includes an\n * object in the response body for this one, containing a human-readable\n * message. Manually populating the message here purely for use in tests.\n *\n * @internal\n */\nexport const TOO_MANY_REQUESTS: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 429,\n body: {\n statusCode: 429,\n message: 'Rate limit is exceeded. Try again in 2 seconds.',\n },\n};\n","import fetch from 'isomorphic-unfetch';\nimport { name, version } from '../../../package.json';\nimport { ApiData, ErrorData } from './types';\nimport {\n BAD_REQUEST,\n UNAUTHORIZED,\n FORBIDDEN,\n NOT_FOUND,\n TOO_MANY_REQUESTS,\n} from './responses';\n\nfunction blockedWithRayId(rayId: string) {\n return `Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ${rayId})`;\n}\n\n/**\n * Fetches data from the supplied API endpoint.\n *\n * HTTP status code 200 returns an Object (data found).\n * HTTP status code 404 returns null (no data found).\n * HTTP status code 400 throws an Error (bad request).\n * HTTP status code 401 throws an Error (unauthorized).\n * HTTP status code 403 throws an Error (forbidden).\n * HTTP status code 429 throws an Error (too many requests).\n *\n * @internal\n * @private\n * @param {string} endpoint the API endpoint to query\n * @param {object} [options] a configuration object\n * @param {string} [options.apiKey] an API key from\n * https://haveibeenpwned.com/API/Key\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {Promise<ApiData>} a Promise which resolves to the data resulting\n * from the query (or null for 404 Not Found responses), or rejects with an\n * Error\n */\nexport function fetchFromApi(\n endpoint: string,\n /* istanbul ignore next: no need to test default empty object */\n {\n apiKey,\n baseUrl = 'https://haveibeenpwned.com/api/v3',\n userAgent,\n }: { apiKey?: string; baseUrl?: string; userAgent?: string } = {},\n): Promise<ApiData> {\n const headers: Record<string, string> = {};\n\n if (apiKey) {\n headers['HIBP-API-Key'] = apiKey;\n }\n\n if (userAgent) {\n headers['User-Agent'] = userAgent;\n }\n\n // Provide a default User-Agent when running outside the browser\n if (!userAgent && typeof navigator === 'undefined') {\n headers['User-Agent'] = `${name} ${version}`;\n }\n\n const config = { headers };\n const url = `${baseUrl.replace(/\\/$/g, '')}${endpoint}`;\n\n return fetch(url, config).then((res) => {\n if (res.ok) return res.json();\n\n switch (res.status) {\n case BAD_REQUEST.status:\n throw new Error(BAD_REQUEST.statusText);\n case UNAUTHORIZED.status:\n return res.json().then((body: ErrorData) => {\n throw new Error(body.message);\n });\n case FORBIDDEN.status: {\n const rayId = res.headers.get('cf-ray');\n if (rayId) {\n throw new Error(blockedWithRayId(rayId));\n }\n throw new Error(FORBIDDEN.statusText);\n }\n case NOT_FOUND.status:\n return null;\n case TOO_MANY_REQUESTS.status:\n return res.json().then((body: ErrorData) => {\n throw new Error(body.message);\n });\n default:\n throw new Error(res.statusText);\n }\n });\n}\n","import { Breach } from './api/haveibeenpwned/types';\nimport { fetchFromApi } from './api/haveibeenpwned';\n\n/**\n * An object representing a breach.\n *\n * @typedef {object} Breach\n * @property {string} Name\n * @property {string} Title\n * @property {string} Domain\n * @property {string} BreachDate\n * @property {string} AddedDate\n * @property {string} ModifiedDate\n * @property {number} PwnCount\n * @property {string} Description\n * @property {string} LogoPath\n * @property {string[]} DataClasses\n * @property {boolean} IsVerified\n * @property {boolean} IsFabricated\n * @property {boolean} IsSensitive\n * @property {boolean} IsRetired\n * @property {boolean} IsSpamList\n */\n\n/**\n * Fetches data for a specific breach event.\n *\n * @param {string} breachName the name of a breach in the system\n * @param {object} [options] a configuration object\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {(Promise<Breach>|Promise<null>)} a Promise which resolves to an\n * object representing a breach (or null if no breach was found), or rejects\n * with an Error\n * @example\n * breach('Adobe')\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n */\nexport function breach(\n breachName: string,\n options: { baseUrl?: string; userAgent?: string } = {},\n): Promise<Breach | null> {\n return fetchFromApi(\n `/breach/${encodeURIComponent(breachName)}`,\n options,\n ) as Promise<Breach | null>;\n}\n","import { Breach } from './api/haveibeenpwned/types';\nimport { fetchFromApi } from './api/haveibeenpwned';\n\n/**\n * Fetches breach data for a specific account.\n *\n * ***Warning (July 18, 2019):***\n *\n * `haveibeenpwned.com` now requires an API key from\n * https://haveibeenpwned.com/API/Key for the `breachedaccount` endpoint. The\n * `apiKey` option here is not explicitly required, but direct requests made\n * without it (that is, without specifying a `baseUrl` to a proxy that inserts a\n * valid API key on your behalf) will fail.\n *\n * @param {string} account a username or email address\n * @param {object} [options] a configuration object\n * @param {string} [options.apiKey] an API key from\n * https://haveibeenpwned.com/API/Key (default: undefined)\n * @param {string} [options.domain] a domain by which to filter the results\n * (default: all domains)\n * @param {boolean} [options.includeUnverified] include \"unverified\" breaches in\n * the results (default: true)\n * @param {boolean} [options.truncate] truncate the results to only include\n * the name of each breach (default: true)\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {(Promise<Breach[]> | Promise<null>)} a Promise which resolves to an\n * array of breach objects (or null if no breaches were found), or rejects with\n * an Error\n * @example\n * breachedAccount('foo', { apiKey: 'my-api-key' })\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n * @example\n * breachedAccount('bar', {\n * includeUnverified: false,\n * baseUrl: 'https://my-hibp-proxy:8080',\n * })\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n * @example\n * breachedAccount('baz', {\n * apiKey: 'my-api-key',\n * domain: 'adobe.com',\n * truncate: false,\n * userAgent: 'my-app 1.0'\n * })\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n */\nexport function breachedAccount(\n account: string,\n options: {\n apiKey?: string;\n domain?: string;\n includeUnverified?: boolean;\n truncate?: boolean;\n baseUrl?: string;\n userAgent?: string;\n } = {\n includeUnverified: true,\n truncate: true,\n },\n): Promise<Breach[] | null> {\n const endpoint = `/breachedaccount/${encodeURIComponent(account)}?`;\n const params: Array<string> = [];\n if (options.domain) {\n params.push(`domain=${encodeURIComponent(options.domain)}`);\n }\n if (options.includeUnverified === false) {\n params.push('includeUnverified=false');\n }\n if (options.truncate === false) {\n params.push('truncateResponse=false');\n }\n return fetchFromApi(`${endpoint}${params.join('&')}`, {\n apiKey: options.apiKey,\n baseUrl: options.baseUrl,\n userAgent: options.userAgent,\n }) as Promise<Breach[] | null>;\n}\n","import { Breach } from './api/haveibeenpwned/types';\nimport { fetchFromApi } from './api/haveibeenpwned';\n\n/**\n * Fetches all breach events in the system.\n *\n * @param {object} [options] a configuration object\n * @param {string} [options.domain] a domain by which to filter the results\n * (default: all domains)\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {Promise<Breach[]>} a Promise which resolves to an array of breach\n * objects (an empty array if no breaches were found), or rejects with an Error\n * @example\n * breaches()\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n * @example\n * breaches({ domain: 'adobe.com' })\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n */\nexport function breaches(\n options: {\n domain?: string;\n baseUrl?: string;\n userAgent?: string;\n } = {},\n): Promise<Breach[]> {\n const endpoint = '/breaches?';\n const params: Array<string> = [];\n if (options.domain) {\n params.push(`domain=${encodeURIComponent(options.domain)}`);\n }\n return fetchFromApi(`${endpoint}${params.join('&')}`, {\n baseUrl: options.baseUrl,\n userAgent: options.userAgent,\n }) as Promise<Breach[]>;\n}\n","import { fetchFromApi } from './api/haveibeenpwned';\n\n/**\n * Fetches all data classes in the system.\n *\n * @param {object} [options] a configuration object\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {(Promise<string[]> | Promise<null>)} a Promise which resolves to an\n * array of strings (or null if no data classes were found), or rejects with an\n * Error\n * @example\n * dataClasses()\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n */\nexport function dataClasses(\n options: { baseUrl?: string; userAgent?: string } = {},\n): Promise<string[] | null> {\n return fetchFromApi('/dataclasses', options) as Promise<string[] | null>;\n}\n","import { Paste } from './api/haveibeenpwned/types';\nimport { fetchFromApi } from './api/haveibeenpwned';\n\n/**\n * An object representing a paste.\n *\n * @typedef {object} Paste\n * @property {string} Id\n * @property {string} Source\n * @property {string} Title\n * @property {string} Date\n * @property {number} EmailCount\n */\n\n/**\n * Fetches paste data for a specific account (email address).\n *\n * ***Warning (July 18, 2019):***\n *\n * `haveibeenpwned.com` now requires an API key from\n * https://haveibeenpwned.com/API/Key for the `pasteaccount` endpoint. The\n * `apiKey` option here is not explicitly required, but direct requests made\n * without it (that is, without specifying a `baseUrl` to a proxy that inserts a\n * valid API key on your behalf) will fail.\n *\n * @param {string} email the email address to query\n * @param {object} [options] a configuration object\n * @param {string} [options.apiKey] an API key from\n * https://haveibeenpwned.com/API/Key\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {(Promise<Paste[]> | Promise<null>)} a Promise which resolves to an\n * array of paste objects (or null if no pastes were found), or rejects with an\n * Error\n * @example\n * pasteAccount('foo@bar.com', { apiKey: 'my-api-key' })\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n */\nexport function pasteAccount(\n email: string,\n options: { apiKey?: string; baseUrl?: string; userAgent?: string } = {},\n): Promise<Paste[] | null> {\n return fetchFromApi(`/pasteaccount/${encodeURIComponent(email)}`, {\n apiKey: options.apiKey,\n baseUrl: options.baseUrl,\n userAgent: options.userAgent,\n }) as Promise<Paste[] | null>;\n}\n","/**\n * A JavaScript implementation of the SHA family of hashes - defined in FIPS PUB 180-4, FIPS PUB 202,\n * and SP 800-185 - as well as the corresponding HMAC implementation as defined in FIPS PUB 198-1.\n *\n * Copyright 2008-2020 Brian Turek, 1998-2009 Paul Johnston & Contributors\n * Distributed under the BSD License\n * See http://caligatio.github.com/jsSHA/ for more information\n */\nconst t=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";function r(t,r,n,i){let e,s,o;const h=r||[0],u=(n=n||0)>>>3,f=-1===i?3:0;for(e=0;e<t.length;e+=1)o=e+u,s=o>>>2,h.length<=s&&h.push(0),h[s]|=t[e]<<8*(f+i*(o%4));return{value:h,binLen:8*t.length+n}}function n(n,i,e){switch(i){case\"UTF8\":case\"UTF16BE\":case\"UTF16LE\":break;default:throw new Error(\"encoding must be UTF8, UTF16BE, or UTF16LE\")}switch(n){case\"HEX\":return function(t,r,n){return function(t,r,n,i){let e,s,o,h;if(0!=t.length%2)throw new Error(\"String of HEX type must be in byte increments\");const u=r||[0],f=(n=n||0)>>>3,c=-1===i?3:0;for(e=0;e<t.length;e+=2){if(s=parseInt(t.substr(e,2),16),isNaN(s))throw new Error(\"String of HEX type contains invalid characters\");for(h=(e>>>1)+f,o=h>>>2;u.length<=o;)u.push(0);u[o]|=s<<8*(c+i*(h%4))}return{value:u,binLen:4*t.length+n}}(t,r,n,e)};case\"TEXT\":return function(t,r,n){return function(t,r,n,i,e){let s,o,h,u,f,c,a,w,E=0;const l=n||[0],A=(i=i||0)>>>3;if(\"UTF8\"===r)for(a=-1===e?3:0,h=0;h<t.length;h+=1)for(s=t.charCodeAt(h),o=[],128>s?o.push(s):2048>s?(o.push(192|s>>>6),o.push(128|63&s)):55296>s||57344<=s?o.push(224|s>>>12,128|s>>>6&63,128|63&s):(h+=1,s=65536+((1023&s)<<10|1023&t.charCodeAt(h)),o.push(240|s>>>18,128|s>>>12&63,128|s>>>6&63,128|63&s)),u=0;u<o.length;u+=1){for(c=E+A,f=c>>>2;l.length<=f;)l.push(0);l[f]|=o[u]<<8*(a+e*(c%4)),E+=1}else for(a=-1===e?2:0,w=\"UTF16LE\"===r&&1!==e||\"UTF16LE\"!==r&&1===e,h=0;h<t.length;h+=1){for(s=t.charCodeAt(h),!0===w&&(u=255&s,s=u<<8|s>>>8),c=E+A,f=c>>>2;l.length<=f;)l.push(0);l[f]|=s<<8*(a+e*(c%4)),E+=2}return{value:l,binLen:8*E+i}}(t,i,r,n,e)};case\"B64\":return function(r,n,i){return function(r,n,i,e){let s,o,h,u,f,c,a,w=0;const E=n||[0],l=(i=i||0)>>>3,A=-1===e?3:0,p=r.indexOf(\"=\");if(-1===r.search(/^[a-zA-Z0-9=+/]+$/))throw new Error(\"Invalid character in base-64 string\");if(r=r.replace(/=/g,\"\"),-1!==p&&p<r.length)throw new Error(\"Invalid '=' found in base-64 string\");for(o=0;o<r.length;o+=4){for(f=r.substr(o,4),u=0,h=0;h<f.length;h+=1)s=t.indexOf(f.charAt(h)),u|=s<<18-6*h;for(h=0;h<f.length-1;h+=1){for(a=w+l,c=a>>>2;E.length<=c;)E.push(0);E[c]|=(u>>>16-8*h&255)<<8*(A+e*(a%4)),w+=1}}return{value:E,binLen:8*w+i}}(r,n,i,e)};case\"BYTES\":return function(t,r,n){return function(t,r,n,i){let e,s,o,h;const u=r||[0],f=(n=n||0)>>>3,c=-1===i?3:0;for(s=0;s<t.length;s+=1)e=t.charCodeAt(s),h=s+f,o=h>>>2,u.length<=o&&u.push(0),u[o]|=e<<8*(c+i*(h%4));return{value:u,binLen:8*t.length+n}}(t,r,n,e)};case\"ARRAYBUFFER\":try{new ArrayBuffer(0)}catch(t){throw new Error(\"ARRAYBUFFER not supported by this environment\")}return function(t,n,i){return function(t,n,i,e){return r(new Uint8Array(t),n,i,e)}(t,n,i,e)};case\"UINT8ARRAY\":try{new Uint8Array(0)}catch(t){throw new Error(\"UINT8ARRAY not supported by this environment\")}return function(t,n,i){return r(t,n,i,e)};default:throw new Error(\"format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY\")}}function i(r,n,i,e){switch(r){case\"HEX\":return function(t){return function(t,r,n,i){let e,s,o=\"\";const h=r/8,u=-1===n?3:0;for(e=0;e<h;e+=1)s=t[e>>>2]>>>8*(u+n*(e%4)),o+=\"0123456789abcdef\".charAt(s>>>4&15)+\"0123456789abcdef\".charAt(15&s);return i.outputUpper?o.toUpperCase():o}(t,n,i,e)};case\"B64\":return function(r){return function(r,n,i,e){let s,o,h,u,f,c=\"\";const a=n/8,w=-1===i?3:0;for(s=0;s<a;s+=3)for(u=s+1<a?r[s+1>>>2]:0,f=s+2<a?r[s+2>>>2]:0,h=(r[s>>>2]>>>8*(w+i*(s%4))&255)<<16|(u>>>8*(w+i*((s+1)%4))&255)<<8|f>>>8*(w+i*((s+2)%4))&255,o=0;o<4;o+=1)c+=8*s+6*o<=n?t.charAt(h>>>6*(3-o)&63):e.b64Pad;return c}(r,n,i,e)};case\"BYTES\":return function(t){return function(t,r,n){let i,e,s=\"\";const o=r/8,h=-1===n?3:0;for(i=0;i<o;i+=1)e=t[i>>>2]>>>8*(h+n*(i%4))&255,s+=String.fromCharCode(e);return s}(t,n,i)};case\"ARRAYBUFFER\":try{new ArrayBuffer(0)}catch(t){throw new Error(\"ARRAYBUFFER not supported by this environment\")}return function(t){return function(t,r,n){let i;const e=r/8,s=new ArrayBuffer(e),o=new Uint8Array(s),h=-1===n?3:0;for(i=0;i<e;i+=1)o[i]=t[i>>>2]>>>8*(h+n*(i%4))&255;return s}(t,n,i)};case\"UINT8ARRAY\":try{new Uint8Array(0)}catch(t){throw new Error(\"UINT8ARRAY not supported by this environment\")}return function(t){return function(t,r,n){let i;const e=r/8,s=-1===n?3:0,o=new Uint8Array(e);for(i=0;i<e;i+=1)o[i]=t[i>>>2]>>>8*(s+n*(i%4))&255;return o}(t,n,i)};default:throw new Error(\"format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY\")}}function e(t){const r={outputUpper:!1,b64Pad:\"=\",outputLen:-1},n=t||{},i=\"Output length must be a multiple of 8\";if(r.outputUpper=n.outputUpper||!1,n.b64Pad&&(r.b64Pad=n.b64Pad),n.outputLen){if(n.outputLen%8!=0)throw new Error(i);r.outputLen=n.outputLen}else if(n.shakeLen){if(n.shakeLen%8!=0)throw new Error(i);r.outputLen=n.shakeLen}if(\"boolean\"!=typeof r.outputUpper)throw new Error(\"Invalid outputUpper formatting option\");if(\"string\"!=typeof r.b64Pad)throw new Error(\"Invalid b64Pad formatting option\");return r}function s(t,r){return t<<r|t>>>32-r}function o(t,r,n){return t^r^n}function h(t,r,n){return t&r^t&n^r&n}function u(t,r){const n=(65535&t)+(65535&r);return(65535&(t>>>16)+(r>>>16)+(n>>>16))<<16|65535&n}function f(t,r,n,i,e){const s=(65535&t)+(65535&r)+(65535&n)+(65535&i)+(65535&e);return(65535&(t>>>16)+(r>>>16)+(n>>>16)+(i>>>16)+(e>>>16)+(s>>>16))<<16|65535&s}function c(t){return[1732584193,4023233417,2562383102,271733878,3285377520]}function a(t,r){let n,i,e,c,a,w,E;const l=[];for(n=r[0],i=r[1],e=r[2],c=r[3],a=r[4],E=0;E<80;E+=1)l[E]=E<16?t[E]:s(l[E-3]^l[E-8]^l[E-14]^l[E-16],1),w=E<20?f(s(n,5),(A=i)&e^~A&c,a,1518500249,l[E]):E<40?f(s(n,5),o(i,e,c),a,1859775393,l[E]):E<60?f(s(n,5),h(i,e,c),a,2400959708,l[E]):f(s(n,5),o(i,e,c),a,3395469782,l[E]),a=c,c=e,e=s(i,30),i=n,n=w;var A;return r[0]=u(n,r[0]),r[1]=u(i,r[1]),r[2]=u(e,r[2]),r[3]=u(c,r[3]),r[4]=u(a,r[4]),r}function w(t,r,n,i){let e;const s=15+(r+65>>>9<<4),o=r+n;for(;t.length<=s;)t.push(0);for(t[r>>>5]|=128<<24-r%32,t[s]=4294967295&o,t[s-1]=o/4294967296|0,e=0;e<t.length;e+=16)i=a(t.slice(e,e+16),i);return i}export default class extends class{constructor(t,r,n){const i=n||{};if(this.t=r,this.i=i.encoding||\"UTF8\",this.numRounds=i.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw new Error(\"numRounds must a integer >= 1\");this.s=t,this.o=[],this.h=0,this.u=!1,this.l=0,this.A=!1,this.p=[],this.R=[]}update(t){let r,n=0;const i=this.U>>>5,e=this.T(t,this.o,this.h),s=e.binLen,o=e.value,h=s>>>5;for(r=0;r<h;r+=i)n+this.U<=s&&(this.F=this.m(o.slice(r,r+i),this.F),n+=this.U);this.l+=n,this.o=o.slice(n>>>5),this.h=s%this.U,this.u=!0}getHash(t,r){let n,s,o=this.g;const h=e(r);if(this.B){if(-1===h.outputLen)throw new Error(\"Output length must be specified in options\");o=h.outputLen}const u=i(t,o,this.v,h);if(this.A&&this.Y)return u(this.Y(h));for(s=this.H(this.o.slice(),this.h,this.l,this.C(this.F),o),n=1;n<this.numRounds;n+=1)this.B&&o%32!=0&&(s[s.length-1]&=16777215>>>24-o%32),s=this.H(s,o,0,this.I(this.s),o);return u(s)}setHMACKey(t,r,i){if(!this.L)throw new Error(\"Variant does not support HMAC\");if(this.u)throw new Error(\"Cannot set MAC key after calling update\");const e=n(r,(i||{}).encoding||\"UTF8\",this.v);this.M(e(t))}M(t){const r=this.U>>>3,n=r/4-1;let i;if(1!==this.numRounds)throw new Error(\"Cannot set numRounds with MAC\");if(this.A)throw new Error(\"MAC key already set\");for(r<t.binLen/8&&(t.value=this.H(t.value,t.binLen,0,this.I(this.s),this.g));t.value.length<=n;)t.value.push(0);for(i=0;i<=n;i+=1)this.p[i]=909522486^t.value[i],this.R[i]=1549556828^t.value[i];this.F=this.m(this.p,this.F),this.l=this.U,this.A=!0}getHMAC(t,r){const n=e(r);return i(t,this.g,this.v,n)(this.N())}N(){let t;if(!this.A)throw new Error(\"Cannot call getHMAC without first setting MAC key\");const r=this.H(this.o.slice(),this.h,this.l,this.C(this.F),this.g);return t=this.m(this.R,this.I(this.s)),t=this.H(r,this.g,this.U,t,this.g),t}}{constructor(t,r,i){if(\"SHA-1\"!==t)throw new Error(\"Chosen SHA variant is not supported\");super(t,r,i);const e=i||{};this.L=!0,this.Y=this.N,this.v=-1,this.T=n(this.t,this.i,this.v),this.m=a,this.C=function(t){return t.slice()},this.I=c,this.H=w,this.F=[1732584193,4023233417,2562383102,271733878,3285377520],this.U=512,this.g=160,this.B=!1,e.hmacKey&&this.M(function(t,r,i,e){const s=t+\" must include a value and format\";if(!r){if(!e)throw new Error(s);return e}if(void 0===r.value||!r.format)throw new Error(s);return n(r.format,r.encoding||\"UTF8\",i)(r.value)}(\"hmacKey\",e.hmacKey,this.v))}}\n","/**\n * Known potential responses from the remote API.\n *\n * https://haveibeenpwned.com/api/v3#PwnedPasswords\n *\n */\n\n/** @internal */\nexport interface PwnedPasswordsApiResponse {\n status: number;\n body?: string;\n}\n\n/** @internal */\nexport const OK: PwnedPasswordsApiResponse = {\n status: 200,\n};\n\n/** @internal */\nexport const BAD_REQUEST: PwnedPasswordsApiResponse = {\n status: 400,\n body: 'The hash prefix was not in a valid format',\n};\n","import { fetchFromApi } from './api/pwnedpasswords';\n\nexport interface PwnedPasswordSuffixes {\n [suffix: string]: number;\n}\n\n/**\n * An object mapping an exposed password hash suffix (corresponding to a given\n * hash prefix) to how many times it occurred in the Pwned Passwords repository.\n *\n * @typedef {Object.<string, number>} PwnedPasswordSuffixes\n */\n\n/**\n * Fetches the SHA-1 hash suffixes for the given 5-character SHA-1 hash prefix.\n *\n * When a password hash with the same first 5 characters is found in the Pwned\n * Passwords repository, the API will respond with an HTTP 200 and include the\n * suffix of every hash beginning with the specified prefix, followed by a count\n * of how many times it appears in the data set. This function parses the\n * response and returns a more structured format.\n *\n * @param {string} prefix the first 5 characters of a SHA-1 password hash (case\n * insensitive)\n * @param {object} [options] a configuration object\n * @param {string} [options.baseUrl] a custom base URL for the\n * pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {Promise<PwnedPasswordSuffixes>} a Promise which resolves to an\n * object mapping the `suffix` that when matched with the prefix composes the\n * complete hash, to the `count` of how many times it appears in the breached\n * password data set, or rejects with an Error\n *\n * @example\n * pwnedPasswordRange('5BAA6')\n * .then(results => {\n * // results will have the following shape:\n * // {\n * // \"003D68EB55068C33ACE09247EE4C639306B\": 3,\n * // \"012C192B2F16F82EA0EB9EF18D9D539B0DD\": 1,\n * // ...\n * // }\n * })\n * @example\n * const suffix = '1E4C9B93F3F0682250B6CF8331B7EE68FD8';\n * pwnedPasswordRange('5BAA6')\n * .then(results => (results[suffix] || 0))\n * .catch(err => {\n * // ...\n * });\n * @see https://haveibeenpwned.com/api/v3#SearchingPwnedPasswordsByRange\n */\nexport function pwnedPasswordRange(\n prefix: string,\n options: { baseUrl?: string; userAgent?: string } = {},\n): Promise<PwnedPasswordSuffixes> {\n return (\n fetchFromApi(`/range/${encodeURIComponent(prefix)}`, options)\n // create array from lines of text in response body\n .then((data) => data.split('\\n'))\n // convert into an object mapping suffix to count for each line\n .then((results) =>\n results.reduce<PwnedPasswordSuffixes>((acc, row) => {\n const [suffix, countString] = row.split(':');\n acc[suffix] = parseInt(countString, 10);\n return acc;\n }, {}),\n )\n );\n}\n","import fetch from 'isomorphic-unfetch';\nimport { BAD_REQUEST } from './responses';\n\n/**\n * Fetches data from the supplied API endpoint.\n *\n * HTTP status code 200 returns plain text (data found).\n * HTTP status code 400 throws an Error (bad request).\n *\n * @internal\n * @private\n * @param {string} endpoint the API endpoint to query\n * @param {object} [options] a configuration object\n * @param {string} [options.baseUrl] a custom base URL for the\n * pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {Promise<string>} a Promise which resolves to the data resulting\n * from the query, or rejects with an Error\n */\nexport function fetchFromApi(\n endpoint: string,\n /* istanbul ignore next: no need to test default empty object */\n {\n baseUrl = 'https://api.pwnedpasswords.com',\n userAgent,\n }: { baseUrl?: string; userAgent?: string } = {},\n): Promise<string> {\n const config = Object.assign(\n {},\n userAgent\n ? {\n headers: {\n 'User-Agent': userAgent,\n },\n }\n : {},\n );\n\n const url = `${baseUrl.replace(/\\/$/g, '')}${endpoint}`;\n\n return fetch(url, config).then((res) => {\n if (res.ok) return res.text();\n\n if (res.status === BAD_REQUEST.status) {\n return res.text().then((text) => {\n throw new Error(text);\n });\n }\n\n throw new Error(res.statusText);\n });\n}\n","import JSSHA from 'jssha/dist/sha1';\nimport { pwnedPasswordRange } from './pwnedPasswordRange';\n\n/**\n * Fetches the number of times the the given password has been exposed in a\n * breach (0 indicating no exposure). The password is given in plain text, but\n * only the first 5 characters of its SHA-1 hash will be submitted to the API.\n *\n * @param {string} password a password in plain text\n * @param {object} [options] a configuration object\n * @param {string} [options.baseUrl] a custom base URL for the\n * pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {Promise<number>} a Promise which resolves to the number of times\n * the password has been exposed in a breach, or rejects with an Error\n * @example\n * pwnedPassword('f00b4r')\n * .then(numPwns => {\n * // truthy check or numeric condition\n * if (numPwns) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n * @see https://haveibeenpwned.com/api/v3#PwnedPasswords\n */\nexport function pwnedPassword(\n password: string,\n options: { baseUrl?: string; userAgent?: string } = {},\n): Promise<number> {\n const sha1 = new JSSHA('SHA-1', 'TEXT');\n sha1.update(password);\n const hash = sha1.getHash('HEX', { outputUpper: true });\n const prefix = hash.slice(0, 5);\n const suffix = hash.slice(5);\n\n return pwnedPasswordRange(prefix, options).then(\n (range) => range[suffix] || 0,\n );\n}\n","import { Breach, Paste } from './api/haveibeenpwned/types';\nimport { breachedAccount } from './breachedAccount';\nimport { pasteAccount } from './pasteAccount';\n\nexport interface SearchResults {\n breaches: Breach[] | null;\n pastes: Paste[] | null;\n}\n\n/**\n * An object representing search results.\n *\n * @typedef {object} SearchResults\n * @property {(Breach[] | null)} breaches\n * @property {(Paste[] | null)} pastes\n */\n\n/**\n * Fetches all breaches and all pastes associated with the provided account\n * (email address or username). Note that the remote API does not support\n * querying pastes by username (only email addresses), so in the event the\n * provided account is not a valid email address, only breach data is queried\n * and the \"pastes\" field of the resulting object will always be null. This is\n * exactly how searching via the current web interface behaves, which this\n * convenience method is designed to mimic.\n *\n * ***Warning (July 18, 2019):***\n *\n * `haveibeenpwned.com` now requires an API key from\n * https://haveibeenpwned.com/API/Key for the `breachedaccount` and\n * `pasteaccount` endpoints. The `apiKey` option here is not explicitly\n * required, but direct requests made without it (that is, without specifying a\n * `baseUrl` to a proxy that inserts a valid API key on your behalf) will fail.\n *\n * @param {string} account an email address or username\n * @param {object} [breachOptions] a configuration object pertaining to breach\n * queries\n * @param {string} [breachOptions.apiKey] an API key from\n * https://haveibeenpwned.com/API/Key\n * @param {string} [breachOptions.domain] a domain by which to filter the\n * results (default: all domains)\n * @param {boolean} [breachOptions.truncate] truncate the results to only\n * include the name of each breach (default: true)\n * @param {string} [breachOptions.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [breachOptions.userAgent] a custom string to send as the\n * User-Agent field in the request headers (default: `hibp <version>`)\n * @returns {Promise<SearchResults>} a Promise which resolves to an object\n * containing a \"breaches\" key (which can be null or an array of breach objects)\n * and a \"pastes\" key (which can be null or an array of paste objects), or\n * rejects with an Error\n * @example\n * search('foo', { apiKey: 'my-api-key' })\n * .then(data => {\n * if (data.breaches || data.pastes) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n * @example\n * search('nobody@nowhere.com', { apiKey: 'my-api-key', truncate: false })\n * .then(data => {\n * if (data.breaches || data.pastes) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n *\n * @see https://haveibeenpwned.com/\n */\nexport function search(\n account: string,\n breachOptions: {\n apiKey?: string;\n domain?: string;\n truncate?: boolean;\n baseUrl?: string;\n userAgent?: string;\n } = {\n truncate: true,\n },\n): Promise<SearchResults> {\n const { apiKey, baseUrl, userAgent } = breachOptions;\n\n return Promise.all([\n breachedAccount(account, breachOptions),\n // This email regex is garbage but it seems to be what the API uses:\n /^.+@.+$/.test(account)\n ? pasteAccount(account, { apiKey, baseUrl, userAgent })\n : null,\n ]).then(\n // Avoid array destructuring here to prevent need for Babel helpers\n (promises) => ({\n breaches: promises[0],\n pastes: promises[1],\n }),\n );\n}\n"],"names":["e","n","Promise","t","r","s","XMLHttpRequest","o","u","i","a","ok","status","statusText","url","responseURL","text","resolve","responseText","json","then","JSON","parse","blob","Blob","response","clone","headers","keys","entries","get","toLowerCase","has","l","open","method","onload","getAllResponseHeaders","replace","push","onerror","withCredentials","credentials","setRequestHeader","send","body","self","fetch","require$$0","default","Map","BAD_REQUEST","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","TOO_MANY_REQUESTS","fetchFromApi","endpoint","apiKey","baseUrl","userAgent","navigator","config","res","Error","message","rayId","blockedWithRayId","breach","breachName","options","encodeURIComponent","breachedAccount","account","includeUnverified","truncate","params","domain","join","breaches","dataClasses","pasteAccount","email","h","f","length","value","binLen","c","parseInt","substr","isNaN","w","E","A","charCodeAt","p","indexOf","search","charAt","ArrayBuffer","Uint8Array","outputUpper","toUpperCase","b64Pad","String","fromCharCode","outputLen","shakeLen","slice","[object Object]","this","encoding","numRounds","R","U","T","F","m","g","B","v","Y","H","C","I","L","M","N","super","hmacKey","format","pwnedPasswordRange","prefix","Object","assign","User-Agent","data","split","results","reduce","acc","row","suffix","countString","pwnedPassword","password","sha1","JSSHA","update","hash","getHash","range","breachOptions","all","test","promises","pastes"],"mappings":"uTAAe,SAASA,EAAEC,GAAG,OAAOA,EAAEA,GAAG,GAAG,IAAIC,SAAQ,SAASC,EAAEC,GAAG,IAAIC,EAAE,IAAIC,eAAeC,EAAE,GAAGC,EAAE,GAAGC,EAAE,GAAGC,EAAE,WAAW,MAAM,CAACC,GAAG,IAAIN,EAAEO,OAAO,IAAI,GAAGC,WAAWR,EAAEQ,WAAWD,OAAOP,EAAEO,OAAOE,IAAIT,EAAEU,YAAYC,KAAK,WAAW,OAAOd,QAAQe,QAAQZ,EAAEa,eAAeC,KAAK,WAAW,OAAOjB,QAAQe,QAAQZ,EAAEa,cAAcE,KAAKC,KAAKC,QAAQC,KAAK,WAAW,OAAOrB,QAAQe,QAAQ,IAAIO,KAAK,CAACnB,EAAEoB,aAAaC,MAAMhB,EAAEiB,QAAQ,CAACC,KAAK,WAAW,OAAOrB,GAAGsB,QAAQ,WAAW,OAAOrB,GAAGsB,IAAI,SAAS9B,GAAG,OAAOS,EAAET,EAAE+B,gBAAgBC,IAAI,SAAShC,GAAG,OAAOA,EAAE+B,gBAAgBtB,MAAM,IAAI,IAAIwB,KAAK5B,EAAE6B,KAAKjC,EAAEkC,QAAQ,MAAMnC,GAAE,GAAIK,EAAE+B,OAAO,WAAW/B,EAAEgC,wBAAwBC,QAAQ,gCAA+B,SAAStC,EAAEC,EAAEE,GAAGI,EAAEgC,KAAKtC,EAAEA,EAAE8B,eAAevB,EAAE+B,KAAK,CAACtC,EAAEE,IAAIM,EAAER,GAAGQ,EAAER,GAAGQ,EAAER,GAAG,IAAIE,EAAEA,KAAIA,EAAEO,MAAML,EAAEmC,QAAQpC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AU,IAGZ,MAAMjB,OAAEA,EAAMC,QAAEA,EAAOC,UAAEA,GAAc6F,EAEvC,OAAOvJ,QAAQwJ,IAAI,CACjBlF,EAAgBC,EAASgF,GAEzB,UAAUE,KAAKlF,GACXQ,EAAaR,EAAS,CAAEf,OAAAA,EAAQC,QAAAA,EAASC,UAAAA,IACzC,OACHxC,KAEAwI,KACC7E,SAAU6E,EAAS,GACnBC,OAAQD,EAAS"}
|
|
1
|
+
{"version":3,"file":"hibp.module.js","sources":["../../node_modules/unfetch/dist/unfetch.module.js","../../node_modules/isomorphic-unfetch/browser.js","../../src/api/haveibeenpwned/responses.ts","../../src/api/haveibeenpwned/fetchFromApi.ts","../../src/breach.ts","../../src/breachedAccount.ts","../../src/breaches.ts","../../src/dataClasses.ts","../../src/pasteAccount.ts","../../node_modules/jssha/dist/sha1.mjs","../../src/api/pwnedpasswords/responses.ts","../../src/pwnedPasswordRange.ts","../../src/api/pwnedpasswords/fetchFromApi.ts","../../src/pwnedPassword.ts","../../src/search.ts"],"sourcesContent":["export default function(e,n){return n=n||{},new Promise(function(t,r){var s=new XMLHttpRequest,o=[],u=[],i={},a=function(){return{ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:a,headers:{keys:function(){return o},entries:function(){return u},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}};for(var l in s.open(n.method||\"get\",e,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\\S\\n]*([\\s\\S]*?)$/gm,function(e,n,t){o.push(n=n.toLowerCase()),u.push([n,t]),i[n]=i[n]?i[n]+\",\"+t:t}),t(a())},s.onerror=r,s.withCredentials=\"include\"==n.credentials,n.headers)s.setRequestHeader(l,n.headers[l]);s.send(n.body||null)})}\n//# sourceMappingURL=unfetch.module.js.map\n","module.exports = self.fetch || (self.fetch = require('unfetch').default || require('unfetch'));\n","/**\n * Known potential responses from the remote API.\n *\n * Unfortunately, the API does not send a decent human-readable message back\n * with each response, but they are documented on the website:\n * https://haveibeenpwned.com/api/v3#ResponseCodes\n *\n * These objects simply provide a mapping between the HTTP response status code\n * and the corresponding human-readable message so we can throw a more\n * descriptive error for the consumer. (They are also leveraged in our tests.)\n */\n\nimport type { ResponseBody } from './types';\n\n/** @internal */\nexport interface HaveIBeenPwnedApiResponse {\n headers: Map<string, string>;\n status: number;\n statusText?: string;\n body?: ResponseBody;\n}\n\nconst emptyHeaders = new Map<string, string>();\n\n/** @internal */\nexport const OK: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 200,\n};\n\n/** @internal */\nexport const BAD_REQUEST: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 400,\n statusText:\n 'Bad request — the account does not comply with an acceptable format.',\n};\n\n/**\n * This response has unique behavior. For some reason, the API includes an\n * object in the response body for this one, containing a human-readable\n * message. Manually populating the message here purely for use in tests.\n *\n * @internal\n */\nexport const UNAUTHORIZED: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 401,\n body: {\n statusCode: 401,\n message: 'Access denied due to missing hibp-api-key.',\n },\n};\n\n/** @internal */\nexport const FORBIDDEN: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 403,\n statusText: 'Forbidden - access denied.',\n};\n\n/** @internal */\nexport const BLOCKED: HaveIBeenPwnedApiResponse = {\n headers: new Map([['cf-ray', 'someRayId']]),\n status: 403,\n};\n\n/** @internal */\nexport const NOT_FOUND: HaveIBeenPwnedApiResponse = {\n headers: emptyHeaders,\n status: 404,\n};\n\n/**\n * This response has unique behavior. For some reason, the API includes an\n * object in the response body for this one, containing a human-readable\n * message. Manually populating the message here purely for use in tests.\n *\n * @internal\n */\nexport const TOO_MANY_REQUESTS: HaveIBeenPwnedApiResponse = {\n headers: new Map([['retry-after', '2']]),\n status: 429,\n body: {\n statusCode: 429,\n message: 'Rate limit is exceeded. Try again in 2 seconds.',\n },\n};\n","import fetch from 'isomorphic-unfetch';\nimport { name, version } from '../../../package.json';\nimport {\n BAD_REQUEST,\n UNAUTHORIZED,\n FORBIDDEN,\n NOT_FOUND,\n TOO_MANY_REQUESTS,\n} from './responses';\nimport type { ApiData, ErrorData } from './types';\n\n/**\n * Custom error thrown when the haveibeenpwned.com API responds with 429 Too\n * Many Requests. See the `retryAfterSeconds` property for the number of seconds\n * to wait before attempting the request again.\n *\n * @see https://haveibeenpwned.com/API/v3#RateLimiting\n */\nexport class RateLimitError extends Error {\n /**\n * The number of seconds to wait before attempting the request again. May be\n * `undefined` if the API does not provide a `retry-after` header, but this\n * should never happen.\n */\n public retryAfterSeconds: number | undefined;\n\n constructor(\n retryAfter: ReturnType<Headers['get']>,\n message: Error['constructor']['prototype']['message'],\n options?: Error['constructor']['prototype']['options'],\n ) {\n super(message, options);\n this.name = this.constructor.name;\n this.retryAfterSeconds =\n typeof retryAfter === 'string'\n ? Number.parseInt(retryAfter, 10) /* c8 ignore start */\n : undefined;\n }\n}\n/* c8 ignore stop */\n\nfunction blockedWithRayId(rayId: string) {\n return `Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ${rayId})`;\n}\n\n/**\n * Fetches data from the supplied API endpoint.\n *\n * HTTP status code 200 returns an Object (data found).\n * HTTP status code 404 returns null (no data found).\n * HTTP status code 400 throws an Error (bad request).\n * HTTP status code 401 throws an Error (unauthorized).\n * HTTP status code 403 throws an Error (forbidden).\n * HTTP status code 429 throws an Error (too many requests).\n *\n * @internal\n * @private\n * @param {string} endpoint the API endpoint to query\n * @param {object} [options] a configuration object\n * @param {string} [options.apiKey] an API key from\n * https://haveibeenpwned.com/API/Key\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {Promise<ApiData>} a Promise which resolves to the data resulting\n * from the query (or null for 404 Not Found responses), or rejects with an\n * Error\n */\nexport function fetchFromApi(\n endpoint: string,\n {\n apiKey,\n baseUrl = 'https://haveibeenpwned.com/api/v3',\n userAgent,\n }: { apiKey?: string; baseUrl?: string; userAgent?: string } = {},\n): Promise<ApiData> {\n const headers: Record<string, string> = {};\n\n if (apiKey) {\n headers['HIBP-API-Key'] = apiKey;\n }\n\n if (userAgent) {\n headers['User-Agent'] = userAgent;\n }\n\n // Provide a default User-Agent when running outside the browser\n if (!userAgent && typeof navigator === 'undefined') {\n headers['User-Agent'] = `${name} ${version}`;\n }\n\n const config = { headers };\n const url = `${baseUrl.replace(/\\/$/g, '')}${endpoint}`;\n\n return fetch(url, config).then((res) => {\n if (res.ok) return res.json();\n\n switch (res.status) {\n case BAD_REQUEST.status:\n throw new Error(BAD_REQUEST.statusText);\n case UNAUTHORIZED.status:\n return res.json().then((body: ErrorData) => {\n throw new Error(body.message);\n });\n case FORBIDDEN.status: {\n const rayId = res.headers.get('cf-ray');\n if (rayId) {\n throw new Error(blockedWithRayId(rayId));\n }\n throw new Error(FORBIDDEN.statusText);\n }\n case NOT_FOUND.status:\n return null;\n case TOO_MANY_REQUESTS.status:\n return res.json().then((body: ErrorData) => {\n const retryAfter = res.headers.get('retry-after');\n throw new RateLimitError(retryAfter, body.message);\n });\n default:\n throw new Error(res.statusText);\n }\n });\n}\n","import type { Breach } from './api/haveibeenpwned/types';\nimport { fetchFromApi } from './api/haveibeenpwned';\n\n/**\n * An object representing a breach.\n *\n * @typedef {object} Breach\n * @property {string} Name\n * @property {string} Title\n * @property {string} Domain\n * @property {string} BreachDate\n * @property {string} AddedDate\n * @property {string} ModifiedDate\n * @property {number} PwnCount\n * @property {string} Description\n * @property {string} LogoPath\n * @property {string[]} DataClasses\n * @property {boolean} IsVerified\n * @property {boolean} IsFabricated\n * @property {boolean} IsSensitive\n * @property {boolean} IsRetired\n * @property {boolean} IsSpamList\n */\n\n/**\n * Fetches data for a specific breach event.\n *\n * @param {string} breachName the name of a breach in the system\n * @param {object} [options] a configuration object\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {(Promise<Breach>|Promise<null>)} a Promise which resolves to an\n * object representing a breach (or null if no breach was found), or rejects\n * with an Error\n * @example\n * breach('Adobe')\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n */\nexport function breach(\n breachName: string,\n options: { baseUrl?: string; userAgent?: string } = {},\n): Promise<Breach | null> {\n return fetchFromApi(\n `/breach/${encodeURIComponent(breachName)}`,\n options,\n ) as Promise<Breach | null>;\n}\n","import type { Breach } from './api/haveibeenpwned/types';\nimport { fetchFromApi } from './api/haveibeenpwned';\n\n/**\n * Fetches breach data for a specific account.\n *\n * ***Warning (July 18, 2019):***\n *\n * `haveibeenpwned.com` now requires an API key from\n * https://haveibeenpwned.com/API/Key for the `breachedaccount` endpoint. The\n * `apiKey` option here is not explicitly required, but direct requests made\n * without it (that is, without specifying a `baseUrl` to a proxy that inserts a\n * valid API key on your behalf) will fail.\n *\n * @param {string} account a username or email address\n * @param {object} [options] a configuration object\n * @param {string} [options.apiKey] an API key from\n * https://haveibeenpwned.com/API/Key (default: undefined)\n * @param {string} [options.domain] a domain by which to filter the results\n * (default: all domains)\n * @param {boolean} [options.includeUnverified] include \"unverified\" breaches in\n * the results (default: true)\n * @param {boolean} [options.truncate] truncate the results to only include\n * the name of each breach (default: true)\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {(Promise<Breach[]> | Promise<null>)} a Promise which resolves to an\n * array of breach objects (or null if no breaches were found), or rejects with\n * an Error\n * @example\n * breachedAccount('foo', { apiKey: 'my-api-key' })\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n * @example\n * breachedAccount('bar', {\n * includeUnverified: false,\n * baseUrl: 'https://my-hibp-proxy:8080',\n * })\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n * @example\n * breachedAccount('baz', {\n * apiKey: 'my-api-key',\n * domain: 'adobe.com',\n * truncate: false,\n * userAgent: 'my-app 1.0'\n * })\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n */\nexport function breachedAccount(\n account: string,\n options: {\n apiKey?: string;\n domain?: string;\n includeUnverified?: boolean;\n truncate?: boolean;\n baseUrl?: string;\n userAgent?: string;\n } = {\n includeUnverified: true,\n truncate: true,\n },\n): Promise<Breach[] | null> {\n const endpoint = `/breachedaccount/${encodeURIComponent(account)}?`;\n const params: Array<string> = [];\n if (options.domain) {\n params.push(`domain=${encodeURIComponent(options.domain)}`);\n }\n if (options.includeUnverified === false) {\n params.push('includeUnverified=false');\n }\n if (options.truncate === false) {\n params.push('truncateResponse=false');\n }\n return fetchFromApi(`${endpoint}${params.join('&')}`, {\n apiKey: options.apiKey,\n baseUrl: options.baseUrl,\n userAgent: options.userAgent,\n }) as Promise<Breach[] | null>;\n}\n","import type { Breach } from './api/haveibeenpwned/types';\nimport { fetchFromApi } from './api/haveibeenpwned';\n\n/**\n * Fetches all breach events in the system.\n *\n * @param {object} [options] a configuration object\n * @param {string} [options.domain] a domain by which to filter the results\n * (default: all domains)\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {Promise<Breach[]>} a Promise which resolves to an array of breach\n * objects (an empty array if no breaches were found), or rejects with an Error\n * @example\n * breaches()\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n * @example\n * breaches({ domain: 'adobe.com' })\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n */\nexport function breaches(\n options: {\n domain?: string;\n baseUrl?: string;\n userAgent?: string;\n } = {},\n): Promise<Breach[]> {\n const endpoint = '/breaches?';\n const params: Array<string> = [];\n if (options.domain) {\n params.push(`domain=${encodeURIComponent(options.domain)}`);\n }\n return fetchFromApi(`${endpoint}${params.join('&')}`, {\n baseUrl: options.baseUrl,\n userAgent: options.userAgent,\n }) as Promise<Breach[]>;\n}\n","import { fetchFromApi } from './api/haveibeenpwned';\n\n/**\n * Fetches all data classes in the system.\n *\n * @param {object} [options] a configuration object\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {(Promise<string[]> | Promise<null>)} a Promise which resolves to an\n * array of strings (or null if no data classes were found), or rejects with an\n * Error\n * @example\n * dataClasses()\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n */\nexport function dataClasses(\n options: { baseUrl?: string; userAgent?: string } = {},\n): Promise<string[] | null> {\n return fetchFromApi('/dataclasses', options) as Promise<string[] | null>;\n}\n","import type { Paste } from './api/haveibeenpwned/types';\nimport { fetchFromApi } from './api/haveibeenpwned';\n\n/**\n * An object representing a paste.\n *\n * @typedef {object} Paste\n * @property {string} Id\n * @property {string} Source\n * @property {string} Title\n * @property {string} Date\n * @property {number} EmailCount\n */\n\n/**\n * Fetches paste data for a specific account (email address).\n *\n * ***Warning (July 18, 2019):***\n *\n * `haveibeenpwned.com` now requires an API key from\n * https://haveibeenpwned.com/API/Key for the `pasteaccount` endpoint. The\n * `apiKey` option here is not explicitly required, but direct requests made\n * without it (that is, without specifying a `baseUrl` to a proxy that inserts a\n * valid API key on your behalf) will fail.\n *\n * @param {string} email the email address to query\n * @param {object} [options] a configuration object\n * @param {string} [options.apiKey] an API key from\n * https://haveibeenpwned.com/API/Key\n * @param {string} [options.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {(Promise<Paste[]> | Promise<null>)} a Promise which resolves to an\n * array of paste objects (or null if no pastes were found), or rejects with an\n * Error\n * @example\n * pasteAccount('foo@bar.com', { apiKey: 'my-api-key' })\n * .then(data => {\n * if (data) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n */\nexport function pasteAccount(\n email: string,\n options: { apiKey?: string; baseUrl?: string; userAgent?: string } = {},\n): Promise<Paste[] | null> {\n return fetchFromApi(`/pasteaccount/${encodeURIComponent(email)}`, {\n apiKey: options.apiKey,\n baseUrl: options.baseUrl,\n userAgent: options.userAgent,\n }) as Promise<Paste[] | null>;\n}\n","/**\n * A JavaScript implementation of the SHA family of hashes - defined in FIPS PUB 180-4, FIPS PUB 202,\n * and SP 800-185 - as well as the corresponding HMAC implementation as defined in FIPS PUB 198-1.\n *\n * Copyright 2008-2020 Brian Turek, 1998-2009 Paul Johnston & Contributors\n * Distributed under the BSD License\n * See http://caligatio.github.com/jsSHA/ for more information\n */\nconst t=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";function r(t,r,n,i){let e,s,o;const h=r||[0],u=(n=n||0)>>>3,f=-1===i?3:0;for(e=0;e<t.length;e+=1)o=e+u,s=o>>>2,h.length<=s&&h.push(0),h[s]|=t[e]<<8*(f+i*(o%4));return{value:h,binLen:8*t.length+n}}function n(n,i,e){switch(i){case\"UTF8\":case\"UTF16BE\":case\"UTF16LE\":break;default:throw new Error(\"encoding must be UTF8, UTF16BE, or UTF16LE\")}switch(n){case\"HEX\":return function(t,r,n){return function(t,r,n,i){let e,s,o,h;if(0!=t.length%2)throw new Error(\"String of HEX type must be in byte increments\");const u=r||[0],f=(n=n||0)>>>3,c=-1===i?3:0;for(e=0;e<t.length;e+=2){if(s=parseInt(t.substr(e,2),16),isNaN(s))throw new Error(\"String of HEX type contains invalid characters\");for(h=(e>>>1)+f,o=h>>>2;u.length<=o;)u.push(0);u[o]|=s<<8*(c+i*(h%4))}return{value:u,binLen:4*t.length+n}}(t,r,n,e)};case\"TEXT\":return function(t,r,n){return function(t,r,n,i,e){let s,o,h,u,f,c,a,w,E=0;const l=n||[0],A=(i=i||0)>>>3;if(\"UTF8\"===r)for(a=-1===e?3:0,h=0;h<t.length;h+=1)for(s=t.charCodeAt(h),o=[],128>s?o.push(s):2048>s?(o.push(192|s>>>6),o.push(128|63&s)):55296>s||57344<=s?o.push(224|s>>>12,128|s>>>6&63,128|63&s):(h+=1,s=65536+((1023&s)<<10|1023&t.charCodeAt(h)),o.push(240|s>>>18,128|s>>>12&63,128|s>>>6&63,128|63&s)),u=0;u<o.length;u+=1){for(c=E+A,f=c>>>2;l.length<=f;)l.push(0);l[f]|=o[u]<<8*(a+e*(c%4)),E+=1}else for(a=-1===e?2:0,w=\"UTF16LE\"===r&&1!==e||\"UTF16LE\"!==r&&1===e,h=0;h<t.length;h+=1){for(s=t.charCodeAt(h),!0===w&&(u=255&s,s=u<<8|s>>>8),c=E+A,f=c>>>2;l.length<=f;)l.push(0);l[f]|=s<<8*(a+e*(c%4)),E+=2}return{value:l,binLen:8*E+i}}(t,i,r,n,e)};case\"B64\":return function(r,n,i){return function(r,n,i,e){let s,o,h,u,f,c,a,w=0;const E=n||[0],l=(i=i||0)>>>3,A=-1===e?3:0,p=r.indexOf(\"=\");if(-1===r.search(/^[a-zA-Z0-9=+/]+$/))throw new Error(\"Invalid character in base-64 string\");if(r=r.replace(/=/g,\"\"),-1!==p&&p<r.length)throw new Error(\"Invalid '=' found in base-64 string\");for(o=0;o<r.length;o+=4){for(f=r.substr(o,4),u=0,h=0;h<f.length;h+=1)s=t.indexOf(f.charAt(h)),u|=s<<18-6*h;for(h=0;h<f.length-1;h+=1){for(a=w+l,c=a>>>2;E.length<=c;)E.push(0);E[c]|=(u>>>16-8*h&255)<<8*(A+e*(a%4)),w+=1}}return{value:E,binLen:8*w+i}}(r,n,i,e)};case\"BYTES\":return function(t,r,n){return function(t,r,n,i){let e,s,o,h;const u=r||[0],f=(n=n||0)>>>3,c=-1===i?3:0;for(s=0;s<t.length;s+=1)e=t.charCodeAt(s),h=s+f,o=h>>>2,u.length<=o&&u.push(0),u[o]|=e<<8*(c+i*(h%4));return{value:u,binLen:8*t.length+n}}(t,r,n,e)};case\"ARRAYBUFFER\":try{new ArrayBuffer(0)}catch(t){throw new Error(\"ARRAYBUFFER not supported by this environment\")}return function(t,n,i){return function(t,n,i,e){return r(new Uint8Array(t),n,i,e)}(t,n,i,e)};case\"UINT8ARRAY\":try{new Uint8Array(0)}catch(t){throw new Error(\"UINT8ARRAY not supported by this environment\")}return function(t,n,i){return r(t,n,i,e)};default:throw new Error(\"format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY\")}}function i(r,n,i,e){switch(r){case\"HEX\":return function(t){return function(t,r,n,i){let e,s,o=\"\";const h=r/8,u=-1===n?3:0;for(e=0;e<h;e+=1)s=t[e>>>2]>>>8*(u+n*(e%4)),o+=\"0123456789abcdef\".charAt(s>>>4&15)+\"0123456789abcdef\".charAt(15&s);return i.outputUpper?o.toUpperCase():o}(t,n,i,e)};case\"B64\":return function(r){return function(r,n,i,e){let s,o,h,u,f,c=\"\";const a=n/8,w=-1===i?3:0;for(s=0;s<a;s+=3)for(u=s+1<a?r[s+1>>>2]:0,f=s+2<a?r[s+2>>>2]:0,h=(r[s>>>2]>>>8*(w+i*(s%4))&255)<<16|(u>>>8*(w+i*((s+1)%4))&255)<<8|f>>>8*(w+i*((s+2)%4))&255,o=0;o<4;o+=1)c+=8*s+6*o<=n?t.charAt(h>>>6*(3-o)&63):e.b64Pad;return c}(r,n,i,e)};case\"BYTES\":return function(t){return function(t,r,n){let i,e,s=\"\";const o=r/8,h=-1===n?3:0;for(i=0;i<o;i+=1)e=t[i>>>2]>>>8*(h+n*(i%4))&255,s+=String.fromCharCode(e);return s}(t,n,i)};case\"ARRAYBUFFER\":try{new ArrayBuffer(0)}catch(t){throw new Error(\"ARRAYBUFFER not supported by this environment\")}return function(t){return function(t,r,n){let i;const e=r/8,s=new ArrayBuffer(e),o=new Uint8Array(s),h=-1===n?3:0;for(i=0;i<e;i+=1)o[i]=t[i>>>2]>>>8*(h+n*(i%4))&255;return s}(t,n,i)};case\"UINT8ARRAY\":try{new Uint8Array(0)}catch(t){throw new Error(\"UINT8ARRAY not supported by this environment\")}return function(t){return function(t,r,n){let i;const e=r/8,s=-1===n?3:0,o=new Uint8Array(e);for(i=0;i<e;i+=1)o[i]=t[i>>>2]>>>8*(s+n*(i%4))&255;return o}(t,n,i)};default:throw new Error(\"format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY\")}}function e(t){const r={outputUpper:!1,b64Pad:\"=\",outputLen:-1},n=t||{},i=\"Output length must be a multiple of 8\";if(r.outputUpper=n.outputUpper||!1,n.b64Pad&&(r.b64Pad=n.b64Pad),n.outputLen){if(n.outputLen%8!=0)throw new Error(i);r.outputLen=n.outputLen}else if(n.shakeLen){if(n.shakeLen%8!=0)throw new Error(i);r.outputLen=n.shakeLen}if(\"boolean\"!=typeof r.outputUpper)throw new Error(\"Invalid outputUpper formatting option\");if(\"string\"!=typeof r.b64Pad)throw new Error(\"Invalid b64Pad formatting option\");return r}function s(t,r){return t<<r|t>>>32-r}function o(t,r,n){return t^r^n}function h(t,r,n){return t&r^t&n^r&n}function u(t,r){const n=(65535&t)+(65535&r);return(65535&(t>>>16)+(r>>>16)+(n>>>16))<<16|65535&n}function f(t,r,n,i,e){const s=(65535&t)+(65535&r)+(65535&n)+(65535&i)+(65535&e);return(65535&(t>>>16)+(r>>>16)+(n>>>16)+(i>>>16)+(e>>>16)+(s>>>16))<<16|65535&s}function c(t){return[1732584193,4023233417,2562383102,271733878,3285377520]}function a(t,r){let n,i,e,c,a,w,E;const l=[];for(n=r[0],i=r[1],e=r[2],c=r[3],a=r[4],E=0;E<80;E+=1)l[E]=E<16?t[E]:s(l[E-3]^l[E-8]^l[E-14]^l[E-16],1),w=E<20?f(s(n,5),(A=i)&e^~A&c,a,1518500249,l[E]):E<40?f(s(n,5),o(i,e,c),a,1859775393,l[E]):E<60?f(s(n,5),h(i,e,c),a,2400959708,l[E]):f(s(n,5),o(i,e,c),a,3395469782,l[E]),a=c,c=e,e=s(i,30),i=n,n=w;var A;return r[0]=u(n,r[0]),r[1]=u(i,r[1]),r[2]=u(e,r[2]),r[3]=u(c,r[3]),r[4]=u(a,r[4]),r}function w(t,r,n,i){let e;const s=15+(r+65>>>9<<4),o=r+n;for(;t.length<=s;)t.push(0);for(t[r>>>5]|=128<<24-r%32,t[s]=4294967295&o,t[s-1]=o/4294967296|0,e=0;e<t.length;e+=16)i=a(t.slice(e,e+16),i);return i}export default class extends class{constructor(t,r,n){const i=n||{};if(this.t=r,this.i=i.encoding||\"UTF8\",this.numRounds=i.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw new Error(\"numRounds must a integer >= 1\");this.s=t,this.o=[],this.h=0,this.u=!1,this.l=0,this.A=!1,this.p=[],this.R=[]}update(t){let r,n=0;const i=this.U>>>5,e=this.T(t,this.o,this.h),s=e.binLen,o=e.value,h=s>>>5;for(r=0;r<h;r+=i)n+this.U<=s&&(this.F=this.m(o.slice(r,r+i),this.F),n+=this.U);this.l+=n,this.o=o.slice(n>>>5),this.h=s%this.U,this.u=!0}getHash(t,r){let n,s,o=this.g;const h=e(r);if(this.B){if(-1===h.outputLen)throw new Error(\"Output length must be specified in options\");o=h.outputLen}const u=i(t,o,this.v,h);if(this.A&&this.Y)return u(this.Y(h));for(s=this.H(this.o.slice(),this.h,this.l,this.C(this.F),o),n=1;n<this.numRounds;n+=1)this.B&&o%32!=0&&(s[s.length-1]&=16777215>>>24-o%32),s=this.H(s,o,0,this.I(this.s),o);return u(s)}setHMACKey(t,r,i){if(!this.L)throw new Error(\"Variant does not support HMAC\");if(this.u)throw new Error(\"Cannot set MAC key after calling update\");const e=n(r,(i||{}).encoding||\"UTF8\",this.v);this.M(e(t))}M(t){const r=this.U>>>3,n=r/4-1;let i;if(1!==this.numRounds)throw new Error(\"Cannot set numRounds with MAC\");if(this.A)throw new Error(\"MAC key already set\");for(r<t.binLen/8&&(t.value=this.H(t.value,t.binLen,0,this.I(this.s),this.g));t.value.length<=n;)t.value.push(0);for(i=0;i<=n;i+=1)this.p[i]=909522486^t.value[i],this.R[i]=1549556828^t.value[i];this.F=this.m(this.p,this.F),this.l=this.U,this.A=!0}getHMAC(t,r){const n=e(r);return i(t,this.g,this.v,n)(this.N())}N(){let t;if(!this.A)throw new Error(\"Cannot call getHMAC without first setting MAC key\");const r=this.H(this.o.slice(),this.h,this.l,this.C(this.F),this.g);return t=this.m(this.R,this.I(this.s)),t=this.H(r,this.g,this.U,t,this.g),t}}{constructor(t,r,i){if(\"SHA-1\"!==t)throw new Error(\"Chosen SHA variant is not supported\");super(t,r,i);const e=i||{};this.L=!0,this.Y=this.N,this.v=-1,this.T=n(this.t,this.i,this.v),this.m=a,this.C=function(t){return t.slice()},this.I=c,this.H=w,this.F=[1732584193,4023233417,2562383102,271733878,3285377520],this.U=512,this.g=160,this.B=!1,e.hmacKey&&this.M(function(t,r,i,e){const s=t+\" must include a value and format\";if(!r){if(!e)throw new Error(s);return e}if(void 0===r.value||!r.format)throw new Error(s);return n(r.format,r.encoding||\"UTF8\",i)(r.value)}(\"hmacKey\",e.hmacKey,this.v))}}\n","/**\n * Known potential responses from the remote API.\n *\n * https://haveibeenpwned.com/api/v3#PwnedPasswords\n *\n */\n\n/** @internal */\nexport interface PwnedPasswordsApiResponse {\n status: number;\n body?: string;\n}\n\n/** @internal */\nexport const OK: PwnedPasswordsApiResponse = {\n status: 200,\n};\n\n/** @internal */\nexport const BAD_REQUEST: PwnedPasswordsApiResponse = {\n status: 400,\n body: 'The hash prefix was not in a valid format',\n};\n","import { fetchFromApi } from './api/pwnedpasswords';\n\nexport interface PwnedPasswordSuffixes {\n [suffix: string]: number;\n}\n\n/**\n * An object mapping an exposed password hash suffix (corresponding to a given\n * hash prefix) to how many times it occurred in the Pwned Passwords repository.\n *\n * @typedef {Object.<string, number>} PwnedPasswordSuffixes\n */\n\n/**\n * Fetches the SHA-1 hash suffixes for the given 5-character SHA-1 hash prefix.\n *\n * When a password hash with the same first 5 characters is found in the Pwned\n * Passwords repository, the API will respond with an HTTP 200 and include the\n * suffix of every hash beginning with the specified prefix, followed by a count\n * of how many times it appears in the data set. This function parses the\n * response and returns a more structured format.\n *\n * @param {string} prefix the first 5 characters of a SHA-1 password hash (case\n * insensitive)\n * @param {object} [options] a configuration object\n * @param {string} [options.baseUrl] a custom base URL for the\n * pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {Promise<PwnedPasswordSuffixes>} a Promise which resolves to an\n * object mapping the `suffix` that when matched with the prefix composes the\n * complete hash, to the `count` of how many times it appears in the breached\n * password data set, or rejects with an Error\n *\n * @example\n * pwnedPasswordRange('5BAA6')\n * .then(results => {\n * // results will have the following shape:\n * // {\n * // \"003D68EB55068C33ACE09247EE4C639306B\": 3,\n * // \"012C192B2F16F82EA0EB9EF18D9D539B0DD\": 1,\n * // ...\n * // }\n * })\n * @example\n * const suffix = '1E4C9B93F3F0682250B6CF8331B7EE68FD8';\n * pwnedPasswordRange('5BAA6')\n * .then(results => (results[suffix] || 0))\n * .catch(err => {\n * // ...\n * });\n * @see https://haveibeenpwned.com/api/v3#SearchingPwnedPasswordsByRange\n */\nexport function pwnedPasswordRange(\n prefix: string,\n options: { baseUrl?: string; userAgent?: string } = {},\n): Promise<PwnedPasswordSuffixes> {\n return (\n fetchFromApi(`/range/${encodeURIComponent(prefix)}`, options)\n // create array from lines of text in response body\n .then((data) => data.split('\\n').filter(Boolean))\n // convert into an object mapping suffix to count for each line\n .then((results) =>\n results.reduce<PwnedPasswordSuffixes>((acc, row) => {\n const [suffix, countString] = row.split(':');\n acc[suffix] = parseInt(countString, 10);\n return acc;\n }, {}),\n )\n );\n}\n","import fetch from 'isomorphic-unfetch';\nimport { BAD_REQUEST } from './responses';\n\n/**\n * Fetches data from the supplied API endpoint.\n *\n * HTTP status code 200 returns plain text (data found).\n * HTTP status code 400 throws an Error (bad request).\n *\n * @internal\n * @private\n * @param {string} endpoint the API endpoint to query\n * @param {object} [options] a configuration object\n * @param {string} [options.baseUrl] a custom base URL for the\n * pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {Promise<string>} a Promise which resolves to the data resulting\n * from the query, or rejects with an Error\n */\nexport function fetchFromApi(\n endpoint: string,\n {\n baseUrl = 'https://api.pwnedpasswords.com',\n userAgent,\n }: { baseUrl?: string; userAgent?: string } = {},\n): Promise<string> {\n const config = Object.assign(\n {},\n userAgent\n ? {\n headers: {\n 'User-Agent': userAgent,\n },\n }\n : {},\n );\n\n const url = `${baseUrl.replace(/\\/$/g, '')}${endpoint}`;\n\n return fetch(url, config).then((res) => {\n if (res.ok) return res.text();\n\n if (res.status === BAD_REQUEST.status) {\n return res.text().then((text) => {\n throw new Error(text);\n });\n }\n\n throw new Error(res.statusText);\n });\n}\n","import JSSHA from 'jssha/dist/sha1';\nimport { pwnedPasswordRange } from './pwnedPasswordRange';\n\n/**\n * Fetches the number of times the the given password has been exposed in a\n * breach (0 indicating no exposure). The password is given in plain text, but\n * only the first 5 characters of its SHA-1 hash will be submitted to the API.\n *\n * @param {string} password a password in plain text\n * @param {object} [options] a configuration object\n * @param {string} [options.baseUrl] a custom base URL for the\n * pwnedpasswords.com API endpoints (default: `https://api.pwnedpasswords.com`)\n * @param {string} [options.userAgent] a custom string to send as the User-Agent\n * field in the request headers (default: `hibp <version>`)\n * @returns {Promise<number>} a Promise which resolves to the number of times\n * the password has been exposed in a breach, or rejects with an Error\n * @example\n * pwnedPassword('f00b4r')\n * .then(numPwns => {\n * // truthy check or numeric condition\n * if (numPwns) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n * @see https://haveibeenpwned.com/api/v3#PwnedPasswords\n */\nexport function pwnedPassword(\n password: string,\n options: { baseUrl?: string; userAgent?: string } = {},\n): Promise<number> {\n const sha1 = new JSSHA('SHA-1', 'TEXT');\n sha1.update(password);\n const hash = sha1.getHash('HEX', { outputUpper: true });\n const prefix = hash.slice(0, 5);\n const suffix = hash.slice(5);\n\n return pwnedPasswordRange(prefix, options).then(\n (range) => range[suffix] || 0,\n );\n}\n","import type { Breach, Paste } from './api/haveibeenpwned/types';\nimport { breachedAccount } from './breachedAccount';\nimport { pasteAccount } from './pasteAccount';\n\nexport interface SearchResults {\n breaches: Breach[] | null;\n pastes: Paste[] | null;\n}\n\n/**\n * An object representing search results.\n *\n * @typedef {object} SearchResults\n * @property {(Breach[] | null)} breaches\n * @property {(Paste[] | null)} pastes\n */\n\n/**\n * Fetches all breaches and all pastes associated with the provided account\n * (email address or username). Note that the remote API does not support\n * querying pastes by username (only email addresses), so in the event the\n * provided account is not a valid email address, only breach data is queried\n * and the \"pastes\" field of the resulting object will always be null. This is\n * exactly how searching via the current web interface behaves, which this\n * convenience method is designed to mimic.\n *\n * ***Warning (July 18, 2019):***\n *\n * `haveibeenpwned.com` now requires an API key from\n * https://haveibeenpwned.com/API/Key for the `breachedaccount` and\n * `pasteaccount` endpoints. The `apiKey` option here is not explicitly\n * required, but direct requests made without it (that is, without specifying a\n * `baseUrl` to a proxy that inserts a valid API key on your behalf) will fail.\n *\n * @param {string} account an email address or username\n * @param {object} [breachOptions] a configuration object pertaining to breach\n * queries\n * @param {string} [breachOptions.apiKey] an API key from\n * https://haveibeenpwned.com/API/Key\n * @param {string} [breachOptions.domain] a domain by which to filter the\n * results (default: all domains)\n * @param {boolean} [breachOptions.truncate] truncate the results to only\n * include the name of each breach (default: true)\n * @param {string} [breachOptions.baseUrl] a custom base URL for the\n * haveibeenpwned.com API endpoints (default:\n * `https://haveibeenpwned.com/api/v3`)\n * @param {string} [breachOptions.userAgent] a custom string to send as the\n * User-Agent field in the request headers (default: `hibp <version>`)\n * @returns {Promise<SearchResults>} a Promise which resolves to an object\n * containing a \"breaches\" key (which can be null or an array of breach objects)\n * and a \"pastes\" key (which can be null or an array of paste objects), or\n * rejects with an Error\n * @example\n * search('foo', { apiKey: 'my-api-key' })\n * .then(data => {\n * if (data.breaches || data.pastes) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n * @example\n * search('nobody@nowhere.com', { apiKey: 'my-api-key', truncate: false })\n * .then(data => {\n * if (data.breaches || data.pastes) {\n * // ...\n * } else {\n * // ...\n * }\n * })\n * .catch(err => {\n * // ...\n * });\n *\n * @see https://haveibeenpwned.com/\n */\nexport function search(\n account: string,\n breachOptions: {\n apiKey?: string;\n domain?: string;\n truncate?: boolean;\n baseUrl?: string;\n userAgent?: string;\n } = {\n truncate: true,\n },\n): Promise<SearchResults> {\n const { apiKey, baseUrl, userAgent } = breachOptions;\n\n return Promise.all([\n breachedAccount(account, breachOptions),\n // This email regex is garbage but it seems to be what the API uses:\n /^.+@.+$/.test(account)\n ? pasteAccount(account, { apiKey, baseUrl, userAgent })\n : null,\n ]).then(\n // Avoid array destructuring here to prevent need for Babel helpers\n (promises) => ({\n breaches: promises[0],\n pastes: promises[1],\n }),\n );\n}\n"],"names":["e","n","Promise","t","r","s","XMLHttpRequest","o","u","i","a","ok","status","statusText","url","responseURL","text","resolve","responseText","json","then","JSON","parse","blob","Blob","response","clone","headers","keys","entries","get","toLowerCase","has","l","open","method","onload","getAllResponseHeaders","replace","push","onerror","withCredentials","credentials","setRequestHeader","send","body","browser","self","fetch","require$$0","default","Map","BAD_REQUEST","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","TOO_MANY_REQUESTS","RateLimitError","Error","retryAfterSeconds","constructor","retryAfter","message","options","super","this","name","Number","parseInt","undefined","fetchFromApi","endpoint","apiKey","baseUrl","userAgent","navigator","config","res","rayId","blockedWithRayId","breach","breachName","encodeURIComponent","breachedAccount","account","includeUnverified","truncate","params","domain","join","breaches","dataClasses","pasteAccount","email","h","f","length","value","binLen","c","substr","isNaN","w","E","A","charCodeAt","p","indexOf","search","charAt","ArrayBuffer","Uint8Array","outputUpper","toUpperCase","b64Pad","String","fromCharCode","outputLen","shakeLen","slice","JSSHA","encoding","numRounds","R","update","U","T","F","m","getHash","g","B","v","Y","H","C","I","setHMACKey","L","M","getHMAC","N","hmacKey","format","pwnedPasswordRange","prefix","Object","assign","data","split","filter","Boolean","results","reduce","acc","row","suffix","countString","pwnedPassword","password","sha1","hash","range","breachOptions","all","test","promises","pastes"],"mappings":"iZAAe,SAASA,EAAEC,GAAG,OAAOA,EAAEA,GAAG,GAAG,IAAIC,SAAQ,SAASC,EAAEC,GAAG,IAAIC,EAAE,IAAIC,eAAeC,EAAE,GAAGC,EAAE,GAAGC,EAAE,GAAGC,EAAE,WAAW,MAAM,CAACC,GAAG,IAAIN,EAAEO,OAAO,IAAI,GAAGC,WAAWR,EAAEQ,WAAWD,OAAOP,EAAEO,OAAOE,IAAIT,EAAEU,YAAYC,KAAK,WAAW,OAAOd,QAAQe,QAAQZ,EAAEa,eAAeC,KAAK,WAAW,OAAOjB,QAAQe,QAAQZ,EAAEa,cAAcE,KAAKC,KAAKC,QAAQC,KAAK,WAAW,OAAOrB,QAAQe,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OACHtD,MAEAkJ,IAAc,CACb5E,SAAU4E,EAAS,GACnBC,OAAQD,EAAS"}
|
package/dist/browser/hibp.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}!function(t,e){if("function"==typeof define&&define.amd)define("hibp",["exports"],e);else if("undefined"!=typeof exports)e(exports);else{var r={exports:{}};e(r.exports),t.hibp=r.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var u,s=t[Symbol.iterator]();!(n=(u=s.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==s.return||s.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);e>r;r++)n[r]=t[r];return n}function o(t,e){for(var r=0;e.length>r;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return a(this,r)}}function a(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e):r}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function f(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}Object.defineProperty(e,"__esModule",{value:!0}),e.breach=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return w("/breach/".concat(encodeURIComponent(t)),e)},e.breachedAccount=U,e.breaches=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="/breaches?",r=[];t.domain&&r.push("domain=".concat(encodeURIComponent(t.domain)));return w("".concat(e).concat(r.join("&")),{baseUrl:t.baseUrl,userAgent:t.userAgent})},e.dataClasses=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return w("/dataclasses",t)},e.pasteAccount=E,e.pwnedPassword=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new x("SHA-1","TEXT");r.update(t);var n=r.getHash("HEX",{outputUpper:!0}),o=n.slice(0,5),i=n.slice(5);return _(o,e).then((function(t){return t[i]||0}))},e.pwnedPasswordRange=_,e.search=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{truncate:!0},r=e.apiKey,n=e.baseUrl,o=e.userAgent;return Promise.all([U(t,e),/^.+@.+$/.test(t)?E(t,{apiKey:r,baseUrl:n,userAgent:o}):null]).then((function(t){return{breaches:t[0],pastes:t[1]}}))};var h=f(Object.freeze({__proto__:null,default:function(t,e){return e=e||{},new Promise((function(r,n){var o=new XMLHttpRequest,i=[],u=[],s={};for(var a in o.open(e.method||"get",t,!0),o.onload=function(){o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(t,e,r){i.push(e=e.toLowerCase()),u.push([e,r]),s[e]=s[e]?s[e]+","+r:r})),r(function t(){return{ok:2==(o.status/100|0),statusText:o.statusText,status:o.status,url:o.responseURL,text:function(){return Promise.resolve(o.responseText)},json:function(){return Promise.resolve(o.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([o.response]))},clone:t,headers:{keys:function(){return i},entries:function(){return u},get:function(t){return s[t.toLowerCase()]},has:function(t){return t.toLowerCase()in s}}}}())},o.onerror=n,o.withCredentials="include"==e.credentials,e.headers)o.setRequestHeader(a,e.headers[a]);o.send(e.body||null)}))}})),l=self.fetch||(self.fetch=h.default||h),p=(new Map,400),d="Bad request — the account does not comply with an acceptable format.",v=401,y=403,b="Forbidden - access denied.",g=404,m=429;function A(t){return"Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ".concat(t,")")}function w(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.apiKey,n=e.baseUrl,o=void 0===n?"https://haveibeenpwned.com/api/v3":n,i=e.userAgent,u={};r&&(u["HIBP-API-Key"]=r),i&&(u["User-Agent"]=i),i||"undefined"!=typeof navigator||(u["User-Agent"]="".concat("hibp"," ").concat("11.0.0"));var s={headers:u},a="".concat(o.replace(/\/$/g,"")).concat(t);return l(a,s).then((function(t){if(t.ok)return t.json();switch(t.status){case p:throw Error(d);case v:return t.json().then((function(t){throw Error(t.message)}));case y:var e=t.headers.get("cf-ray");if(e)throw Error(A(e));throw Error(b);case g:return null;case m:return t.json().then((function(t){throw Error(t.message)}));default:throw Error(t.statusText)}}))}function U(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{includeUnverified:!0,truncate:!0},r="/breachedaccount/".concat(encodeURIComponent(t),"?"),n=[];return e.domain&&n.push("domain=".concat(encodeURIComponent(e.domain))),!1===e.includeUnverified&&n.push("includeUnverified=false"),!1===e.truncate&&n.push("truncateResponse=false"),w("".concat(r).concat(n.join("&")),{apiKey:e.apiKey,baseUrl:e.baseUrl,userAgent:e.userAgent})}function E(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return w("/pasteaccount/".concat(encodeURIComponent(t)),{apiKey:e.apiKey,baseUrl:e.baseUrl,userAgent:e.userAgent})}var R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function T(t,e,r,n){var o,i,u,s=e||[0],a=(r=r||0)>>>3,c=-1===n?3:0;for(o=0;t.length>o;o+=1)(i=(u=o+a)>>>2)>=s.length&&s.push(0),s[i]|=t[o]<<8*(c+n*(u%4));return{value:s,binLen:8*t.length+r}}function C(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":return function(t,e,n){return function(t,e,r,n){var o,i,u,s;if(0!=t.length%2)throw Error("String of HEX type must be in byte increments");var a=e||[0],c=(r=r||0)>>>3,f=-1===n?3:0;for(o=0;t.length>o;o+=2){if(i=parseInt(t.substr(o,2),16),isNaN(i))throw Error("String of HEX type contains invalid characters");for(u=(s=(o>>>1)+c)>>>2;u>=a.length;)a.push(0);a[u]|=i<<8*(f+n*(s%4))}return{value:a,binLen:4*t.length+r}}(t,e,n,r)};case"TEXT":return function(t,n,o){return function(t,e,r,n,o){var i,u,s,a,c,f,h,l,p=0,d=r||[0],v=(n=n||0)>>>3;if("UTF8"===e)for(h=-1===o?3:0,s=0;t.length>s;s+=1)for(u=[],128>(i=t.charCodeAt(s))?u.push(i):2048>i?(u.push(192|i>>>6),u.push(128|63&i)):55296>i||i>=57344?u.push(224|i>>>12,128|i>>>6&63,128|63&i):(i=65536+((1023&i)<<10|1023&t.charCodeAt(s+=1)),u.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),a=0;u.length>a;a+=1){for(c=(f=p+v)>>>2;c>=d.length;)d.push(0);d[c]|=u[a]<<8*(h+o*(f%4)),p+=1}else for(h=-1===o?2:0,l="UTF16LE"===e&&1!==o||"UTF16LE"!==e&&1===o,s=0;t.length>s;s+=1){for(i=t.charCodeAt(s),!0===l&&(i=(a=255&i)<<8|i>>>8),c=(f=p+v)>>>2;c>=d.length;)d.push(0);d[c]|=i<<8*(h+o*(f%4)),p+=2}return{value:d,binLen:8*p+n}}(t,e,n,o,r)};case"B64":return function(t,e,n){return function(t,e,r,n){var o,i,u,s,a,c,f=0,h=e||[0],l=(r=r||0)>>>3,p=-1===n?3:0,d=t.indexOf("=");if(-1===t.search(/^[a-zA-Z0-9=+/]+$/))throw Error("Invalid character in base-64 string");if(t=t.replace(/=/g,""),-1!==d&&t.length>d)throw Error("Invalid '=' found in base-64 string");for(o=0;t.length>o;o+=4){for(s=t.substr(o,4),u=0,i=0;s.length>i;i+=1)u|=R.indexOf(s.charAt(i))<<18-6*i;for(i=0;s.length-1>i;i+=1){for(a=(c=f+l)>>>2;a>=h.length;)h.push(0);h[a]|=(u>>>16-8*i&255)<<8*(p+n*(c%4)),f+=1}}return{value:h,binLen:8*f+r}}(t,e,n,r)};case"BYTES":return function(t,e,n){return function(t,e,r,n){var o,i,u,s,a=e||[0],c=(r=r||0)>>>3,f=-1===n?3:0;for(i=0;t.length>i;i+=1)o=t.charCodeAt(i),(u=(s=i+c)>>>2)>=a.length&&a.push(0),a[u]|=o<<8*(f+n*(s%4));return{value:a,binLen:8*t.length+r}}(t,e,n,r)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}return function(t,e,n){return function(t,e,r,n){return T(new Uint8Array(t),e,r,n)}(t,e,n,r)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}return function(t,e,n){return T(t,e,n,r)};default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function F(t,e,r,n){switch(t){case"HEX":return function(t){return function(t,e,r,n){var o,i,u="",s=e/8,a=-1===r?3:0;for(o=0;s>o;o+=1)u+="0123456789abcdef".charAt((i=t[o>>>2]>>>8*(a+r*(o%4)))>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?u.toUpperCase():u}(t,e,r,n)};case"B64":return function(t){return function(t,e,r,n){var o,i,u,s="",a=e/8,c=-1===r?3:0;for(o=0;a>o;o+=3)for(u=(t[o>>>2]>>>8*(c+r*(o%4))&255)<<16|((a>o+1?t[o+1>>>2]:0)>>>8*(c+r*((o+1)%4))&255)<<8|(a>o+2?t[o+2>>>2]:0)>>>8*(c+r*((o+2)%4))&255,i=0;4>i;i+=1)s+=8*o+6*i>e?n.b64Pad:R.charAt(u>>>6*(3-i)&63);return s}(t,e,r,n)};case"BYTES":return function(t){return function(t,e,r){var n,o="",i=e/8,u=-1===r?3:0;for(n=0;i>n;n+=1)o+=String.fromCharCode(t[n>>>2]>>>8*(u+r*(n%4))&255);return o}(t,e,r)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}return function(t){return function(t,e,r){var n,o=e/8,i=new ArrayBuffer(o),u=new Uint8Array(i),s=-1===r?3:0;for(n=0;o>n;n+=1)u[n]=t[n>>>2]>>>8*(s+r*(n%4))&255;return i}(t,e,r)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}return function(t){return function(t,e,r){var n,o=e/8,i=-1===r?3:0,u=new Uint8Array(o);for(n=0;o>n;n+=1)u[n]=t[n>>>2]>>>8*(i+r*(n%4))&255;return u}(t,e,r)};default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function L(t){var e={outputUpper:!1,b64Pad:"=",outputLen:-1},r=t||{},n="Output length must be a multiple of 8";if(e.outputUpper=r.outputUpper||!1,r.b64Pad&&(e.b64Pad=r.b64Pad),r.outputLen){if(r.outputLen%8!=0)throw Error(n);e.outputLen=r.outputLen}else if(r.shakeLen){if(r.shakeLen%8!=0)throw Error(n);e.outputLen=r.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function I(t,e){return t<<e|t>>>32-e}function B(t,e,r){return t^e^r}function O(t,e,r){return t&e^t&r^e&r}function H(t,e){var r=(65535&t)+(65535&e);return(65535&(t>>>16)+(e>>>16)+(r>>>16))<<16|65535&r}function P(t,e,r,n,o){var i=(65535&t)+(65535&e)+(65535&r)+(65535&n)+(65535&o);return(65535&(t>>>16)+(e>>>16)+(r>>>16)+(n>>>16)+(o>>>16)+(i>>>16))<<16|65535&i}function S(t){return[1732584193,4023233417,2562383102,271733878,3285377520]}function j(t,e){var r,n,o,i,u,s,a,c,f=[];for(r=e[0],n=e[1],o=e[2],i=e[3],u=e[4],a=0;80>a;a+=1)f[a]=16>a?t[a]:I(f[a-3]^f[a-8]^f[a-14]^f[a-16],1),s=20>a?P(I(r,5),(c=n)&o^~c&i,u,1518500249,f[a]):40>a?P(I(r,5),B(n,o,i),u,1859775393,f[a]):60>a?P(I(r,5),O(n,o,i),u,2400959708,f[a]):P(I(r,5),B(n,o,i),u,3395469782,f[a]),u=i,i=o,o=I(n,30),n=r,r=s;return e[0]=H(r,e[0]),e[1]=H(n,e[1]),e[2]=H(o,e[2]),e[3]=H(i,e[3]),e[4]=H(u,e[4]),e}function k(t,e,r,n){for(var o,i=15+(e+65>>>9<<4),u=e+r;i>=t.length;)t.push(0);for(t[e>>>5]|=128<<24-e%32,t[i]=4294967295&u,t[i-1]=u/4294967296|0,o=0;t.length>o;o+=16)n=j(t.slice(o,o+16),n);return n}var x=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}(r,t);var e=s(r);function r(t,n,o){var u;if(i(this,r),"SHA-1"!==t)throw Error("Chosen SHA variant is not supported");var s=o||{};return(u=e.call(this,t,n,o)).L=!0,u.Y=u.N,u.v=-1,u.T=C(u.t,u.i,u.v),u.m=j,u.C=function(t){return t.slice()},u.I=S,u.H=k,u.F=[1732584193,4023233417,2562383102,271733878,3285377520],u.U=512,u.g=160,u.B=!1,s.hmacKey&&u.M(function(t,e,r,n){var o="hmacKey must include a value and format";if(!e)throw Error(o);if(void 0===e.value||!e.format)throw Error(o);return C(e.format,e.encoding||"UTF8",r)(e.value)}(0,s.hmacKey,u.v)),u}return r}(function(){function t(e,r,n){i(this,t);var o=n||{};if(this.t=r,this.i=o.encoding||"UTF8",this.numRounds=o.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw Error("numRounds must a integer >= 1");this.s=e,this.o=[],this.h=0,this.u=!1,this.l=0,this.A=!1,this.p=[],this.R=[]}var e,r,n;return e=t,(r=[{key:"update",value:function(t){var e,r=0,n=this.U>>>5,o=this.T(t,this.o,this.h),i=o.binLen,u=o.value,s=i>>>5;for(e=0;s>e;e+=n)i>=r+this.U&&(this.F=this.m(u.slice(e,e+n),this.F),r+=this.U);this.l+=r,this.o=u.slice(r>>>5),this.h=i%this.U,this.u=!0}},{key:"getHash",value:function(t,e){var r,n,o=this.g,i=L(e);if(this.B){if(-1===i.outputLen)throw Error("Output length must be specified in options");o=i.outputLen}var u=F(t,o,this.v,i);if(this.A&&this.Y)return u(this.Y(i));for(n=this.H(this.o.slice(),this.h,this.l,this.C(this.F),o),r=1;this.numRounds>r;r+=1)this.B&&o%32!=0&&(n[n.length-1]&=16777215>>>24-o%32),n=this.H(n,o,0,this.I(this.s),o);return u(n)}},{key:"setHMACKey",value:function(t,e,r){if(!this.L)throw Error("Variant does not support HMAC");if(this.u)throw Error("Cannot set MAC key after calling update");var n=C(e,(r||{}).encoding||"UTF8",this.v);this.M(n(t))}},{key:"M",value:function(t){var e,r=this.U>>>3,n=r/4-1;if(1!==this.numRounds)throw Error("Cannot set numRounds with MAC");if(this.A)throw Error("MAC key already set");for(t.binLen/8>r&&(t.value=this.H(t.value,t.binLen,0,this.I(this.s),this.g));n>=t.value.length;)t.value.push(0);for(e=0;n>=e;e+=1)this.p[e]=909522486^t.value[e],this.R[e]=1549556828^t.value[e];this.F=this.m(this.p,this.F),this.l=this.U,this.A=!0}},{key:"getHMAC",value:function(t,e){var r=L(e);return F(t,this.g,this.v,r)(this.N())}},{key:"N",value:function(){var t;if(!this.A)throw Error("Cannot call getHMAC without first setting MAC key");var e=this.H(this.o.slice(),this.h,this.l,this.C(this.F),this.g);return t=this.m(this.R,this.I(this.s)),t=this.H(e,this.g,this.U,t,this.g)}}])&&o(e.prototype,r),n&&o(e,n),t}()),Y=400;function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.baseUrl,n=void 0===r?"https://api.pwnedpasswords.com":r,o=e.userAgent,i=Object.assign({},o?{headers:{"User-Agent":o}}:{}),u="".concat(n.replace(/\/$/g,"")).concat(t);return l(u,i).then((function(t){if(t.ok)return t.text();if(t.status===Y)return t.text().then((function(t){throw Error(t)}));throw Error(t.statusText)}))}function _(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return M("/range/".concat(encodeURIComponent(t)),e).then((function(t){return t.split("\n")})).then((function(t){return t.reduce((function(t,e){var n=r(e.split(":"),2);return t[n[0]]=parseInt(n[1],10),t}),{})}))}}));
|
|
1
|
+
function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}!function(t,e){if("function"==typeof define&&define.amd)define("hibp",["exports"],e);else if("undefined"!=typeof exports)e(exports);else{var r={exports:{}};e(r.exports),t.hibp=r.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);e>r;r++)n[r]=t[r];return n}function o(t,e){for(var r=0;e.length>r;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}function s(t){var e=p();return function(){var r,n=v(t);if(e){var o=v(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function c(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t){var e="function"==typeof Map?new Map:void 0;return h=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return l(t,arguments,v(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),d(r,t)},h(t)}function l(t,e,r){return l=p()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&d(o,r.prototype),o},l.apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}function y(t){var e=t.default;if("function"==typeof e){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),r}Object.defineProperty(e,"__esModule",{value:!0}),e.RateLimitError=void 0,e.breach=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return P("/breach/".concat(encodeURIComponent(t)),e)},e.breachedAccount=j,e.breaches=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="/breaches?",r=[];t.domain&&r.push("domain=".concat(encodeURIComponent(t.domain)));return P("".concat(e).concat(r.join("&")),{baseUrl:t.baseUrl,userAgent:t.userAgent})},e.dataClasses=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return P("/dataclasses",t)},e.pasteAccount=B,e.pwnedPassword=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new z("SHA-1","TEXT");r.update(t);var n=r.getHash("HEX",{outputUpper:!0}),o=n.slice(0,5),i=n.slice(5);return Z(o,e).then((function(t){return t[i]||0}))},e.pwnedPasswordRange=Z,e.search=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{truncate:!0},r=e.apiKey,n=e.baseUrl,o=e.userAgent;return Promise.all([j(t,e),/^.+@.+$/.test(t)?B(t,{apiKey:r,baseUrl:n,userAgent:o}):null]).then((function(t){return{breaches:t[0],pastes:t[1]}}))};var b=Object.freeze({__proto__:null,default:function(t,e){return e=e||{},new Promise((function(r,n){var o=new XMLHttpRequest,i=[],u=[],a={},s=function t(){return{ok:2==(o.status/100|0),statusText:o.statusText,status:o.status,url:o.responseURL,text:function(){return Promise.resolve(o.responseText)},json:function(){return Promise.resolve(o.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([o.response]))},clone:t,headers:{keys:function(){return i},entries:function(){return u},get:function(t){return a[t.toLowerCase()]},has:function(t){return t.toLowerCase()in a}}}};for(var c in o.open(e.method||"get",t,!0),o.onload=function(){o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(t,e,r){i.push(e=e.toLowerCase()),u.push([e,r]),a[e]=a[e]?a[e]+","+r:r})),r(s())},o.onerror=n,o.withCredentials="include"==e.credentials,e.headers)o.setRequestHeader(c,e.headers[c]);o.send(e.body||null)}))}}),g=y(b),m=self.fetch||(self.fetch=g.default||g),w="hibp",A="11.1.0",U=(new Map,400),E="Bad request — the account does not comply with an acceptable format.",R=401,T=403,C="Forbidden - access denied.",F=404,L=(new Map([["retry-after","2"]]),429),O=function(t){a(r,t);var e=s(r);function r(t,n,o){var i,a,s,c;return u(this,r),i=e.call(this,n,o),a=f(i),c=void 0,(s="retryAfterSeconds")in a?Object.defineProperty(a,s,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[s]=c,i.name=i.constructor.name,i.retryAfterSeconds="string"==typeof t?Number.parseInt(t,10):void 0,i}return i(r)}(h(Error));function I(t){return"Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ".concat(t,")")}function P(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.apiKey,n=e.baseUrl,o=void 0===n?"https://haveibeenpwned.com/api/v3":n,i=e.userAgent,u={};r&&(u["HIBP-API-Key"]=r),i&&(u["User-Agent"]=i),i||"undefined"!=typeof navigator||(u["User-Agent"]="".concat(w," ").concat(A));var a={headers:u},s="".concat(o.replace(/\/$/g,"")).concat(t);return m(s,a).then((function(t){if(t.ok)return t.json();switch(t.status){case U:throw Error(E);case R:return t.json().then((function(t){throw Error(t.message)}));case T:var e=t.headers.get("cf-ray");if(e)throw Error(I(e));throw Error(C);case F:return null;case L:return t.json().then((function(e){var r=t.headers.get("retry-after");throw new O(r,e.message)}));default:throw Error(t.statusText)}}))}function j(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{includeUnverified:!0,truncate:!0},r="/breachedaccount/".concat(encodeURIComponent(t),"?"),n=[];return e.domain&&n.push("domain=".concat(encodeURIComponent(e.domain))),!1===e.includeUnverified&&n.push("includeUnverified=false"),!1===e.truncate&&n.push("truncateResponse=false"),P("".concat(r).concat(n.join("&")),{apiKey:e.apiKey,baseUrl:e.baseUrl,userAgent:e.userAgent})}function B(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return P("/pasteaccount/".concat(encodeURIComponent(t)),{apiKey:e.apiKey,baseUrl:e.baseUrl,userAgent:e.userAgent})}e.RateLimitError=O;var S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function H(t,e,r,n){var o,i,u,a=e||[0],s=(r=r||0)>>>3,c=-1===n?3:0;for(o=0;t.length>o;o+=1)(i=(u=o+s)>>>2)>=a.length&&a.push(0),a[i]|=t[o]<<8*(c+n*(u%4));return{value:a,binLen:8*t.length+r}}function x(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":return function(t,e,n){return function(t,e,r,n){var o,i,u,a;if(0!=t.length%2)throw Error("String of HEX type must be in byte increments");var s=e||[0],c=(r=r||0)>>>3,f=-1===n?3:0;for(o=0;t.length>o;o+=2){if(i=parseInt(t.substr(o,2),16),isNaN(i))throw Error("String of HEX type contains invalid characters");for(u=(a=(o>>>1)+c)>>>2;u>=s.length;)s.push(0);s[u]|=i<<8*(f+n*(a%4))}return{value:s,binLen:4*t.length+r}}(t,e,n,r)};case"TEXT":return function(t,n,o){return function(t,e,r,n,o){var i,u,a,s,c,f,h,l,p=0,d=r||[0],v=(n=n||0)>>>3;if("UTF8"===e)for(h=-1===o?3:0,a=0;t.length>a;a+=1)for(u=[],128>(i=t.charCodeAt(a))?u.push(i):2048>i?(u.push(192|i>>>6),u.push(128|63&i)):55296>i||i>=57344?u.push(224|i>>>12,128|i>>>6&63,128|63&i):(i=65536+((1023&i)<<10|1023&t.charCodeAt(a+=1)),u.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),s=0;u.length>s;s+=1){for(c=(f=p+v)>>>2;c>=d.length;)d.push(0);d[c]|=u[s]<<8*(h+o*(f%4)),p+=1}else for(h=-1===o?2:0,l="UTF16LE"===e&&1!==o||"UTF16LE"!==e&&1===o,a=0;t.length>a;a+=1){for(i=t.charCodeAt(a),!0===l&&(i=(s=255&i)<<8|i>>>8),c=(f=p+v)>>>2;c>=d.length;)d.push(0);d[c]|=i<<8*(h+o*(f%4)),p+=2}return{value:d,binLen:8*p+n}}(t,e,n,o,r)};case"B64":return function(t,e,n){return function(t,e,r,n){var o,i,u,a,s,c,f=0,h=e||[0],l=(r=r||0)>>>3,p=-1===n?3:0,d=t.indexOf("=");if(-1===t.search(/^[a-zA-Z0-9=+/]+$/))throw Error("Invalid character in base-64 string");if(t=t.replace(/=/g,""),-1!==d&&t.length>d)throw Error("Invalid '=' found in base-64 string");for(o=0;t.length>o;o+=4){for(a=t.substr(o,4),u=0,i=0;a.length>i;i+=1)u|=S.indexOf(a.charAt(i))<<18-6*i;for(i=0;a.length-1>i;i+=1){for(s=(c=f+l)>>>2;s>=h.length;)h.push(0);h[s]|=(u>>>16-8*i&255)<<8*(p+n*(c%4)),f+=1}}return{value:h,binLen:8*f+r}}(t,e,n,r)};case"BYTES":return function(t,e,n){return function(t,e,r,n){var o,i,u,a,s=e||[0],c=(r=r||0)>>>3,f=-1===n?3:0;for(i=0;t.length>i;i+=1)o=t.charCodeAt(i),(u=(a=i+c)>>>2)>=s.length&&s.push(0),s[u]|=o<<8*(f+n*(a%4));return{value:s,binLen:8*t.length+r}}(t,e,n,r)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}return function(t,e,n){return function(t,e,r,n){return H(new Uint8Array(t),e,r,n)}(t,e,n,r)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}return function(t,e,n){return H(t,e,n,r)};default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function k(t,e,r,n){switch(t){case"HEX":return function(t){return function(t,e,r,n){var o,i,u="",a=e/8,s=-1===r?3:0;for(o=0;a>o;o+=1)u+="0123456789abcdef".charAt((i=t[o>>>2]>>>8*(s+r*(o%4)))>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?u.toUpperCase():u}(t,e,r,n)};case"B64":return function(t){return function(t,e,r,n){var o,i,u,a="",s=e/8,c=-1===r?3:0;for(o=0;s>o;o+=3)for(u=(t[o>>>2]>>>8*(c+r*(o%4))&255)<<16|((s>o+1?t[o+1>>>2]:0)>>>8*(c+r*((o+1)%4))&255)<<8|(s>o+2?t[o+2>>>2]:0)>>>8*(c+r*((o+2)%4))&255,i=0;4>i;i+=1)a+=8*o+6*i>e?n.b64Pad:S.charAt(u>>>6*(3-i)&63);return a}(t,e,r,n)};case"BYTES":return function(t){return function(t,e,r){var n,o="",i=e/8,u=-1===r?3:0;for(n=0;i>n;n+=1)o+=String.fromCharCode(t[n>>>2]>>>8*(u+r*(n%4))&255);return o}(t,e,r)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}return function(t){return function(t,e,r){var n,o=e/8,i=new ArrayBuffer(o),u=new Uint8Array(i),a=-1===r?3:0;for(n=0;o>n;n+=1)u[n]=t[n>>>2]>>>8*(a+r*(n%4))&255;return i}(t,e,r)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}return function(t){return function(t,e,r){var n,o=e/8,i=-1===r?3:0,u=new Uint8Array(o);for(n=0;o>n;n+=1)u[n]=t[n>>>2]>>>8*(i+r*(n%4))&255;return u}(t,e,r)};default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function M(t){var e={outputUpper:!1,b64Pad:"=",outputLen:-1},r=t||{},n="Output length must be a multiple of 8";if(e.outputUpper=r.outputUpper||!1,r.b64Pad&&(e.b64Pad=r.b64Pad),r.outputLen){if(r.outputLen%8!=0)throw Error(n);e.outputLen=r.outputLen}else if(r.shakeLen){if(r.shakeLen%8!=0)throw Error(n);e.outputLen=r.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function Y(t,e){return t<<e|t>>>32-e}function N(t,e,r){return t^e^r}function _(t,e,r){return t&e^t&r^e&r}function K(t,e){var r=(65535&t)+(65535&e);return(65535&(t>>>16)+(e>>>16)+(r>>>16))<<16|65535&r}function X(t,e,r,n,o){var i=(65535&t)+(65535&e)+(65535&r)+(65535&n)+(65535&o);return(65535&(t>>>16)+(e>>>16)+(r>>>16)+(n>>>16)+(o>>>16)+(i>>>16))<<16|65535&i}function $(t){return[1732584193,4023233417,2562383102,271733878,3285377520]}function q(t,e){var r,n,o,i,u,a,s,c,f=[];for(r=e[0],n=e[1],o=e[2],i=e[3],u=e[4],s=0;80>s;s+=1)f[s]=16>s?t[s]:Y(f[s-3]^f[s-8]^f[s-14]^f[s-16],1),a=20>s?X(Y(r,5),(c=n)&o^~c&i,u,1518500249,f[s]):40>s?X(Y(r,5),N(n,o,i),u,1859775393,f[s]):60>s?X(Y(r,5),_(n,o,i),u,2400959708,f[s]):X(Y(r,5),N(n,o,i),u,3395469782,f[s]),u=i,i=o,o=Y(n,30),n=r,r=a;return e[0]=K(r,e[0]),e[1]=K(n,e[1]),e[2]=K(o,e[2]),e[3]=K(i,e[3]),e[4]=K(u,e[4]),e}function D(t,e,r,n){for(var o,i=15+(e+65>>>9<<4),u=e+r;i>=t.length;)t.push(0);for(t[e>>>5]|=128<<24-e%32,t[i]=4294967295&u,t[i-1]=u/4294967296|0,o=0;t.length>o;o+=16)n=q(t.slice(o,o+16),n);return n}var z=function(t){a(r,t);var e=s(r);function r(t,n,o){var i;if(u(this,r),"SHA-1"!==t)throw Error("Chosen SHA variant is not supported");var a=o||{};return(i=e.call(this,t,n,o)).L=!0,i.Y=i.N,i.v=-1,i.T=x(i.t,i.i,i.v),i.m=q,i.C=function(t){return t.slice()},i.I=$,i.H=D,i.F=[1732584193,4023233417,2562383102,271733878,3285377520],i.U=512,i.g=160,i.B=!1,a.hmacKey&&i.M(function(t,e,r,n){var o="hmacKey must include a value and format";if(!e)throw Error(o);if(void 0===e.value||!e.format)throw Error(o);return x(e.format,e.encoding||"UTF8",r)(e.value)}(0,a.hmacKey,i.v)),i}return i(r)}(function(){function t(e,r,n){u(this,t);var o=n||{};if(this.t=r,this.i=o.encoding||"UTF8",this.numRounds=o.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw Error("numRounds must a integer >= 1");this.s=e,this.o=[],this.h=0,this.u=!1,this.l=0,this.A=!1,this.p=[],this.R=[]}return i(t,[{key:"update",value:function(t){var e,r=0,n=this.U>>>5,o=this.T(t,this.o,this.h),i=o.binLen,u=o.value,a=i>>>5;for(e=0;a>e;e+=n)i>=r+this.U&&(this.F=this.m(u.slice(e,e+n),this.F),r+=this.U);this.l+=r,this.o=u.slice(r>>>5),this.h=i%this.U,this.u=!0}},{key:"getHash",value:function(t,e){var r,n,o=this.g,i=M(e);if(this.B){if(-1===i.outputLen)throw Error("Output length must be specified in options");o=i.outputLen}var u=k(t,o,this.v,i);if(this.A&&this.Y)return u(this.Y(i));for(n=this.H(this.o.slice(),this.h,this.l,this.C(this.F),o),r=1;this.numRounds>r;r+=1)this.B&&o%32!=0&&(n[n.length-1]&=16777215>>>24-o%32),n=this.H(n,o,0,this.I(this.s),o);return u(n)}},{key:"setHMACKey",value:function(t,e,r){if(!this.L)throw Error("Variant does not support HMAC");if(this.u)throw Error("Cannot set MAC key after calling update");var n=x(e,(r||{}).encoding||"UTF8",this.v);this.M(n(t))}},{key:"M",value:function(t){var e,r=this.U>>>3,n=r/4-1;if(1!==this.numRounds)throw Error("Cannot set numRounds with MAC");if(this.A)throw Error("MAC key already set");for(t.binLen/8>r&&(t.value=this.H(t.value,t.binLen,0,this.I(this.s),this.g));n>=t.value.length;)t.value.push(0);for(e=0;n>=e;e+=1)this.p[e]=909522486^t.value[e],this.R[e]=1549556828^t.value[e];this.F=this.m(this.p,this.F),this.l=this.U,this.A=!0}},{key:"getHMAC",value:function(t,e){var r=M(e);return k(t,this.g,this.v,r)(this.N())}},{key:"N",value:function(){var t;if(!this.A)throw Error("Cannot call getHMAC without first setting MAC key");var e=this.H(this.o.slice(),this.h,this.l,this.C(this.F),this.g);return t=this.m(this.R,this.I(this.s)),t=this.H(e,this.g,this.U,t,this.g)}}]),t}()),J=400;function V(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.baseUrl,n=void 0===r?"https://api.pwnedpasswords.com":r,o=e.userAgent,i=Object.assign({},o?{headers:{"User-Agent":o}}:{}),u="".concat(n.replace(/\/$/g,"")).concat(t);return m(u,i).then((function(t){if(t.ok)return t.text();if(t.status===J)return t.text().then((function(t){throw Error(t)}));throw Error(t.statusText)}))}function Z(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return V("/range/".concat(encodeURIComponent(t)),e).then((function(t){return t.split("\n").filter(Boolean)})).then((function(t){return t.reduce((function(t,e){var n=r(e.split(":"),2);return t[n[0]]=parseInt(n[1],10),t}),{})}))}}));
|
|
2
2
|
//# sourceMappingURL=hibp.umd.js.map
|