website/index.min.9f6ca8d18a9feb4c8173940752baf80e8075b025ffbfcec12016beb0c2f8f794667102d45eb9accca8c374b0dd7a69af667e0f20813fb4fb086e6cda5230e2d8.js

1 line
No EOL
70 KiB
JavaScript

var suggestions=document.getElementById('suggestions'),userinput=document.getElementById('userinput');document.addEventListener('keydown',inputFocus);function inputFocus(a){a.keyCode===191&&(a.preventDefault(),userinput.focus()),a.keyCode===27&&(userinput.blur(),suggestions.classList.add('d-none'))}document.addEventListener('click',function(a){var b=suggestions.contains(a.target);b||suggestions.classList.add('d-none')}),document.addEventListener('keydown',suggestionFocus);function suggestionFocus(b){const d=suggestions.querySelectorAll('a'),e=[...d],a=e.indexOf(document.activeElement);let c=0;b.keyCode===38?(b.preventDefault(),c=a>0?a-1:0,d[c].focus()):b.keyCode===40&&(b.preventDefault(),c=a+1<e.length?a+1:a,d[c].focus())}(function(){var b=new FlexSearch({preset:'score',cache:!0,doc:{id:'id',field:['title','description','content'],store:['href','title','description']}}),c=[{id:0,href:"/docs/introduction/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:'\u003cp\u003emCaptcha can protect your website from DDoS attacks. In this guide we\u0026rsquo;ll\nexplore how to install mCaptcha on your website. The end result will be\nsomething like this, on your website:\u003c/p\u003e\n\u003cfigure\u003e\n \u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_20x0_resize_box_2.png" data-srcset="/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_800x0_resize_box_2.png 800w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_700x0_resize_box_2.png 700w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_600x0_resize_box_2.png 600w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_500x0_resize_box_2.png 500w" width="618" height="669" alt="A registration form with mCaptcha widget installed"\u003e\n \u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_800x0_resize_box_2.png 800w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_700x0_resize_box_2.png 700w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_600x0_resize_box_2.png 600w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_500x0_resize_box_2.png 500w" src="/docs/introduction/installing-captcha/mcaptcha-widget-installation-result.png" width="618" height="669" alt="A registration form with mCaptcha widget installed"\u003e\u003c/noscript\u003e\n\u003c/figure\u003e\n\u003cp\u003eFor the purpose of this demo, we will be using\n\u003ca href="https://demo.mcaptcha.org"\u003edemo.mcaptcha.org\u003c/a\u003e, a demo instance running\nin @realaravinth\u0026rsquo;s bedroom(for this same reason, it shouldn\u0026rsquo;t be used\nfor anything serious)\u003c/p\u003e\n\u003ch2 id="1-create-an-account-and-sign-into-the-mcaptcha-dashboard"\u003e1. Create an account and sign into the mCaptcha dashboard\u003c/h2\u003e\n\u003cp\u003eHead over to \u003ca href="https://demo.mcaptcha.org/join"\u003edemo.mcaptcha.org\u003c/a\u003e and\ncreate an account. When ready, sign in.\u003c/p\u003e\n\u003ch2 id="2-create-new-site-key"\u003e2. Create new site key\u003c/h2\u003e\n\u003cp\u003eA \u003ca href="/docs/terminology/sitekey/"\u003esite key\u003c/a\u003e is how a new CAPTCHA is configured within mCaptcha. To create\na new site key, click on \u0026ldquo;New Site\u0026rdquo; button in the dashboard.\u003c/p\u003e\n\u003cfigure\u003e\n \u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_20x0_resize_box_2.png" data-srcset="/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_900x0_resize_box_2.png 900w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_800x0_resize_box_2.png 800w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_700x0_resize_box_2.png 700w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_600x0_resize_box_2.png 600w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_500x0_resize_box_2.png 500w" width="1825" height="857" alt="mCaptcha dashboard with the \u0026#39;new site key\u0026#39; button highlighted"\u003e\n \u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_900x0_resize_box_2.png 900w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_800x0_resize_box_2.png 800w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_700x0_resize_box_2.png 700w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_600x0_resize_box_2.png 600w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_500x0_resize_box_2.png 500w" src="/docs/introduction/installing-captcha/new-sitekey-btn.png" width="1825" height="857" alt="mCaptcha dashboard with the \u0026#39;new site key\u0026#39; button highlighted"\u003e\u003c/noscript\u003e\n\u003c/figure\u003e\n\u003cp\u003eThere are two options to create a new site key, easy and advanced. \u003cstrong\u003eWe\nare going to use the easy mode in this tutorial.\u003c/strong\u003e If you are interested\nin learning more about the advance mode, please see \u003ca href="/docs/introduction/configuring-difficulty-factor/#advance-option"\u003ehere\u003c/a\u003e.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003ch3 id="easy-modedocsintroductionconfiguring-difficulty-factoreasy-option"\u003e\u003ca href="/docs/introduction/configuring-difficulty-factor/#easy-option"\u003eEasy Mode\u003c/a\u003e\u003c/h3\u003e\n\u003cp\u003eEasy mode asks a few basic statistics about your website and generates a\nconfiguration that should work for your website. Currently, easy mode is\nguided by assumptions on suitable difficulty factors to protect a\nwebsite but it will be fine-tuned as mCaptcha sees more deployment.\u003c/p\u003e\n\u003cp\u003eConfiguration generated by easy mode can be tweaked later using the\nadvance mode, as you become more familiar with how mCaptcha works.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp\u003eFill the form and submit it.\u003c/p\u003e\n\u003cfigure\u003e\n \u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_20x0_resize_box_2.png" data-srcset="/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_900x0_resize_box_2.png 900w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_800x0_resize_box_2.png 800w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_700x0_resize_box_2.png 700w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_600x0_resize_box_2.png 600w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_500x0_resize_box_2.png 500w" width="720" height="452" alt="mCaptcha dashboard with the \u0026#39;new site key\u0026#39; form in easy mode, with details filled in"\u003e\n \u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_900x0_resize_box_2.png 900w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_800x0_resize_box_2.png 800w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_700x0_resize_box_2.png 700w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_600x0_resize_box_2.png 600w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_500x0_resize_box_2.png 500w" src="/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled.png" width="720" height="452" alt="mCaptcha dashboard with the \u0026#39;new site key\u0026#39; form in easy mode, with details filled in"\u003e\u003c/noscript\u003e\n\u003c/figure\u003e\n\u003ch2 id="3-copy-widget-link"\u003e3. Copy widget link\u003c/h2\u003e\n\u003cp\u003eSubmitting the form will take you to a page where site key configuration\ncan be viewed. \u0026ldquo;View deployment\u0026rdquo; link will display CAPTCHA widget with\nthe supplied configuration. Click on it and grab the widget link.\u003c/p\u003e\n\u003ch2 id="4-install-mcaptcha-on-your-website"\u003e4. Install mCaptcha on your website\u003c/h2\u003e\n\u003cp\u003eIntegration support is available for some frontend JavaScript\nframeworks. To see full list of supported frameworks, please see\n\u003ca href="https://github.com/mCaptcha/glue#framework-support"\u003ehere\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eThere are two options to use the integration library to integrate\nmCaptcha on your website:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eServe the integration library yourself\u003c/li\u003e\n\u003cli\u003eUse a CDN like unpkg.com\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eIn this tutorial, we\u0026rsquo;ll be using the CDN.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003ePasting the following snippet on the page, within the form\u003c/strong\u003e that requires to be protected\nwill load the mCaptcha widget with the configuration supplied. Be sure\nto replace \u003ccode\u003eYour {{paste your widget link}}\u003c/code\u003e with the link obtained from\nthe previous step.\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-html" data-lang="html"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 1\u003c/span\u003e\u0026lt;\u003cspan style="color:#ff79c6"\u003ediv\u003c/span\u003e \u003cspan style="color:#50fa7b"\u003eid\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u0026#34;mcaptcha__widget-container\u0026#34;\u003c/span\u003e\u0026gt;\u0026lt;/\u003cspan style="color:#ff79c6"\u003ediv\u003c/span\u003e\u0026gt;\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 2\u003c/span\u003e\u0026lt;\u003cspan style="color:#ff79c6"\u003escript\u003c/span\u003e \u003cspan style="color:#50fa7b"\u003esrc\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u0026#34;https://unpkg.com/@mcaptcha/vanilla-glue@0.1.0-alpha-2/dist/index.js\u0026#34;\u003c/span\u003e\u0026gt;\u0026lt;/\u003cspan style="color:#ff79c6"\u003escript\u003c/span\u003e\u0026gt;\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 3\u003c/span\u003e\u0026lt;\u003cspan style="color:#ff79c6"\u003escript\u003c/span\u003e \u003cspan style="color:#50fa7b"\u003echarset\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u0026#34;utf-8\u0026#34;\u003c/span\u003e\u0026gt;\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 4\u003c/span\u003e \u003cspan style="color:#8be9fd;font-style:italic"\u003elet\u003c/span\u003e config \u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e {\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 5\u003c/span\u003e widgetLink\u003cspan style="color:#ff79c6"\u003e:\u003c/span\u003e \u003cspan style="color:#ff79c6"\u003enew\u003c/span\u003e URL(\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 6\u003c/span\u003e {{paste yout widget link}}\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 7\u003c/span\u003e ),\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 8\u003c/span\u003e };\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 9\u003c/span\u003e \u003cspan style="color:#ff79c6"\u003enew\u003c/span\u003e mcaptchaGlue.\u003cspan style="color:#ff79c6"\u003edefault\u003c/span\u003e(config);\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e10\u003c/span\u003e\u0026lt;/\u003cspan style="color:#ff79c6"\u003escript\u003c/span\u003e\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eA full example is available\n\u003ca href="https://github.com/mCaptcha/glue/blob/ea576d875457de54d82bed3edfc4ee68302fa4d8/packages/vanilla/static/embeded.html"\u003ehere\u003c/a\u003e.\u003c/p\u003e\n\u003ch2 id="5-configure-backend-to-authenticate-captcha-tokens"\u003e5. Configure backend to authenticate CAPTCHA tokens\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003eGet \u003ca href="/docs/terminology/access-token"\u003eaccess token\u003c/a\u003e from the user\u0026rsquo;s\nform submission payload. The access token will be associated with a\nparameter called \u003ccode\u003emcaptcha__token\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-python" data-lang="python"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e mcaptcha_token \u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e request\u003cspan style="color:#ff79c6"\u003e.\u003c/span\u003eform[\u003cspan style="color:#f1fa8c"\u003e\u0026#34;mcaptcha__token\u0026#34;\u003c/span\u003e]\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eValidate access token with mCaptcha instance\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-python" data-lang="python"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 1\u003c/span\u003epayload \u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e {\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 2\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\u0026#34;token\u0026#34;\u003c/span\u003e: mcaptcha_token,\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 3\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\u0026#34;key\u0026#34;\u003c/span\u003e: mcaptcha_sitekey, \u003cspan style="color:#6272a4"\u003e# captcha site key\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 4\u003c/span\u003e \u003cspan style="color:#6272a4"\u003e# mCaptcha account secret; available in settings\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 5\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\u0026#34;secret\u0026#34;\u003c/span\u003e: mcaptcha_account_secret,\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 6\u003c/span\u003e}\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 7\u003c/span\u003eresp \u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e requests\u003cspan style="color:#ff79c6"\u003e.\u003c/span\u003epost(\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 8\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\u0026#34;https://demo.mcaptha.org/api/v1/pow/siteverify\u0026#34;\u003c/span\u003e, json\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003epayload\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 9\u003c/span\u003e)\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e10\u003c/span\u003eresp \u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e resp\u003cspan style="color:#ff79c6"\u003e.\u003c/span\u003ejson()\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start="3"\u003e\n\u003cli\u003eIf access token is valid, allow access to protected resource or deny\naccess.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-python" data-lang="python"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e \u003cspan style="color:#ff79c6"\u003eif\u003c/span\u003e resp[\u003cspan style="color:#f1fa8c"\u003e\u0026#34;valid\u0026#34;\u003c/span\u003e] \u003cspan style="color:#ff79c6"\u003e==\u003c/span\u003e False:\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e \u003cspan style="color:#ff79c6"\u003ereturn\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\u0026#34;invalid captcha\u0026#34;\u003c/span\u003e, \u003cspan style="color:#bd93f9"\u003e400\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e \u003cspan style="color:#ff79c6"\u003eelse\u003c/span\u003e:\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e \u003cspan style="color:#ff79c6"\u003ereturn\u003c/span\u003e allow_access_to_protected_resource(request\u003cspan style="color:#ff79c6"\u003e.\u003c/span\u003eform)\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003ePlease see here for a complete \u003ca href="https://github.com/mCaptcha/dos/tree/8f2b53ab46d64fa78a8300dc8ce9d78578ffce12/server"\u003eFlask example\u003c/a\u003e and here for an \u003ca href="https://github.com/mCaptcha/dos/tree/8f2b53ab46d64fa78a8300dc8ce9d78578ffce12/rust-server/demo-server"\u003eActix\nWeb example\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eCongratulations, mCaptcha is now integrated with your website!\u003c/p\u003e\n'},{id:1,href:"/docs/introduction/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:'\u003cp\u003emCaptcha is highly responsive to detecting DDoS attacks. Admins are\nadvised to take advantage of it by setting low \u003ca href="/docs/terminology/difficulty-factor/"\u003edifficulty\nfactors\u003c/a\u003e for normal traffic levels\nfor their website.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eLowest advisable difficulty factor is 5000.\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eFor instance, if it is normal for my website to get 2000 requests for\nevery 30 seconds, I will set a \u003ca href="/docs/terminology/cooldown-period"\u003ecool\ndown\u003c/a\u003e period of 30 seconds and the\nfirst level of difficulty configuration will have a \u003ca href="/docs/terminology/visitor-threshold"\u003evisitor threshold\u003c/a\u003e of 2000 with a\ndifficulty factor of 5000.\u003c/p\u003e\n\u003cp\u003eThere are two modes to setting difficulty factor for your website on\nmCaptcha:\u003c/p\u003e\n\u003ch3 id="easy-option"\u003eEasy option\u003c/h3\u003e\n\u003cp\u003eEasy mode asks a few basic statistics about your website and generates a\nconfiguration that should work for your website. Currently, easy mode is\nguided by assumptions on suitable difficulty factors to protect a\nwebsite but it will be fine-tuned as mCaptcha sees more deployment.\u003c/p\u003e\n\u003cp\u003eConfiguration generated by easy mode can be tweaked later using the\nadvance mode, as you become more familiar with how mCaptcha works.\u003c/p\u003e\n\u003cfigure\u003e\n \u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_20x0_resize_box_2.png" data-srcset="/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_900x0_resize_box_2.png 900w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_800x0_resize_box_2.png 800w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_700x0_resize_box_2.png 700w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_600x0_resize_box_2.png 600w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_500x0_resize_box_2.png 500w" width="720" height="452" alt="new sitekey form in easy mode"\u003e\n \u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_900x0_resize_box_2.png 900w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_800x0_resize_box_2.png 800w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_700x0_resize_box_2.png 700w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_600x0_resize_box_2.png 600w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_500x0_resize_box_2.png 500w" src="/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode.png" width="720" height="452" alt="new sitekey form in easy mode"\u003e\u003c/noscript\u003e\n\u003c/figure\u003e\n\u003ch3 id="advance-option"\u003eAdvance option\u003c/h3\u003e\n\u003cp\u003eAdvance mode gives the admin granular control over how mCaptcha behaves\non their website. It has options to set the difficulty factor for each\nlevel of traffic(or visitor threshold, in mCaptcha speak), fully taking\nadvantage of mCaptcha\u0026rsquo;s variable difficulty factor feature.\u003c/p\u003e\n\u003cp\u003eFor instance, if it is normal for a website to get 200 requests over 30\nseconds, then setting a very low difficulty factor for a visitor\nthreshold of 200 and a cool down period of 30 seconds will allow the\nusers to pass through without waiting on the CAPTCHA. But if 1000\nrequests over 30 seconds will bring down the service, then the admin can\nconfigure increasing levels of difficulty factor of increasing traffic\nlevels, effectively rate limiting its users and protecting the\nunderlying website.\u003c/p\u003e\n\u003cfigure\u003e\n \u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_20x0_resize_box_2.png" data-srcset="/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_900x0_resize_box_2.png 900w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_800x0_resize_box_2.png 800w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_700x0_resize_box_2.png 700w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_600x0_resize_box_2.png 600w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_500x0_resize_box_2.png 500w" width="720" height="407" alt="new sitekey form in advance mode"\u003e\n \u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_900x0_resize_box_2.png 900w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_800x0_resize_box_2.png 800w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_700x0_resize_box_2.png 700w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_600x0_resize_box_2.png 600w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_500x0_resize_box_2.png 500w" src="/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode.png" width="720" height="407" alt="new sitekey form in advance mode"\u003e\u003c/noscript\u003e\n\u003c/figure\u003e\n'},{id:2,href:"/docs/terminology/access-token/",title:"Access token",description:"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.",content:'\u003cp\u003eWhen a visitor solves the CAPTCHA and sends their solution to an\nmCaptcha instance, the solution will be verified for correctness. If the\nsolution is correct, mCaptcha will return a single use access token.\u003c/p\u003e\n\u003cp\u003eThis access token should be attached to the visitor\u0026rsquo;s requited to the\nprotected service and the protected service should validity of the\naccess token with the mCaptcha instance and only allow access to\nprotected resource if the access token is valid.\u003c/p\u003e\n\u003ch2 id="validate-access-token"\u003eValidate access token:\u003c/h2\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003ecurl --location --request POST \u003cspan style="color:#f1fa8c"\u003e\u0026#39;https://mcaptcha.example.net/api/v1/pow/siteverify\u0026#39;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e --header \u003cspan style="color:#f1fa8c"\u003e\u0026#39;Content-Type: application/json\u0026#39;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e --data-raw \u003cspan style="color:#f1fa8c"\u003e\u0026#39;{\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e \u0026#34;token\u0026#34;: \u0026#34;replace this with the access token presented by visitor\u0026#34;,\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e5\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e \u0026#34;key\u0026#34;: \u0026#34;replace this with the sitekey associated with the CAPTCHA\u0026#34;\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e6\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e \u0026#34;secret\u0026#34;: \u0026#34;replace this with mCaptcha account secret, available in settings\u0026#34;\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e7\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e }\u0026#39;\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e'},{id:3,href:"/docs/terminology/cooldown-period/",title:"Cooldown Period",description:"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.",content:'\u003cp\u003emCaptcha implements leaky bucket algorithm to measure\ncurrent traffic levels. Cooldown period specifies the leak or the time\nafter which a visitor addition is decremented.\u003c/p\u003e\n\u003cp\u003eFor instance, if initial traffic level is 0 and a user visits one\nsecond later, the traffic level will be incremented to 1. Now, if the\ncooldown period is set to 30 seconds, the traffic level will be\ndecremented after 30 seconds. So after 30 seconds, the traffic level will\ngo from 1 to 0.\u003c/p\u003e\n\u003ch2 id="easy-mode-default-cooldown"\u003eEasy Mode: Default cooldown\u003c/h2\u003e\n\u003cp\u003eWhen configuring mCaptcha in \u003ca href="/docs/introduction/configuring-difficulty-factor/#easy-option"\u003eeasy Mode\u003c/a\u003e, the default cooldown period is set to 30 seconds.\u003c/p\u003e\n'},{id:4,href:"/docs/terminology/difficulty-factor/",title:"Difficulty Factor",description:"Difficulty factor determines the time it takes to solve a CAPTCHA, there are two modes to setting difficulty factor: advance and easy, this page documents both modes.",content:"\u003cp\u003eDifficulty factor determines the time it takes to solve a CAPTCHA. The\nhigher the difficulty factor, the longer it will take to generate a\nproof of work for it to solve the CAPTCHA.\u003c/p\u003e\n\u003cp\u003emCaptcha\u0026rsquo;s proof of work based mechanism makes it highly accessible to\npeople with special needs but it is important to choose the difficulty factor\nwith care as very high difficulty factors will make the CAPTCHA\ninaccessible to users on slow devices.\u003c/p\u003e\n"},{id:5,href:"/docs/terminology/sitekey/",title:"Site key",description:"Site key is the unique identifier associated with a CAPTCHA created on mCaptcha",content:'\u003cp\u003eSite key is a unique identifier associated with CAPTCHA configurations\ncreated on mCaptcha. It is required to integrate a CAPTCHA with your\nwebsite.\u003c/p\u003e\n\u003ch2 id="how-to-get-site-key"\u003eHow to get site key?\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eGo to \u0026ldquo;Site keys\u0026rdquo; on the side panel in the dashboard\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv align=center\u003e\n\u003cfigure\u003e\n \u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_20x0_resize_box_2.png" data-srcset="/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_800x0_resize_box_2.png 800w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_700x0_resize_box_2.png 700w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_600x0_resize_box_2.png 600w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_500x0_resize_box_2.png 500w" width="222" height="496" alt="Site key menu option on the dashboard, encircled in red."\u003e\n \u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_800x0_resize_box_2.png 800w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_700x0_resize_box_2.png 700w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_600x0_resize_box_2.png 600w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_500x0_resize_box_2.png 500w" src="/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel.png" width="222" height="496" alt="Site key menu option on the dashboard, encircled in red."\u003e\u003c/noscript\u003e\n\u003c/figure\u003e\n\u003c/div\u003e\n\u003col start="2"\u003e\n\u003cli\u003eclick on the clipboard button to copy the site key to your\nclipboard.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cfigure\u003e\n \u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_20x0_resize_box_2.png" data-srcset="/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_900x0_resize_box_2.png 900w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_800x0_resize_box_2.png 800w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_700x0_resize_box_2.png 700w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_600x0_resize_box_2.png 600w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_500x0_resize_box_2.png 500w" width="1825" height="831" alt="Copy site key to clipboard. Clipboard button is highlighted in the photo"\u003e\n \u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_900x0_resize_box_2.png 900w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_800x0_resize_box_2.png 800w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_700x0_resize_box_2.png 700w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_600x0_resize_box_2.png 600w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_500x0_resize_box_2.png 500w" src="/docs/terminology/sitekey/copy-sitekey.png" width="1825" height="831" alt="Copy site key to clipboard. Clipboard button is highlighted in the photo"\u003e\u003c/noscript\u003e\n\u003c/figure\u003e\n'},{id:6,href:"/docs/terminology/visitor-threshold/",title:"Visitor Threshold",description:"Visitor threshold is used to split traffic into levels. If the traffic level supersceedes the configured threshold, then mCaptcha will increase difficulty factor based on the configuration provided.",content:"\u003cp\u003emCaptcha\u0026rsquo;s variable difficulty factor mechanism requires a website\u0026rsquo;s traffic\nstatistics be split into levels, so that it can deploy the right\ndifficulty factor for each level.\u003c/p\u003e\n\u003cp\u003eVisitor threshold is used to traffic into levels and mCaptcha accepts a\ndifficulty configuration for each of these levels. When current traffic\nexceeds a difficulty factor, mCaptcha will increase the difficulty\nfactor to the next configured level.\u003c/p\u003e\n\u003cp\u003eFor instance, consider the configuration given below:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eCool down period: 30 seconds\u003c/li\u003e\n\u003c/ul\u003e\n\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eLevel\u003c/th\u003e\n\u003cth\u003eDifficulty Factor\u003c/th\u003e\n\u003cth\u003eVisitor Threshold\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e1\u003c/td\u003e\n\u003ctd\u003e5,000\u003c/td\u003e\n\u003ctd\u003e2,000\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e2\u003c/td\u003e\n\u003ctd\u003e50,000\u003c/td\u003e\n\u003ctd\u003e5,000\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e3\u003c/td\u003e\n\u003ctd\u003e500,000\u003c/td\u003e\n\u003ctd\u003e10,000\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e4\u003c/td\u003e\n\u003ctd\u003e5,000,000\u003c/td\u003e\n\u003ctd\u003e15,000\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eIf the website sees 2,000 requests in a 30 second window, level 1\ndifficulty factor(5,000) will be deployed. If the traffic increases to\n5,000 requests in a 30 second window, then difficulty factor will be\nupgraded to level 2(50,000). Likewise 10,000 and 15,000 requests over 30\nseconds will result in difficulty factor being upgraded to 500,000 and\n5,000,000 respectively.\u003c/p\u003e\n\u003cp\u003eVisitor threshold is how mCaptcha determines which difficulty factor\nlevel to deploy. mCaptcha uses leaky bucket algorithm to keep the\nvisitor threshold constantly updated within the configured cool down\nperiod. So, at any given moment the, the current visitor level will be\nthe amount of traffic that was served in the cool down period specified.\u003c/p\u003e\n"},{id:7,href:"/docs/self-hosted/getting-started/",title:"Getting started",description:"Get started with self-hosting mCaptcha",content:'\u003ch2 id="get-started"\u003eGet started\u003c/h2\u003e\n\u003cp\u003eThere are two main ways to self-host mCaptcha:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\u003ca href="./bare-metal"\u003eBare metal\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="./docker"\u003eWith Docker\u003c/a\u003e\u003c/li\u003e\n\u003c/ol\u003e\n'},{id:8,href:"/docs/self-hosted/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:'\u003ch3 id="2-configure"\u003e2. Configure\u003c/h3\u003e\n\u003cp\u003emcaptcha is highly configurable.\u003c/p\u003e\n\u003cp\u003eConfiguration is applied/merged in the following order:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003epath to configuration file passed in via \u003ccode\u003eMCAPTCHA_CONFIG\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e./config/default.toml\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e/etc/mcaptcha/config.toml\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eenvironment variables.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch3 id="1-install-postgres-if-you-dont-have-it-already"\u003e1. Install postgres if you don\u0026rsquo;t have it already.\u003c/h3\u003e\n\u003cp\u003eFor Debian based distributions:\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003esudo apt install postgres\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="2-create-new-user-for-running-mcaptcha"\u003e2. Create new user for running \u003ccode\u003emcaptcha\u003c/code\u003e\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e$ sudo useradd -b /srv -m -s /usr/bin/zsh mcaptcha\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="3-create-new-user-in-postgres"\u003e3. Create new user in Postgres\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e$ sudo -iu postgres \u003cspan style="color:#6272a4"\u003e# switch to `postgres` user\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e$ psql\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan style="color:#8be9fd;font-style:italic"\u003epostgres\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#6272a4"\u003e# CREATE USER mcaptcha WITH PASSWORD \u0026#39;my super long password and yes you need single quote`;\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e$ createdb -O mcaptcha mcaptcha \u003cspan style="color:#6272a4"\u003e# create db \u0026#39;mcaptcha\u0026#39; with \u0026#39;mcaptcha\u0026#39; as owner\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="4-install-and-load-mcaptchacachehttpsgithubcommcaptchacache-module"\u003e4. Install and load \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e module:\u003c/h3\u003e\n\u003cp\u003eSee \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e for more\ndetails.\u003c/p\u003e\n\u003ch3 id="4-build-mcaptcha"\u003e4. Build \u003ccode\u003emcaptcha\u003c/code\u003e\u003c/h3\u003e\n\u003cp\u003eTo build \u003ccode\u003emcaptcha\u003c/code\u003e, you need the following dependencies:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003erust\u003c/li\u003e\n\u003cli\u003enode(\u003ccode\u003ev14.16.0\u003c/code\u003e)\u003c/li\u003e\n\u003cli\u003eyarn(JavaScript package manager)\u003c/li\u003e\n\u003cli\u003emake\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id="how-to-build"\u003eHow to build\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eInstall Cargo using \u003ca href="https://rustup.rs/"\u003erustup\u003c/a\u003e with:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e$ curl --proto \u003cspan style="color:#f1fa8c"\u003e\u0026#39;=https\u0026#39;\u003c/span\u003e --tlsv1.2 -sSf https://sh.rustup.rs | sh\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start="2"\u003e\n\u003cli\u003e\n\u003cp\u003eInstall node(\u003ccode\u003ev14.16.0\u003c/code\u003e)\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eInstall yarn(JavaScript package manager)\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eBuild with make:\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e$ make dev-env \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e make release\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="5-install-package"\u003e5. Install package:\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e$ sudo cp ./target/release/mcaptcha /usr/bin/ \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e mkdir sudo /etc/mcaptcha \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e sudo cp config/default.toml /etc/mcaptcha/config.toml\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="6-systemd-service-configuration"\u003e6. Systemd service configuration:\u003c/h3\u003e\n\u003col\u003e\n\u003cli\u003eCopy the following to \u003ccode\u003e/etc/systemd/system/mcaptcha.service\u003c/code\u003e:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-systemd" data-lang="systemd"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 1\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e[Unit]\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 2\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eDescription\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003emCaptcha: a CAPTCHA system that gives attackers a run for their money\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 3\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 4\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e[Service]\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 5\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eType\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003esimple\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 6\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eUser\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003emcaptcha\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 7\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eExecStart\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e/usr/bin/mcaptcha\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 8\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eRestart\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003eon-failure\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 9\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eRestartSec\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e1\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e10\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eSuccessExitStatus\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e3 4\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e11\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eRestartForceExitStatus\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e3 4\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e12\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eSystemCallArchitectures\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003enative\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e13\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eMemoryDenyWriteExecute\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003etrue\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e14\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eNoNewPrivileges\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003etrue\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e15\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eEnvironment\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u0026#34;RUST_LOG=info\u0026#34;\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e16\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e17\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e[Unit]\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e18\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eAfter\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003esound.target\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e19\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eWants\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003enetwork-online.target\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e20\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eWants\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003enetwork-online.target\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e21\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eRequires\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003epostgresql.service\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e22\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eAfter\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003esyslog.target\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e23\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e24\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e[Install]\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e25\u003c/span\u003e\u003cspan style="color:#50fa7b"\u003eWantedBy\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003emulti-user.target\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start="2"\u003e\n\u003cli\u003eEnable service:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e$ sudo systemctl daemon-reload \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e sudo systemctl \u003cspan style="color:#8be9fd;font-style:italic"\u003eenable\u003c/span\u003e mcaptcha \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\ \u003c/span\u003e\u003cspan style="color:#6272a4"\u003e# Auto startup during boot\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e sudo systemctl start mcaptcha\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e``\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e'},{id:9,href:"/docs/self-hosted/docker/",title:"Using Docker",description:"Deploy mCaptcha using docker",content:'\u003ch2 id="with-docker"\u003eWith Docker\u003c/h2\u003e\n\u003ch3 id="1-configure"\u003e1. Configure\u003c/h3\u003e\n\u003cp\u003emcaptcha is highly configurable.\u003c/p\u003e\n\u003cp\u003eConfiguration is applied/merged in the following order:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003epath to configuration file passed in via \u003ccode\u003eMCAPTCHA_CONFIG\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e./config/default.toml\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e/etc/mcaptcha/config.toml\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eenvironment variables.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eSee\n\u003ca href="https://github.com/mCaptcha/mCaptcha/tree/master/docs/CONFIGURATION.md"\u003eCONFIGURATION.md\u003c/a\u003e\nfor configurable options.\u003c/p\u003e\n\u003ch3 id="2-run-image"\u003e2. Run image\u003c/h3\u003e\n\u003cp\u003eIf you have already have a Postgres instance running, then:\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003edocker run -p \u0026lt;host-machine-port\u0026gt;:\u0026lt;port-in-configuration-file\u0026gt; \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e --add-host\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003edatabase:\u0026lt;database-ip-addrss\u0026gt; \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e -e \u003cspan style="color:#8be9fd;font-style:italic"\u003eRUST_LOG\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003edebug \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e -e \u003cspan style="color:#8be9fd;font-style:italic"\u003eDATABASE_URL\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u0026#34;postgres://\u0026lt;db-user\u0026gt;:\u0026lt;db-password\u0026gt;@database:\u0026lt;db-port\u0026gt;/\u0026lt;db-name\u0026gt;\u0026#34;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e5\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e mcaptcha/mcaptcha:latest\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eIf you don\u0026rsquo;t have a Postgres instance running, you can either install\none using a package manager or launch one with docker. A \u003ca href="\'../docker-compose.yml"\u003edocker-compose\nconfiguration\u003c/a\u003e is available that will launch both\na database instance mcaptcha instance.\u003c/p\u003e\n\u003ch2 id="with-docker-compose"\u003eWith docker-compose\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003eFollow steps above to build docker image.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eSet database password \u003ca href="\'../docker-compose.yml"\u003edocker-compose configuration\u003c/a\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eLaunch network\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003edocker-compose up -d\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e'},{id:10,href:"/docs/self-hosted/dependencies/",title:"Database and cache",description:"mCaptcha server requires dependencies like a Postgres database and a Redis cache",content:'\u003ch2 id="notes"\u003eNotes\u003c/h2\u003e\n\u003ch3 id="database"\u003eDatabase\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eDatabase migrations are baked into the server binary so don\u0026rsquo;t worry\nabout them.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eWhen compiling from source, unset database configuration(comment out\ndatabase configuration/ \u003ccode\u003eunset\u003c/code\u003e relevant environment variables).\n\u003ccode\u003emCaptcha\u003c/code\u003e uses \u003ca href="https://crates.io/crates/sqlx"\u003e\u003ccode\u003esqlx\u003c/code\u003e\u003c/a\u003e database client\nlibrary which checks SQL queries at compile time. So if you are starting\nwith a fresh database without migrations applied, compilation will fail.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id="redis"\u003eRedis\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eRedis is an optional dependency. Currently, the non-Redis configuration\ndoesn\u0026rsquo;t persist CAPTCHA heat. So if there\u0026rsquo;s a systems failure, CAPTCHA\nheat will be reset and visitor count will start from 0. For small\ninstallations, this should post a problem as heat is short lived and is\nreset anyways at cool down period.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003emCaptcha uses a custom Redis module called\n\u003ca href="https://github.com/mCaptcha/cache"\u003ecache\u003c/a\u003e to overcome some of Redis\'\nlimitations.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id="instructions"\u003eInstructions\u003c/h2\u003e\n\u003cp\u003eOnce again, there are two ways to go about this:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eDocker\u003c/li\u003e\n\u003cli\u003eBare metal\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch3 id="docker"\u003eDocker\u003c/h3\u003e\n\u003ch3 id="database-1"\u003eDatabase\u003c/h3\u003e\n\u003cp\u003eDownload and run Postgres\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003edocker create --name mcaptcha-postgres \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e -e \u003cspan style="color:#8be9fd;font-style:italic"\u003ePOSTGRES_PASSWORD\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u0026lt;database-password\u0026gt; \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e -p 5432:5432 \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e postgres \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e docker start mcaptcha-postgres\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="redis-1"\u003eRedis\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003edocker create --name mcaptcha-cache \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e -p 6379:6379 \u003cspan style="color:#f1fa8c"\u003e\\\n\u003c/span\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e mcaptcha/cache \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e docker start mcaptcha-cache\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eSee \u003ca href="https://github.com/mCaptcha/cache"\u003emCaptcha/cache\u003c/a\u003e for more\ndetails.\u003c/p\u003e\n\u003ch3 id="1-install-postgres-if-you-dont-have-it-already"\u003e1. Install Postgres if you don\u0026rsquo;t have it already.\u003c/h3\u003e\n\u003cp\u003eFor Debian based distributions:\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003esudo apt install postgres\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="2-create-new-user-for-running-mcaptcha"\u003e2. Create new user for running \u003ccode\u003emCaptcha\u003c/code\u003e\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e$ sudo useradd -b /srv -m -s /usr/bin/bash mcaptcha\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="3-create-new-user-in-postgres"\u003e3. Create new user in Postgres\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e$ sudo -iu postgres \u003cspan style="color:#6272a4"\u003e# switch to `postgres` user\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e$ psql\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan style="color:#8be9fd;font-style:italic"\u003epostgres\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#6272a4"\u003e# CREATE USER mcaptcha WITH PASSWORD \u0026#39;my super long password and yes you need single quote\u0026#39;;\u003c/span\u003e\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e$ createdb -O mcaptcha mcaptcha \u003cspan style="color:#6272a4"\u003e# create db \u0026#39;mcaptcha\u0026#39; with \u0026#39;mcaptcha\u0026#39; as owner\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="4-install-mcaptchacachehttpsgithubcommcaptchacache"\u003e4. Install \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e\u003c/h3\u003e\n\u003cp\u003eSee \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e for more\ndetails.\u003c/p\u003e\n'},{id:11,href:"/docs/help/troubleshooting/",title:"Troubleshooting",description:"Solutions to common problems.",content:'\u003ch2 id="q-i-just-setup-an-instance-but-i-am-unable-to-login"\u003eQ: I just setup an instance but I am unable to login\u003c/h2\u003e\n\u003cp\u003emCaptcha by default is configured to server at \u003ccode\u003elocalhost\u003c/code\u003e hostname. If\nthe instance is deployed at another hostname, please try setting\n\u003ccode\u003eMCAPTCHA_SERVER_DOMAIN\u003c/code\u003e environment variable to the hostname at which\nyour instance is deployed or setting the equivalent in config.toml:\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4"\u003e\u003ccode class="language-toml" data-lang="toml"\u003e\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e[server]\n\u003cspan style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003edomain=mydomain\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e'},{id:12,href:"/docs/api/browser/",title:"Browser libraries",description:"API documenttion for mCaptcha WASM library",content:'\u003cp\u003eThe browser part of mCaptcha is divided into three components.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eGlue code\u003c/li\u003e\n\u003cli\u003eWidget program\u003c/li\u003e\n\u003cli\u003eProof-of-Work libraries(WebAssembly and JavaScript polyfill)\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id="glue-code"\u003eGlue code\u003c/h2\u003e\n\u003cp\u003eThis is the code that links mCaptcha with your website\u0026rsquo;s frontend code.\nIt creates an \u003ccode\u003eiframe\u003c/code\u003e containing the mCaptcha widget and injects the\nreceived verification proof token into a hidden input field.\u003c/p\u003e\n\u003cp\u003eSupport is available for various frameworks, see\n\u003ca href="https://github.com/mCaptcha/glue"\u003e\u003ccode\u003emCaptcha/glue\u003c/code\u003e\u003c/a\u003e for the full list.\u003c/p\u003e\n\u003cp\u003eFor frameworks without official support, a low-level library,\n\u003ca href="https://www.npmjs.com/package/@mcaptcha/core-glue"\u003e\u003ccode\u003e@mcaptcha/core-glue\u003c/code\u003e\u003c/a\u003e,\ncan be used to implement support.\u003c/p\u003e\n\u003ch2 id="widget-program"\u003eWidget Program\u003c/h2\u003e\n\u003cp\u003eThis part is served by the mCaptcha backend. It fetches PoW config from\nthe backend, generates proof and submits it for verification. If\nverification is successful, it sends a message containing the\nverification proof token to the parent window, assuming it\u0026rsquo;s loaded as\nan \u003ccode\u003eiframe\u003c/code\u003e.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eSource code:\n\u003ca href="https://github.com/mCaptcha/mCaptcha/tree/master/templates/widget"\u003e\u003ccode\u003emCaptcha/mCaptcha/templates/widget\u003c/code\u003e\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eWebAssembly library which generates Proofs of Work for mCaptcha systems.\u003c/p\u003e\n\u003ch2 id="proof-of-workpow-library"\u003eProof-of-Work(PoW) library\u003c/h2\u003e\n\u003cp\u003eWebAssembly bindings(\u003ca href="https://github.com/mCaptcha/pow_wasm"\u003e\u003ccode\u003emCaptcha/pow_wasm\u003c/code\u003e\u003c/a\u003e) are available for the main rust library(\u003ca href="https://github.com/mCaptcha/pow_sha256"\u003e\u003ccode\u003emCaptcha/pow_sha256\u003c/code\u003e\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eFor browsers without support WebAssembly, a\npolyfill(\u003ca href="https://github.com/mCaptcha/pow_sha256-polyfill"\u003e\u003ccode\u003epow_sha256-polyfill\u003c/code\u003e\u003c/a\u003e)\nis available.\u003c/p\u003e\n'},{id:13,href:"/docs/api/mcaptcha-system/",title:"mCaptcha System Library",description:"API documenttion for the core Library used in mCaptcha",content:'\u003cp\u003eDocumentation for the library used in mCaptcha core.\u003c/p\u003e\n\u003ch2 id="versions"\u003eVersions\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href="https://mcaptcha.github.io/mCaptcha/m_captcha/index.html"\u003emaster-branch\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.3/m_captcha/index.html"\u003e0.1.3\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.2/m_captcha/index.html"\u003e0.1.2\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.1/m_captcha/index.html"\u003e0.1.1\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.0/m_captcha/index.html"\u003e0.1.0\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n'},{id:14,href:"/docs/api/pow-sha256/",title:"pow_sha256",description:"API documenttion for PoW Library used in mCaptcha",content:'\u003cp\u003eRust crate which generates SHA256 Proofs of Work on serializable datatypes.\u003c/p\u003e\n\u003cp\u003eThis is a fork of the \u003ca href="https://github.com/bddap/pow"\u003e\u003ccode\u003epow\u003c/code\u003e library\u003c/a\u003e by\n\u003ca href="https://github.com/robkorn/pow_sha256"\u003e@robkorn\u003c/a\u003e) with some new\nadditions. Primary of these being:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003ePoW datatype now offers a constructor\u003c/li\u003e\n\u003cli\u003eSalt is no longer hard coded into the library, users can provide\nunique salts.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eOther small changes have also been included of various importance but\nmostly just stylistic/ease of use improvements.\u003c/p\u003e\n\u003ch2 id="versions"\u003eVersions\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href="https://mcaptcha.github.io/pow_sha256/pow_sha256/index.html"\u003emaster-branch\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/pow_sha256/0.2.1/pow_sha256/index.html"\u003e0.2.1\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/pow_sha256/0.2.0/pow_sha256/index.html"\u003e0.2.0\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/pow_sha256/0.1.0/pow_sha256/index.html"\u003e0.1.0\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id="changelog"\u003eChangelog\u003c/h2\u003e\n\u003cp\u003eChangelog is available at the project\u0026rsquo;s\n\u003ca href="https://github.com/mCaptcha/pow_sha256/blob/master/CHANGELOG.md"\u003erepository\u003c/a\u003e\u003c/p\u003e\n'},{id:15,href:"/docs/help/faq/",title:"FAQ",description:"Answers to frequently asked questions.",content:"\u003cp\u003eComing soon\u003c/p\u003e\n"},{id:16,href:"/docs/terminology/",title:"Terminology",description:"Information about terminology used in mCaptcha, some of which unique to the project",content:""},{id:17,href:"/docs/help/",title:"Help",description:"Help mCaptcha.",content:""},{id:18,href:"/docs/introduction/",title:"Introduction",description:"Introduction to mCaptcha.",content:""},{id:19,href:"/docs/api/",title:"API",description:"Documentation for libraries used in mCaptcha",content:""},{id:20,href:"/docs/",title:"mCaptcha",description:"Docs mCaptcha",content:""},{id:21,href:"/docs/self-hosted/",title:"Self-Hosted",description:"Instructions to self-host mCaptcha",content:""}];b.add(c),userinput.addEventListener('input',e,!0),suggestions.addEventListener('click',f,!0);function e(){var g=this.value,e=b.search(g,5),f=suggestions.childNodes,h=0,i=e.length,c;for(suggestions.classList.remove('d-none'),e.forEach(function(b){c=document.createElement('div'),c.innerHTML='<a href><span></span><span></span></a>',a=c.querySelector('a'),t=c.querySelector('span:first-child'),d=c.querySelector('span:nth-child(2)'),a.href=b.href,t.textContent=b.title,d.textContent=b.description,suggestions.appendChild(c)});f.length>i;)suggestions.removeChild(f[h])}function f(){while(suggestions.lastChild)suggestions.removeChild(suggestions.lastChild);return!1}})()