var suggestions=document.getElementById("suggestions"),userinput=document.getElementById("userinput");document.addEventListener("keydown",inputFocus);function inputFocus(e){e.keyCode===191&&(e.preventDefault(),userinput.focus()),e.keyCode===27&&(userinput.blur(),suggestions.classList.add("d-none"))}document.addEventListener("click",function(e){var t=suggestions.contains(e.target);t||suggestions.classList.add("d-none")}),document.addEventListener("keydown",suggestionFocus);function suggestionFocus(e){const s=suggestions.querySelectorAll("a"),o=[...s],t=o.indexOf(document.activeElement);let n=0;e.keyCode===38?(e.preventDefault(),n=t>0?t-1:0,s[n].focus()):e.keyCode===40&&(e.preventDefault(),n=t+1<o.length?t+1:t,s[n].focus())}(function(){var e=new FlexSearch({preset:"score",cache:!0,doc:{id:"id",field:["title","description","content"],store:["href","title","description"]}}),n=[{id:0,href:"/docs/webmasters/installing-captcha/",title:"Installing mCaptcha on your website",description:"Interested in deploying mCpatcha? From deploying a self-hosted instance to installing the CAPTCHA on your website, this guide will have you covered!",content:`<p>mCaptcha can protect your website from DDoS attacks. In this guide we&rsquo;ll
explore how to install mCaptcha on your website. The end result will be
something like this, on your website:</p>
<figure>
  <img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_20x0_resize_box_3.png" data-srcset="/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_500x0_resize_box_3.png 500w" width="618" height="669" alt="A registration form with mCaptcha widget installed">
  <noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_500x0_resize_box_3.png 500w" src="/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result.png" width="618" height="669" alt="A registration form with mCaptcha widget installed"></noscript>
</figure>
<p>For the purpose of this demo, we will be using
<a href="https://demo.mcaptcha.org">demo.mcaptcha.org</a>, a demo instance running
in @realaravinth&rsquo;s bedroom(for this same reason, it shouldn&rsquo;t be used
for anything serious)</p>
<h2 id="1-create-an-account-and-sign-into-the-mcaptcha-dashboard">1. Create an account and sign into the mCaptcha dashboard</h2>
<p>Head over to <a href="https://demo.mcaptcha.org/join">demo.mcaptcha.org</a> and
create an account. When ready, sign in.</p>
<h2 id="2-create-new-site-key">2. Create new site key</h2>
<p>A <a href="/docs/terminology/sitekey/">site key</a> is how a new CAPTCHA is configured within mCaptcha. To create
a new site key, click on &ldquo;New Site&rdquo; button in the dashboard.</p>
<figure>
  <img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_20x0_resize_box_3.png" data-srcset="/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_900x0_resize_box_3.png 900w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_500x0_resize_box_3.png 500w" width="1825" height="857" alt="mCaptcha dashboard with the &#39;new site key&#39; button highlighted">
  <noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_900x0_resize_box_3.png 900w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_500x0_resize_box_3.png 500w" src="/docs/webmasters/installing-captcha/new-sitekey-btn.png" width="1825" height="857" alt="mCaptcha dashboard with the &#39;new site key&#39; button highlighted"></noscript>
</figure>
<p>There are two options to create a new site key, easy and advanced. <strong>We
are going to use the <a href="/docs/webmasters/configuring-difficulty-factor#easy-option">easy mode</a> in this tutorial.</strong> If you are interested
in learning more about the advance mode, please see <a href="/docs/introduction/configuring-difficulty-factor/#advance-option">here</a>.</p>
<p>Fill the form and submit it.</p>
<figure>
  <img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_20x0_resize_box_3.png" data-srcset="/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_900x0_resize_box_3.png 900w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_500x0_resize_box_3.png 500w" width="720" height="452" alt="mCaptcha dashboard with the &#39;new site key&#39; form in easy mode, with details filled in">
  <noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_900x0_resize_box_3.png 900w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_500x0_resize_box_3.png 500w" src="/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled.png" width="720" height="452" alt="mCaptcha dashboard with the &#39;new site key&#39; form in easy mode, with details filled in"></noscript>
</figure>
<h2 id="3-copy-widget-link">3. Copy widget link</h2>
<p>Submitting the form will take you to a page where site key configuration
can be viewed. &ldquo;View deployment&rdquo; link will display CAPTCHA widget with
the supplied configuration. Click on it and grab the widget link.</p>
<h2 id="4-install-mcaptcha-on-your-website">4. Install mCaptcha on your website</h2>
<p>Integration support is available for some frontend JavaScript
frameworks. To see full list of supported frameworks, please see
<a href="https://github.com/mCaptcha/glue#framework-support">here</a>.</p>
<p>There are two options to use the integration library to integrate
mCaptcha on your website:</p>
<ol>
<li>Serve the integration library yourself</li>
<li>Use a CDN like unpkg.com</li>
</ol>
<p>In this tutorial, we&rsquo;ll be using the CDN.</p>
<p><strong>Pasting the following snippet on the page, within the form</strong> that requires to be protected
will load the mCaptcha widget with the configuration supplied. Be sure
to replace <code>Your {{paste your widget link}}</code> with the link obtained from
the previous step.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-html" data-lang="html"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1</span><span>&lt;<span style="color:#ff79c6">label</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2</span><span>  <span style="color:#50fa7b">data-mcaptcha_url</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;{{paste your widget link here}}&#34;</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3</span><span>  <span style="color:#50fa7b">for</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;mcaptcha__token&#34;</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4</span><span>  <span style="color:#50fa7b">id</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;mcaptcha__token-label&#34;</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5</span><span>&gt;
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6</span><span>  mCaptcha authorization token.
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7</span><span>  &lt;<span style="color:#ff79c6">a</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8</span><span>    <span style="color:#50fa7b">href</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;https://mcaptcha.org/docs/user-manual/how-to-mcaptcha-without-js/&#34;</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9</span><span>    &gt;Instructions&lt;/<span style="color:#ff79c6">a</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10</span><span>  &gt;.
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11</span><span>  &lt;<span style="color:#ff79c6">input</span> <span style="color:#50fa7b">type</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;text&#34;</span> <span style="color:#50fa7b">name</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;mcaptcha__token&#34;</span> <span style="color:#50fa7b">id</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;mcaptcha__token&#34;</span> /&gt;
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12</span><span>&lt;/<span style="color:#ff79c6">label</span>&gt;
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13</span><span>&lt;<span style="color:#ff79c6">div</span> <span style="color:#50fa7b">id</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;mcaptcha__widget-container&#34;</span>&gt;&lt;/<span style="color:#ff79c6">div</span>&gt;
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14</span><span>&lt;<span style="color:#ff79c6">script</span> <span style="color:#50fa7b">src</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;https://unpkg.com/@mcaptcha/vanilla-glue@0.1.0-rc2/dist/index.js&#34;</span>&gt;&lt;/<span style="color:#ff79c6">script</span>&gt;
</span></span></code></pre></div><p>A full example is available
<a href="https://github.com/mCaptcha/glue/blob/ea576d875457de54d82bed3edfc4ee68302fa4d8/packages/vanilla/static/embeded.html">here</a>.</p>
<h2 id="5-configure-backend-to-authenticate-captcha-tokens">5. Configure backend to authenticate CAPTCHA tokens</h2>
<ol>
<li>
<p>Get <a href="/docs/terminology/access-token">access token</a> from the user&rsquo;s
form submission payload. The access token will be associated with a
parameter called <code>mcaptcha__token</code>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span> mcaptcha_token <span style="color:#ff79c6">=</span> request<span style="color:#ff79c6">.</span>form[<span style="color:#f1fa8c">&#34;mcaptcha__token&#34;</span>]
</span></span></code></pre></div></li>
<li>
<p>Validate access token with mCaptcha instance</p>
</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1</span><span>payload <span style="color:#ff79c6">=</span> {
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2</span><span>    <span style="color:#f1fa8c">&#34;token&#34;</span>: mcaptcha_token,
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3</span><span>    <span style="color:#f1fa8c">&#34;key&#34;</span>: mcaptcha_sitekey, <span style="color:#6272a4"># captcha site key</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4</span><span>    <span style="color:#6272a4"># mCaptcha account secret; available in settings</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5</span><span>    <span style="color:#f1fa8c">&#34;secret&#34;</span>: mcaptcha_account_secret,
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6</span><span>}
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7</span><span>resp <span style="color:#ff79c6">=</span> requests<span style="color:#ff79c6">.</span>post(
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8</span><span>    <span style="color:#f1fa8c">&#34;https://demo.mcaptha.org/api/v1/pow/siteverify&#34;</span>, json<span style="color:#ff79c6">=</span>payload
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9</span><span>)
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10</span><span>resp <span style="color:#ff79c6">=</span> resp<span style="color:#ff79c6">.</span>json()
</span></span></code></pre></div><ol start="3">
<li>If access token is valid, allow access to protected resource or deny
access.</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span> <span style="color:#ff79c6">if</span> resp[<span style="color:#f1fa8c">&#34;valid&#34;</span>] <span style="color:#ff79c6">==</span> <span style="color:#ff79c6">False</span>:
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>     <span style="color:#ff79c6">return</span> <span style="color:#f1fa8c">&#34;invalid captcha&#34;</span>, <span style="color:#bd93f9">400</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span> <span style="color:#ff79c6">else</span>:
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4</span><span>     <span style="color:#ff79c6">return</span> allow_access_to_protected_resource(request<span style="color:#ff79c6">.</span>form)
</span></span></code></pre></div><p>Please see here for a complete <a href="https://github.com/mCaptcha/dos/tree/8f2b53ab46d64fa78a8300dc8ce9d78578ffce12/server">Flask example</a> and here for an <a href="https://github.com/mCaptcha/dos/tree/8f2b53ab46d64fa78a8300dc8ce9d78578ffce12/rust-server/demo-server">Actix
Web example</a>.</p>
<p>Congratulations, mCaptcha is now integrated with your website!</p>
`},{id:1,href:"/docs/webmasters/configuring-difficulty-factor/",title:"Configuring Difficulty Factor",description:"mCaptcha has options to configure its proof of work engine behavior, this page explains how to determine difficulty facotrs that work best for your website!",content:`<p>mCaptcha is highly responsive to detecting DDoS attacks. Admins are
advised to take advantage of it by setting low <a href="/docs/terminology/difficulty-factor/">difficulty
factors</a> for normal traffic levels
for their website.</p>
<p><strong>Lowest advisable difficulty factor is 5000.</strong></p>
<p>For instance, if it is normal for my website to get 2000 requests for
every 30 seconds, I will set a <a href="/docs/terminology/cooldown-period">cool
down</a> period of 30 seconds and the
first level of difficulty configuration will have a <a href="/docs/terminology/visitor-threshold">visitor threshold</a> of 2000 with a
difficulty factor of 5000.</p>
<p>There are two modes to setting difficulty factor for your website on
mCaptcha:</p>
<h3 id="easy-option">Easy option</h3>
<p>Easy mode asks a few basic statistics about your website and generates a
configuration that should work for your website. Currently, easy mode is
guided by assumptions on suitable difficulty factors to protect a
website but it will be fine-tuned as mCaptcha sees more deployment.</p>
<p>Configuration generated by easy mode can be tweaked later using the
advance mode, as you become more familiar with how mCaptcha works.</p>
<figure>
  <img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_20x0_resize_box_3.png" data-srcset="/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_900x0_resize_box_3.png 900w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_800x0_resize_box_3.png 800w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_700x0_resize_box_3.png 700w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_600x0_resize_box_3.png 600w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_500x0_resize_box_3.png 500w" width="720" height="452" alt="new sitekey form in easy mode">
  <noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_900x0_resize_box_3.png 900w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_800x0_resize_box_3.png 800w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_700x0_resize_box_3.png 700w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_600x0_resize_box_3.png 600w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_500x0_resize_box_3.png 500w" src="/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode.png" width="720" height="452" alt="new sitekey form in easy mode"></noscript>
</figure>
<h3 id="advance-option">Advance option</h3>
<p>Advance mode gives the admin granular control over how mCaptcha behaves
on their website. It has options to set the difficulty factor for each
level of traffic(or visitor threshold, in mCaptcha speak), fully taking
advantage of mCaptcha&rsquo;s variable difficulty factor feature.</p>
<p>For instance, if it is normal for a website to get 200 requests over 30
seconds, then setting a very low difficulty factor for a visitor
threshold of 200 and a cool down period of 30 seconds will allow the
users to pass through without waiting on the CAPTCHA. But if 1000
requests over 30 seconds will bring down the service, then the admin can
configure increasing levels of difficulty factor of increasing traffic
levels, effectively rate limiting its users and protecting the
underlying website.</p>
<figure>
  <img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_20x0_resize_box_3.png" data-srcset="/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_900x0_resize_box_3.png 900w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_800x0_resize_box_3.png 800w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_700x0_resize_box_3.png 700w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_600x0_resize_box_3.png 600w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_500x0_resize_box_3.png 500w" width="720" height="407" alt="new sitekey form in advance mode">
  <noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_900x0_resize_box_3.png 900w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_800x0_resize_box_3.png 800w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_700x0_resize_box_3.png 700w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_600x0_resize_box_3.png 600w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_500x0_resize_box_3.png 500w" src="/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode.png" width="720" height="407" alt="new sitekey form in advance mode"></noscript>
</figure>
`},{id:2,href:"/docs/self-hosting/getting-started/",title:"Getting started",description:"Get started with self-hosting mCaptcha",content:`<h2 id="get-started">Get started</h2>
<p>There are two main ways to self-host mCaptcha:</p>
<ol>
<li><a href="../bare-metal">Bare metal</a></li>
<li><a href="../docker">With Docker</a></li>
<li><a href="../ansible">With Ansible</a></li>
</ol>
`},{id:3,href:"/docs/self-hosting/bare-metal/",title:"Deploy bare metal",description:"Bare metal deployment is tedious, most of this will be automated with a script in the future.",content:`<h2 id="1-install-database">1. Install Database</h2>
<p>The following databases are supported:</p>
<ol>
<li>Postgres</li>
<li>MariaDB</li>
</ol>
<p>Please install the database of your choice. Then:</p>
<ol>
<li>Create new database user for mCaptcha</li>
<li>Create new database for mCaptcha</li>
</ol>
<p>mCaptcha binary has migrations baked-in and is applied on start up. The
choice of database is described using the <a href="https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/What_is_a_URL#scheme">scheme</a> of the database URL. For
instance:</p>
<ol>
<li>Postgres: <code>postgres://mcaptcha:password@localhost:5432/mcaptcha</code></li>
<li>Mariadb: <code>mysql://mcaptcha:password@localhost:3306/mcaptcha</code></li>
</ol>
<h2 id="2-optionally-install-mcaptchacache">2. Optionally, install mCaptcha/cache</h2>
<p>We recommend this for larger instances. For single-user instances or for
instances that protect personal websites, we recommend using the
internal cache system. To do so, please comment out the
<a href="https://github.com/mCaptcha/mCaptcha/blob/d4967626ee59504b32b0f85e409b4e3444ddc4f0/config/default.toml#L54"><code>redis</code></a> section of the configuration file.</p>
<p>Please see <a href="https://github.com/mCaptcha/cache"><code>mCaptcha/cache</code></a> for more details.</p>
<h2 id="3-install-mcaptcha">3. Install mCaptcha</h2>
<h3 id="31-install-from-source">3.1 Install from source</h3>
<p>To build <code>mcaptcha</code>, you need the following dependencies:</p>
<ol>
<li>rust</li>
<li>node(<code>v20</code>)</li>
<li>yarn(JavaScript package manager)</li>
<li>make</li>
</ol>
<p>With all dependencies installed, run:</p>
<pre tabindex="0"><code>make dev-env &amp;&amp; make release
</code></pre><p>And the following commands to install the compiled binary:</p>
<pre tabindex="0"><code>sudo cp ./target/release/mcaptcha /usr/bin/ &amp;&amp; \\
	mkdir sudo /etc/mcaptcha &amp;&amp; \\
	sudo cp config/default.toml /etc/mcaptcha/config.toml
</code></pre><h3 id="32-install-pre-compiled-binary">3.2 Install pre-compiled binary</h3>
<h4 id="i-download-assets">i. Download assets</h4>
<pre tabindex="0"><code>wget https://dl.mcaptcha.org/mcaptcha/mCaptcha/master/mcaptcha-master-linux-amd64.tar.gz.asc
wget https://dl.mcaptcha.org/mcaptcha/mCaptcha/master/mcaptcha-master-linux-amd64.tar.gz.sha256
wget https://dl.mcaptcha.org/mcaptcha/mCaptcha/master/mcaptcha-master-linux-amd64.tar.gz
</code></pre><h3 id="ii-verify-checksum">ii Verify checksum</h3>
<pre tabindex="0"><code>sha256sum -c mcaptcha-master-linux-amd64.tar.gz.sha256
</code></pre><h3 id="iii-verify-gpg-signature">iii Verify GPG signature</h3>
<p>All mcaptcha binaries are signed with <a href="https://keyserver.ubuntu.com/pks/lookup?search=73DAC973A9ADBB9ADCB5CDC4595A08135BA9FF73&amp;fingerprint=on&amp;op=index">our GPG
key</a>.
Please verify signatures to verify authenticity.</p>
<pre tabindex="0"><code>gpg --keyserver keyserver.ubuntu.com --recv 73DAC973A9ADBB9ADCB5CDC4595A08135BA9FF73
gpg --verify mcaptcha-master-linux-amd64.tar.gz.asc
</code></pre><h3 id="iv-install">iv. Install</h3>
<pre tabindex="0"><code>tar -xvzf mcaptcha-master-linux-amd64.tar.gz \\
  &amp;&amp; sudo cp mcaptcha-master-linux-amd64/mcaptcha /usr/local/bin \\
  &amp;&amp; sudo mkdir /etc/mcaptcha \\
  &amp;&amp; sudo cp mcaptcha-master-linux-amd64/config.toml /etc/mcaptcha/
</code></pre><h3 id="4-configuration">4. Configuration</h3>
<p>mCaptcha is highly configurable.</p>
<p>Configuration is applied/merged in the following order:</p>
<ol>
<li>path to configuration file passed in via <code>MCAPTCHA_CONFIG</code></li>
<li><code>./config/default.toml</code></li>
<li><code>/etc/mcaptcha/config.toml</code></li>
<li>environment variables. Please see
<a href="https://github.com/mCaptcha/mCaptcha/blob/master/docs/CONFIGURATION.md">here</a> for a full list of environment variables.</li>
</ol>
<h3 id="5-systemd-service-configuration">5. Systemd service configuration:</h3>
<ol>
<li>Copy the following to <code>/etc/systemd/system/mcaptcha.service</code>:</li>
</ol>
<pre tabindex="0"><code>[Unit]
Description=mCaptcha: a CAPTCHA system that gives attackers a run for their money

[Service]
Type=simple
User=mcaptcha
ExecStart=/usr/bin/mcaptcha
Restart=on-failure
RestartSec=1
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true
Environment=&#34;RUST_LOG=info&#34;

[Unit]
After=sound.target
Wants=network-online.target
Wants=network-online.target
Requires=postgresql.service
After=syslog.target

[Install]
WantedBy=multi-user.target
</code></pre><ol start="2">
<li>Enable service:</li>
</ol>
<pre tabindex="0"><code>sudo systemctl daemon-reload &amp;&amp; \\
	sudo systemctl enable mcaptcha &amp;&amp; \\ # Auto startup during boot
	sudo systemctl start mcaptcha
</code></pre><h3 id="6-install-and-configure-nginx">6. Install and configure Nginx</h3>
<p>mCaptcha doesn&rsquo;t implement SSL yet. Please use a reverse proxy like
Nginx to add SSL to your deployment. Here&rsquo;s an example virtual host
configuration for Nginx:</p>
<pre tabindex="0"><code>server {
  server_name &lt;your mcaptcha hostname&gt;;
	listen 80;
	listen [::]:80;

	location / {
		proxy_pass http://127.0.0.1:&lt;mcaptcha_port&gt;;
		proxy_set_header Host $host;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection &#34;upgrade&#34;;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
	}

}
</code></pre>`},{id:4,href:"/docs/self-hosting/ansible/",title:"Using Ansible",description:"Deploy mCaptcha software using Ansible playbooks",content:`<p>Ansible playbooks to install mCaptcha are available <a href="https://git.batsense.net/mCaptcha/iac">here</a>.</p>
<h2 id="instructions">Instructions</h2>
<h3 id="installation">Installation</h3>
<ol>
<li>Clone the repository:</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>git clone https://git.batsense.net/mCaptcha/iac <span style="color:#ff79c6">&amp;&amp;</span> <span style="color:#8be9fd;font-style:italic">cd</span> iac
</span></span></code></pre></div><ol start="2">
<li>
<p>Create inventory file. You should have SSH access to the remote
machine, and the user must have <code>sudo</code> privileges. Example inventory
file:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-ini" data-lang="ini"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span><span style="color:#ff79c6">[mcaptcha_hosts]</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span><span style="color:#50fa7b">&#34;mcaptcha_hosts&#34;</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span><span style="color:#50fa7b">&lt;node name&gt; ansible_host</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&lt;node IP&gt; ansible_user=&lt;remote username&gt;</span>
</span></span></code></pre></div><p>It is important that the group name be <code>mcaptcha_hosts</code>.</p>
</li>
<li>
<p>Configure installation by editing <a href="https://git.batsense.net/mCaptcha/iac/src/branch/master/ansible/vars/mcaptcha/vars.yml">ansible/vars/mcaptcha/vars.yml</a>. Most parameters have defaults, and the required parameters are annotated.</p>
</li>
<li>
<p>Run playbook:</p>
</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>	ansible-playbook -i path/to/inventory-file -f <span style="color:#bd93f9">10</span> ./ansible/mcaptcha.yml
</span></span></code></pre></div><h3 id="update">Update</h3>
<ol>
<li>Pull changes from Git repository</li>
<li>Rerun playbook</li>
</ol>
`},{id:5,href:"/docs/self-hosting/docker/",title:"Using Docker",description:"Deploy mCaptcha using docker",content:`<h2 id="with-docker">With Docker</h2>
<h3 id="1-configure">1. Configure</h3>
<p>mcaptcha is highly configurable.</p>
<p>Configuration is applied/merged in the following order:</p>
<ol>
<li>path to configuration file passed in via <code>MCAPTCHA_CONFIG</code></li>
<li><code>./config/default.toml</code></li>
<li><code>/etc/mcaptcha/config.toml</code></li>
<li>environment variables.</li>
</ol>
<p>See
<a href="https://github.com/mCaptcha/mCaptcha/tree/master/docs/CONFIGURATION.md">CONFIGURATION.md</a>
for configurable options.</p>
<h3 id="2-run-image">2. Run image</h3>
<p>If you have already have a Postgres instance running, then:</p>
<pre tabindex="0"><code>docker run -p &lt;host-machine-port&gt;:&lt;port-in-configuration-file&gt; \\
	--add-host=database:&lt;database-ip-addrss&gt; \\
	-e RUST_LOG=debug \\
	-e DATABASE_URL=&#34;postgres://&lt;db-user&gt;:&lt;db-password&gt;@database:&lt;db-port&gt;/&lt;db-name&gt;&#34; \\
	mcaptcha/mcaptcha:latest
</code></pre><p>If you don&rsquo;t have a Postgres instance running, you can either install
one using a package manager or launch one with docker.</p>
<h2 id="with-docker-compose">With docker-compose</h2>
<ol>
<li>Download docker-compose file and the configuration file:</li>
</ol>
<pre tabindex="0"><code>wget https://raw.githubusercontent.com/mCaptcha/mCaptcha/master/.env.docker-compose
wget https://raw.githubusercontent.com/mCaptcha/mCaptcha/master/docker-compose.yml
</code></pre><ol start="2">
<li>
<p>Configure deployment using <code>.env.docker-compose</code> environment variable
file</p>
</li>
<li>
<p>Launch containers:</p>
</li>
</ol>
<pre tabindex="0"><code>docker-compose up -d
</code></pre><ol start="4">
<li>Configure SSL using reverse proxy: mCaptcha doesn&rsquo;t support SSL at
the moment, so please use a reverse proxy to secure your instance. A
reference nginx virtual host configuration file is available <a href="../bare-metal/#6-install-and-configure-nginx">here</a>.</li>
</ol>
`},{id:6,href:"/docs/help/troubleshooting/",title:"Troubleshooting",description:"Solutions to common problems.",content:`<h2 id="q-i-just-setup-an-instance-but-i-am-unable-to-login">Q: I just setup an instance but I am unable to login</h2>
<p>mCaptcha by default is configured to server at <code>localhost</code> hostname. If
the instance is deployed at another hostname, please try setting
<code>MCAPTCHA_SERVER_DOMAIN</code> environment variable to the hostname at which
your instance is deployed or setting the equivalent in config.toml:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>[server]
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>domain=mydomain
</span></span></code></pre></div>`},{id:7,href:"/docs/api/browser/",title:"Browser libraries",description:"API documenttion for mCaptcha WASM library",content:`<p>The browser part of mCaptcha is divided into three components.</p>
<ul>
<li>Glue code</li>
<li>Widget program</li>
<li>Proof-of-Work libraries(WebAssembly and JavaScript polyfill)</li>
</ul>
<h2 id="glue-code">Glue code</h2>
<p>This is the code that links mCaptcha with your website&rsquo;s frontend code.
It creates an <code>iframe</code> containing the mCaptcha widget and injects the
received verification proof token into a hidden input field.</p>
<p>Support is available for various frameworks, see
<a href="https://github.com/mCaptcha/glue"><code>mCaptcha/glue</code></a> for the full list.</p>
<p>For frameworks without official support, a low-level library,
<a href="https://www.npmjs.com/package/@mcaptcha/core-glue"><code>@mcaptcha/core-glue</code></a>,
can be used to implement support.</p>
<h2 id="widget-program">Widget Program</h2>
<p>This part is served by the mCaptcha backend. It fetches PoW config from
the backend, generates proof and submits it for verification. If
verification is successful, it sends a message containing the
verification proof token to the parent window, assuming it&rsquo;s loaded as
an <code>iframe</code>.</p>
<ul>
<li>Source code:
<a href="https://github.com/mCaptcha/mCaptcha/tree/master/templates/widget"><code>mCaptcha/mCaptcha/templates/widget</code></a></li>
</ul>
<p>WebAssembly library which generates Proofs of Work for mCaptcha systems.</p>
<h2 id="proof-of-workpow-library">Proof-of-Work(PoW) library</h2>
<p>WebAssembly bindings(<a href="https://github.com/mCaptcha/pow_wasm"><code>mCaptcha/pow_wasm</code></a>) are available for the main rust library(<a href="https://github.com/mCaptcha/pow_sha256"><code>mCaptcha/pow_sha256</code></a>).</p>
<p>For browsers without support WebAssembly, a
polyfill(<a href="https://github.com/mCaptcha/pow_sha256-polyfill"><code>pow_sha256-polyfill</code></a>)
is available.</p>
`},{id:8,href:"/docs/api/mcaptcha-system/",title:"mCaptcha System Library",description:"API documenttion for the core Library used in mCaptcha",content:`<p>Documentation for the library used in mCaptcha core.</p>
<h2 id="versions">Versions</h2>
<ul>
<li><a href="https://mcaptcha.github.io/mCaptcha/m_captcha/index.html">master-branch</a></li>
<li><a href="/api-docs/m_captcha/0.1.3/m_captcha/index.html">0.1.3</a></li>
<li><a href="/api-docs/m_captcha/0.1.2/m_captcha/index.html">0.1.2</a></li>
<li><a href="/api-docs/m_captcha/0.1.1/m_captcha/index.html">0.1.1</a></li>
<li><a href="/api-docs/m_captcha/0.1.0/m_captcha/index.html">0.1.0</a></li>
</ul>
`},{id:9,href:"/docs/api/pow-sha256/",title:"pow_sha256",description:"API documenttion for PoW Library used in mCaptcha",content:`<p>Rust crate which generates SHA256 Proofs of Work on serializable datatypes.</p>
<p>This is a fork of the <a href="https://github.com/bddap/pow"><code>pow</code> library</a> by
<a href="https://github.com/robkorn/pow_sha256">@robkorn</a>) with some new
additions. Primary of these being:</p>
<ul>
<li>PoW datatype now offers a constructor</li>
<li>Salt is no longer hard coded into the library, users can provide
unique salts.</li>
</ul>
<p>Other small changes have also been included of various importance but
mostly just stylistic/ease of use improvements.</p>
<h2 id="versions">Versions</h2>
<ul>
<li><a href="https://mcaptcha.github.io/pow_sha256/pow_sha256/index.html">master-branch</a></li>
<li><a href="/api-docs/pow_sha256/0.2.1/pow_sha256/index.html">0.2.1</a></li>
<li><a href="/api-docs/pow_sha256/0.2.0/pow_sha256/index.html">0.2.0</a></li>
<li><a href="/api-docs/pow_sha256/0.1.0/pow_sha256/index.html">0.1.0</a></li>
</ul>
<h2 id="changelog">Changelog</h2>
<p>Changelog is available at the project&rsquo;s
<a href="https://github.com/mCaptcha/pow_sha256/blob/master/CHANGELOG.md">repository</a></p>
`},{id:10,href:"/docs/help/faq/",title:"FAQ",description:"Answers to frequently asked questions.",content:`<p>Coming soon</p>
`},{id:11,href:"/docs/user-manual/cli/",title:"CLI tool",description:"Instructions to install mCaptcha CLI",content:`<p>A CLI tool exists to compute mCaptcha challenges. It can be installed
from multiple sources:</p>
<h2 id="install">Install</h2>
<h3 id="cratesio">crates.io</h3>
<p>The CLI tool is available on, <a href="https://crates.io">crates.io</a>, the Rust
language&rsquo;s package registry. Rust language toolchain is required to
install from crates.io, please see <a href="https://rustup.rs">rustup.rs</a> for
Instructions to install it.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>cargo install mcaptcha-cli
</span></span></code></pre></div><h3 id="pre-compiled-binaries">Pre-compiled binaries</h3>
<p>Nightly builds and stable releases are regularly published to
<a href="https://dl.mcaptcha.org/mcaptcha/cli">dl.mcaptcha.org</a> for a variety of
CPU architectures and operating systems.</p>
<ol>
<li>Download binary, checksum and GPG signature files</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>wget https://dl.mcaptcha.org/mcaptcha/cli/<span style="color:#ff79c6">{</span>VERSION<span style="color:#ff79c6">}</span>/<span style="color:#ff79c6">{</span>FILENAME<span style="color:#ff79c6">}</span>.tar.gz
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>wget https://dl.mcaptcha.org/mcaptcha/cli/<span style="color:#ff79c6">{</span>VERSION<span style="color:#ff79c6">}</span>/<span style="color:#ff79c6">{</span>FILENAME<span style="color:#ff79c6">}</span>.tar.gz.asc
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span>wget https://dl.mcaptcha.org/mcaptcha/cli/<span style="color:#ff79c6">{</span>VERSION<span style="color:#ff79c6">}</span>/<span style="color:#ff79c6">{</span>FILENAME<span style="color:#ff79c6">}</span>.tar.gz.sha256
</span></span></code></pre></div><ol start="2">
<li>Verify checksum</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>sha256sum -c <span style="color:#ff79c6">{</span>FILENAME<span style="color:#ff79c6">}</span>.tar.gz.sha256
</span></span></code></pre></div><ol start="3">
<li>Download mCaptcha&rsquo;s GPG release keys and verify GPG signature</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>gpg --keyserver keyserver.ubuntu.com --recv 73DAC973A9ADBB9ADCB5CDC4595A08135BA9FF73
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>gpg --verify <span style="color:#ff79c6">{</span>FILENAME<span style="color:#ff79c6">}</span>.tar.gz.asc
</span></span></code></pre></div><ol start="4">
<li>Install Binary</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>tar -xvzf <span style="color:#ff79c6">{</span>FILENAME<span style="color:#ff79c6">}</span>.tar.gz <span style="color:#ff79c6">&amp;&amp;</span> sudo cp <span style="color:#ff79c6">{</span>FILENAME<span style="color:#ff79c6">}</span>/mcaptcha-cli /usr/local/bin
</span></span></code></pre></div><h3 id="build-from-source">Build from source</h3>
<ol>
<li>Install Rust tool chain
Please see <a href="https://rustup.rs">here</a> for instructions.</li>
<li>Download source code</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>git clone https://git.batsense.net/mCaptcha/cli
</span></span></code></pre></div><ol start="3">
<li>Compile and install</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>cargo build --release <span style="color:#ff79c6">&amp;&amp;</span> sudp cp ./target/release/mcaptcha-cli
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>/usr/local/bin
</span></span></code></pre></div><h2 id="pass-mcaptcha-challenge">Pass mCaptcha challenge</h2>
<p>The CLI tool requires details about the challenge to work on it. The
tool can be used in three different modes compute challenge:</p>
<ol>
<li>Protected Page: Compute mCaptcha challenge for the CAPTCHA at a
protected page</li>
<li>Widget URL: Compute PoW for captcha at widget URL</li>
<li>(Developer mode) Offline: Computes PoW over given CAPTCHA parameters</li>
</ol>
<h3 id="from-protected-page-url">From protected page URL</h3>
<p>The most convenient mode: copy the URL of the webpage which has the
mCaptcha widget (example: showcase.mcaptcha.org) and run the CLI tool
with it to get an authorization code:
Compute challenge using the URL</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>03:39 atm@lab cli ±|feat-parse-webpage ✗|→ mcaptcha-cli protected-page https://showcase.mcaptcha.org/
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>Authorization token: eRAZJiMrW58uDYA1s64Tmwq1u30HutuF
</span></span></code></pre></div><h3 id="widget-url">Widget URL</h3>
<p>If you have the widget URL (will be in format https://mcaptcha.example.org/widget?sitekey=randomstring), it can be used to solve challenge as well:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>Compute PoW by fetching parameters from  CAPTCHA URL
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span>Usage: mcaptcha-cli online --url &lt;URL&gt;
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4</span><span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5</span><span>Options:
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">6</span><span>  -u, --url &lt;URL&gt;  URL of the CAPTCHA. Example:  https://example.org/widget?sitekey<span style="color:#ff79c6">=</span>foo
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">7</span><span>  -h, --help       Print <span style="color:#8be9fd;font-style:italic">help</span>
</span></span></code></pre></div><p>Example usage:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>13:32 atm@lab cli ±|online ✗|→ mcaptcha-cli online -u https://demo.mcaptcha.org/widget?sitekey<span style="color:#ff79c6">=</span>pHy0AktWyOKuxZDzFfoaewncWecCHo23
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>Authorization token: 3xleN26OctBuVu3X4t6CYyUjErhaxQvz
</span></span></code></pre></div><h3 id="developer-mode-offline">[Developer mode] Offline</h3>
<p>Useful while debugging mCaptcha configurations, works on raw challenge
parameters.</p>
<p>Help menu:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>Compute PoW with offline parameters
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span>Usage: mcaptcha-cli offline --salt &lt;SALT&gt; --phrase &lt;PHRASE&gt; --difficulty-factor &lt;DIFFICULTY_FACTOR&gt;
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4</span><span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5</span><span>Options:
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">6</span><span>  -s, --salt &lt;SALT&gt;                            Salt with which PoW should be computed
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">7</span><span>  -p, --phrase &lt;PHRASE&gt;                        Phrase over which PoW should be computed
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">8</span><span>  -d, --difficulty-factor &lt;DIFFICULTY_FACTOR&gt;  Difficulty Factor
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">9</span><span>  -h, --help                                   Print <span style="color:#8be9fd;font-style:italic">help</span>
</span></span></code></pre></div><p>Example usage:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>13:28 atm@lab cli ±|online|→ mcaptcha-cli offline -s <span style="color:#ff79c6">$(</span>rand 32<span style="color:#ff79c6">)</span> -p <span style="color:#ff79c6">$(</span>rand 32<span style="color:#ff79c6">)</span> -d <span style="color:#bd93f9">50000</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>difficulty: <span style="color:#bd93f9">50000</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span>nonce: <span style="color:#bd93f9">90507</span>
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4</span><span>original phrase: f351f333d44b2c6b5bf7f033b065bbb8fb5e9dd153bd402e43ed04425f5a3859
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5</span><span>result: <span style="color:#bd93f9">340276562956196291522979356090220150471</span>
</span></span></code></pre></div><p>Where rand is <a href="https://github.com/realaravinth/dotfiles/blob/6fc6c87cc912e17488a35c0d3327ecf393221270/scripts/rand#L20">this</a> script.</p>
`},{id:12,href:"/docs/user-manual/how-to-mcaptcha-without-js/",title:"Use mCaptcha without JavaScript",description:"Instructions to solve mCaptcha with JavaScript disabled",content:`<p>To use mCaptcha without JavaScript:</p>
<ol>
<li>Install mCaptcha CLI too. Please see <a href="./cli">here</a> for instructions.</li>
<li>Copy the URL of the protected page</li>
<li>Run mCaptcha CLI with that URL:</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>mcapthca-cli protected-page &lt;URL&gt;
</span></span></code></pre></div><ol start="4">
<li>Copy authorization code and paste it in the form</li>
</ol>
`},{id:13,href:"/docs/user-manual/",title:"User Manual",description:"Introduction to mCaptcha for users",content:""},{id:14,href:"/docs/webmasters/terminology/",title:"Terminology",description:"Information about terminology used in mCaptcha, some of which unique to the project",content:`<h2 id="authorization-token">Authorization token</h2>
<p>When a visitor solves the CAPTCHA and sends their solution to an
mCaptcha instance, the solution will be verified for correctness. If the
solution is correct, mCaptcha will return a single use authorization token.</p>
<p>This authorization token should be attached to the visitor&rsquo;s requited to the
protected service and the protected service should validity of the
authorization token with the mCaptcha instance and only allow authorization to
protected resource if the authorization token is valid.</p>
<h2 id="cooldown-period">Cooldown Period</h2>
<p>mCaptcha implements leaky bucket algorithm to measure
current traffic levels. Cooldown period specifies the leak or the time
after which a visitor addition is decremented.</p>
<p>For instance, if initial traffic level is 0 and a user visits one
second later, the traffic level will be incremented to 1. Now, if the
cooldown period is set to 30 seconds, the traffic level will be
decremented after 30 seconds. So after 30 seconds, the traffic level will
go from 1 to 0.</p>
<h2 id="difficulty-factor">Difficulty Factor</h2>
<p>Difficulty factor determines the time it takes to solve a CAPTCHA. The
higher the difficulty factor, the longer it will take to generate a
proof of work for it to solve the CAPTCHA.</p>
<p>mCaptcha&rsquo;s proof of work based mechanism makes it highly accessible to
people with special needs but it is important to choose the difficulty factor
with care as very high difficulty factors will make the CAPTCHA
inaccessible to users on slow devices.</p>
<h2 id="sitekey">Sitekey</h2>
<p>Site key is a unique identifier associated with CAPTCHA configurations
created on mCaptcha. It is required to integrate a CAPTCHA with your
website.</p>
<h2 id="visitor-threshold">Visitor Threshold</h2>
<p>mCaptcha&rsquo;s variable difficulty factor mechanism requires a website&rsquo;s traffic
statistics be split into levels, so that it can deploy the right
difficulty factor for each level.</p>
<p>Visitor threshold is used to traffic into levels and mCaptcha accepts a
difficulty configuration for each of these levels. When current traffic
exceeds a difficulty factor, mCaptcha will increase the difficulty
factor to the next configured level.</p>
<p>For instance, consider the configuration given below:</p>
<ul>
<li>Cool down period: 30 seconds</li>
</ul>
<table>
<thead>
<tr>
<th>Level</th>
<th>Difficulty Factor</th>
<th>Visitor Threshold</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>5,000</td>
<td>2,000</td>
</tr>
<tr>
<td>2</td>
<td>50,000</td>
<td>5,000</td>
</tr>
<tr>
<td>3</td>
<td>500,000</td>
<td>10,000</td>
</tr>
<tr>
<td>4</td>
<td>5,000,000</td>
<td>15,000</td>
</tr>
</tbody>
</table>
<p>If the website sees 2,000 requests in a 30 second window, level 1
difficulty factor(5,000) will be deployed. If the traffic increases to
5,000 requests in a 30 second window, then difficulty factor will be
upgraded to level 2(50,000). Likewise 10,000 and 15,000 requests over 30
seconds will result in difficulty factor being upgraded to 500,000 and
5,000,000 respectively.</p>
<p>Visitor threshold is how mCaptcha determines which difficulty factor
level to deploy. mCaptcha uses leaky bucket algorithm to keep the
visitor threshold constantly updated within the configured cool down
period. So, at any given moment the, the current visitor level will be
the amount of traffic that was served in the cool down period specified.</p>
`},{id:15,href:"/docs/webmasters/faq/",title:"Webmasters FAQ",description:"Frequently asked questions related to using mCaptcha as a webmaster",content:`<h3 id="easy-mode-default-cooldown-period">Easy Mode: Default cooldown period</h3>
<p>When configuring mCaptcha in <a href="/docs/webmasters/configuring-difficulty-factor/#easy-option">easy mode</a>, the default cooldown period is set to 30 seconds.</p>
<h2 id="how-to-get-site-key-from-dashboard">How to get site key from dashboard?</h2>
<ol>
<li>Go to &ldquo;Site keys&rdquo; on the side panel in the dashboard</li>
</ol>
<div align=center>
<figure>
  <img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_20x0_resize_box_3.png" data-srcset="/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_800x0_resize_box_3.png 800w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_700x0_resize_box_3.png 700w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_600x0_resize_box_3.png 600w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_500x0_resize_box_3.png 500w" width="222" height="496" alt="Site key menu option on the dashboard, encircled in red.">
  <noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_800x0_resize_box_3.png 800w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_700x0_resize_box_3.png 700w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_600x0_resize_box_3.png 600w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_500x0_resize_box_3.png 500w" src="/docs/webmasters/faq/sitekey-in-dashboard-sidepanel.png" width="222" height="496" alt="Site key menu option on the dashboard, encircled in red."></noscript>
</figure>
</div>
<ol start="2">
<li>click on the clipboard button to copy the site key to your
clipboard.</li>
</ol>
<figure>
  <img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_20x0_resize_box_3.png" data-srcset="/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_900x0_resize_box_3.png 900w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_800x0_resize_box_3.png 800w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_700x0_resize_box_3.png 700w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_600x0_resize_box_3.png 600w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_500x0_resize_box_3.png 500w" width="1825" height="831" alt="Copy site key to clipboard. Clipboard button is highlighted in the photo">
  <noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_900x0_resize_box_3.png 900w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_800x0_resize_box_3.png 800w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_700x0_resize_box_3.png 700w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_600x0_resize_box_3.png 600w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_500x0_resize_box_3.png 500w" src="/docs/webmasters/faq/copy-sitekey.png" width="1825" height="831" alt="Copy site key to clipboard. Clipboard button is highlighted in the photo"></noscript>
</figure>
`},{id:16,href:"/docs/help/",title:"Help",description:"Help mCaptcha.",content:""},{id:17,href:"/docs/webmasters/",title:"Webmasters",description:"Introduction to mCaptcha for webmasters",content:""},{id:18,href:"/docs/api/",title:"API",description:"Documentation for libraries used in mCaptcha",content:""},{id:19,href:"/docs/",title:"mCaptcha",description:"Docs mCaptcha",content:""},{id:20,href:"/docs/self-hosting/",title:"Self-Hosting",description:"Instructions to self-host mCaptcha",content:""}];e.add(n),userinput.addEventListener("input",s,!0),suggestions.addEventListener("click",o,!0);function s(){var n,i=this.value,s=e.search(i,5),o=suggestions.childNodes,r=0,c=s.length;for(suggestions.classList.remove("d-none"),s.forEach(function(e){n=document.createElement("div"),n.innerHTML="<a href><span></span><span></span></a>",a=n.querySelector("a"),t=n.querySelector("span:first-child"),d=n.querySelector("span:nth-child(2)"),a.href=e.href,t.textContent=e.title,d.textContent=e.description,suggestions.appendChild(n)});o.length>c;)suggestions.removeChild(o[r])}function o(){for(;suggestions.lastChild;)suggestions.removeChild(suggestions.lastChild);return!1}})()