{"_id":"js-captcha","_rev":"8-e45dc2cb49b8ca6aa9e8f66265565a04","name":"js-captcha","dist-tags":{"latest":"1.2.2"},"versions":{"1.0.0":{"name":"js-captcha","version":"1.0.0","keywords":["captcha","vanilla","simple","dependency-free","lightweight","javascript"],"author":{"name":"Robert Velickovski","email":"roby@rvdizajn.com"},"license":"MIT","_id":"js-captcha@1.0.0","maintainers":[{"name":"robiveli","email":"roby@rvdizajn.com"}],"homepage":"https://github.com/robiveli/js-captcha#readme","bugs":{"url":"https://github.com/robiveli/js-captcha/issues"},"dist":{"shasum":"17740c296b1aeb476af39e0816cf3d10d2c23353","tarball":"https://registry.npmjs.org/js-captcha/-/js-captcha-1.0.0.tgz","integrity":"sha512-nJw7LUAnfp2eAfkCsMk+Ylh5ESiq/Aj4obyZRyhbaI/yKz+xOjNvYYOCIZM1Q3uGA0k8zL25uSzFXgii+eMlbA==","signatures":[{"sig":"MEUCIQDb/KT9Gr8yvG3JfnbdDfjeoIwOnMOxGphr6iLc8wY7bgIgaGPgRn2H8rqvFeuaKOcDGsSsnfLyjDdGyUcRjHi1f40=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"title":"JavaScript Captcha","gitHead":"0d88f24ea0e4ed86bab22975f487963e7ba39c5f","_npmUser":{"name":"robiveli","email":"roby@rvdizajn.com"},"repository":{"url":"git+https://github.com/robiveli/js-captcha.git","type":"git"},"_npmVersion":"5.3.0","description":"JavaScript Captcha plugin with no dependency","directories":{},"_nodeVersion":"4.2.6","devDependencies":{"grunt":"^1.0.1","grunt-umd":"^2.4.0","babel-core":"^6.26.0","grunt-babel":"^7.0.0","babel-preset-env":"^1.6.0","load-grunt-tasks":"^3.5.2","grunt-contrib-watch":"^1.0.0","grunt-contrib-uglify":"^3.0.0","grunt-contrib-htmlmin":"^2.4.0"},"_npmOperationalInternal":{"tmp":"tmp/js-captcha-1.0.0.tgz_1503866536713_0.33722618385218084","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"js-captcha","version":"1.1.0","keywords":["captcha","vanilla","simple","dependency-free","lightweight","javascript"],"author":{"name":"Robert Velickovski","email":"roby@rvdizajn.com"},"license":"MIT","_id":"js-captcha@1.1.0","maintainers":[{"name":"robiveli","email":"roby@rvdizajn.com"}],"homepage":"https://github.com/robiveli/js-captcha#readme","bugs":{"url":"https://github.com/robiveli/js-captcha/issues"},"dist":{"shasum":"2039c0d77a894130b73617c829404b3a22a56526","tarball":"https://registry.npmjs.org/js-captcha/-/js-captcha-1.1.0.tgz","integrity":"sha512-yR6XZgXDGaB6Tk41Qy8JvLSx6QjJRi0vmgjhdTfWNeOm0RRXUcA2vOUsm8R3kZWuqtKSZXpGpgqBGxS8rH1Eaw==","signatures":[{"sig":"MEUCIBUoHy07mj/2rqJjO0TlxFGjMbEqT2T6njKEyBc4FisxAiEAp16Yt/aBNQvwsKvqB7OZZOeOv+Oj77Qv4gpXcbOIkz4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"title":"JavaScript Captcha","gitHead":"961142a06a0bb0c610ca67a724c557ffb45909f3","_npmUser":{"name":"robiveli","email":"roby@rvdizajn.com"},"repository":{"url":"git+https://github.com/robiveli/js-captcha.git","type":"git"},"_npmVersion":"5.3.0","description":"Simple captcha component written in pure JavaScript with no dependencies based on canvas element","directories":{},"_nodeVersion":"4.2.6","devDependencies":{"grunt":"^1.0.1","grunt-umd":"^2.4.0","babel-core":"^6.26.0","grunt-babel":"^7.0.0","babel-preset-env":"^1.6.0","load-grunt-tasks":"^3.5.2","grunt-contrib-watch":"^1.0.0","grunt-contrib-uglify":"^3.0.0","grunt-contrib-htmlmin":"^2.4.0"},"_npmOperationalInternal":{"tmp":"tmp/js-captcha-1.1.0.tgz_1504075811039_0.652794131077826","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"js-captcha","version":"1.2.0","keywords":["captcha","vanilla","simple","dependency-free","lightweight","javascript"],"author":{"name":"Robert Velickovski","email":"roby@rvdizajn.com"},"license":"MIT","_id":"js-captcha@1.2.0","maintainers":[{"name":"robiveli","email":"roby@rvdizajn.com"}],"homepage":"https://github.com/robiveli/js-captcha#readme","bugs":{"url":"https://github.com/robiveli/js-captcha/issues"},"dist":{"shasum":"9f07db1c1a520b9a2a7e28a0b7028470adad9123","tarball":"https://registry.npmjs.org/js-captcha/-/js-captcha-1.2.0.tgz","integrity":"sha512-LVhp77hcoHIWuEBzQTSk/6gwKZ78aMU9VYJ03TkOqKrzVB+DhFNYhapo3/C+FPyR0/xUFLciT/aNNnrd+/vIJQ==","signatures":[{"sig":"MEUCIGR2QDjZJVJSVk543IS/+U/y8RsXDJiuXYKKSe3isVlpAiEAuKYmtbOYX1yr4z2JGouRcNBRyTfyoetWNlcHtBDIeDk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"title":"JavaScript Captcha","gitHead":"86502a60c2e4799752c5ffb55230abd4c89239f4","_npmUser":{"name":"robiveli","email":"roby@rvdizajn.com"},"repository":{"url":"git+https://github.com/robiveli/js-captcha.git","type":"git"},"_npmVersion":"5.4.0","description":"Simple captcha component written in pure JavaScript with no dependencies based on canvas element","directories":{},"_nodeVersion":"7.10.1","devDependencies":{"grunt":"^1.0.1","grunt-umd":"^2.4.0","babel-core":"^6.26.0","grunt-babel":"^7.0.0","babel-preset-env":"^1.6.0","load-grunt-tasks":"^3.5.2","grunt-contrib-watch":"^1.0.0","grunt-contrib-uglify":"^3.0.0","grunt-contrib-htmlmin":"^2.4.0"},"_npmOperationalInternal":{"tmp":"tmp/js-captcha-1.2.0.tgz_1505063670225_0.5846279095858335","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"js-captcha","version":"1.1.1","keywords":["captcha","vanilla","simple","dependency-free","lightweight","javascript"],"author":{"name":"Robert Velickovski","email":"roby@rvdizajn.com"},"license":"MIT","_id":"js-captcha@1.1.1","maintainers":[{"name":"robiveli","email":"roby@rvdizajn.com"}],"homepage":"https://github.com/robiveli/js-captcha#readme","bugs":{"url":"https://github.com/robiveli/js-captcha/issues"},"dist":{"shasum":"0a4ca81d2268805459a67ca58687f48b4152772d","tarball":"https://registry.npmjs.org/js-captcha/-/js-captcha-1.1.1.tgz","fileCount":10,"integrity":"sha512-da1lHsrWSy1u9jFdxIpzo+AYBTfYZDdThZsoFFSP/CVsAoofrKN78F1gjvI9qr7XtrzHokBORCnpH2OjJm/7sw==","signatures":[{"sig":"MEQCIE07F5fBlh5pCiKqjN4mClqgFD+DwHAV8IFAznQScUi6AiBLSeb1yyOh9zks+ZmBpoE+GOtXagK2QuTeoWpzC6I31A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":34526,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb1YrDCRA9TVsSAnZWagAARDUP/AihFArwc0QbaWQ5QYY/\nd5TF2HQErNz9j8KWHGexpFxlO5a8axfzbCxSfEyPB45Ut6TVLBqTpMuYWLsQ\n+ldQ6X/rgUzBNNp260kjNpYv6E/NPuu5HmysUsDKFTSBx/Alpsf0SlS1yEQZ\n9KT8XG9lqLVDZC5hB1OLsN84wVciCbbjW5Ovos/NV+TeXpoeQYH2/TzGzoNp\nZnaljEEBXzG37jR+yNz714tE0uDQds5+1FNTYzvub0FVzid2HMOnTt6k/cTJ\nmK4Lafg1T9+rZZNheOI7Tk08CvkVPXWhyI+DQWkhROq3dbwrM+py4+2kThrI\nyPLJeRg61SXBy8xSx/STq4XAdQBM3xFB1Sk2Q/+qYf+55fWnHsEPfVUPdHET\nFCpei0OrhpMdciz97vHlBvt3Qbhq25/8A/nAi2ZH/XUnrg8d3JbPdOQHkZ6W\nQOjMUiV2mseIu5p0Qfve5hOwwos8ofhg74x1xmH+xsSyfCbk77exa/Hz4FDJ\nID6x6sAhYFhYlQ80fQk8CbL90psfvZo2eZu3XQ6iX/Gl/9NR8BDxssmbSnDu\nCRC4S0PUtB4maA6PFaowRmQAZgxkygMpeU7YOC8+5iR+hyMthBFzvwcODH8a\ntJowBmPJ/dwAqCAm9nFwZ27vYI50trNGCJIUm3u2SbFvx4uzFbC1/KO5Rt+d\nkCOr\r\n=Vx/j\r\n-----END PGP SIGNATURE-----\r\n"},"title":"JavaScript Captcha","gitHead":"b4cb23760badfc885d6716a5cf6b67afc9323f2a","scripts":{"build":"grunt build","watch":"grunt watch"},"_npmUser":{"name":"robiveli","email":"roby@rvdizajn.com"},"repository":{"url":"git+https://github.com/robiveli/js-captcha.git","type":"git"},"_npmVersion":"6.4.1","description":"Simple captcha component written in pure JavaScript with no dependencies based on canvas element","directories":{},"_nodeVersion":"8.11.1","_hasShrinkwrap":false,"devDependencies":{"grunt":"^1.0.3","grunt-umd":"^3.0.0","babel-core":"^6.26.0","@babel/core":"^7.1.2","grunt-babel":"^8.0.0","babel-preset-env":"^1.6.0","load-grunt-tasks":"^4.0.0","@babel/preset-env":"^7.1.0","grunt-contrib-watch":"^1.0.0","grunt-contrib-uglify":"^4.0.0","grunt-contrib-htmlmin":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/js-captcha_1.1.1_1540721347417_0.9047669796561872","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"js-captcha","version":"1.3.0","keywords":["captcha","vanilla","simple","dependency-free","lightweight","javascript"],"author":{"name":"Robert Velickovski","email":"roby@rvdizajn.com"},"license":"MIT","_id":"js-captcha@1.3.0","maintainers":[{"name":"robiveli","email":"roby@rvdizajn.com"}],"homepage":"https://github.com/robiveli/js-captcha#readme","bugs":{"url":"https://github.com/robiveli/js-captcha/issues"},"dist":{"shasum":"5ea3f53c0bebcaf48d0fc31cdbd9269472bfafa8","tarball":"https://registry.npmjs.org/js-captcha/-/js-captcha-1.3.0.tgz","fileCount":12,"integrity":"sha512-9WFXHKfaU1BIfGjm93MTZt1DDx2M5oJ/fwBvrQEjXgiuz4Mkh0K8ScKNHTj3u9lu3PImmaSiFB/3Xw/z+pUulQ==","signatures":[{"sig":"MEUCIQDad0Ae/xDRPc33+kUP017jD7oSgUb0sFQ+p6XKIpM8ugIgIh0mHnK3DRzJL33uvnOuQ0R7T7CLBkeXck7yFCiqSBM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":48628,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeyrWdCRA9TVsSAnZWagAA4FkP/0GE4Lwo8vDovG1vXWat\nb3OwDly0vUBHlGSNl60vAXBUPUfURP3MtXE3NaLlX0XinDkj4763DBa6RwHp\n7lyiBlMBjFUebmIPs0MSb3EW1dnJAba0TYTddvj3haWxNJdt2H6cep3bivDJ\n5wCMsHrRgPxRddmV4Od8RcoyDch1ElGlO3ISAzHZh3e+4MlHkx42GSmGx47E\nKu0uXkbwCxz92yDPygbgteRXvtbJkiypCVBl5EB1Cm8kLEQ/aHFlNTEz4DhT\nRM+67NT0LaTd2BpE4z2TN5AvunCEBP3azeLsqVBYFa4oLjXF2LawrDvUA0aC\nIQB6uA5PiEE7/kZsphJczfnFxe1se08OU0pp0RvfciG9opvegdiBICsWJ6sf\nSyhFWO+A3fiqI8yUbx8b88usX4CSmB1aIG1noVS0hq9Mgkq74+hwbI5Rkhf8\nJYCfgoYOsfVm55UvDoHWdMVBxld4zEJGEBTnbMWHugVgoPeDH1zoHVnBDIHX\nUkjO4mvrpo6+Fb1GEjSTObIbiUW57SF9oDI6hpK3PdifLSKNNdxQO1LdQe8v\nG3DRmGtGqe8/0+S+YatUs11vGGLgai70Kl7mUjBGHyayKfxZbWYCn6CbD7jO\n/sOXqhCMV3uIespx3ibLf+uoPXABQ4euRvHKRPtwVSkHYs5PaN+gMS8M12Aq\nPWFp\r\n=IsVK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js/index.js","title":"JavaScript Captcha","gitHead":"2399322f8839befd9824a8ffd8829b3d3a9ad00c","scripts":{"test":"jest --coverage","build":"grunt build && ncu","watch":"grunt watch","publish":"npm run test && np --no-yarn","preinstall":"npm install -g np npm-check-updates","dependency-check":"ncu","dependency-update":"ncu -u && npm install && npm audit fix"},"_npmUser":{"name":"robiveli","email":"roby@rvdizajn.com"},"repository":{"url":"git+https://github.com/robiveli/js-captcha.git","type":"git"},"_npmVersion":"6.12.1","description":"Simple captcha component written in pure JavaScript with no dependencies based on canvas element","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"devDependencies":{"jest":"^26.0.1","grunt":"^1.1.0","grunt-umd":"^3.0.0","babel-core":"^6.26.3","@babel/core":"^7.9.6","grunt-babel":"^8.0.0","babel-preset-env":"^1.7.0","jest-canvas-mock":"^2.2.0","load-grunt-tasks":"^5.1.0","@babel/preset-env":"^7.9.6","grunt-contrib-watch":"^1.1.0","grunt-contrib-uglify":"^4.0.1","grunt-contrib-htmlmin":"^3.1.0"},"_npmOperationalInternal":{"tmp":"tmp/js-captcha_1.3.0_1590343068982_0.2875246111948262","host":"s3://npm-registry-packages"}},"1.2.2":{"name":"js-captcha","title":"JavaScript Captcha","description":"Simple captcha component written in pure JavaScript with no dependencies based on canvas element","version":"1.2.2","license":"MIT","author":{"name":"Robert Velickovski","email":"roby@rvdizajn.com"},"repository":{"type":"git","url":"git+https://github.com/robiveli/js-captcha.git"},"main":"dist/js/index.js","keywords":["captcha","vanilla","simple","dependency-free","lightweight","javascript"],"devDependencies":{"@babel/core":"^7.9.6","@babel/preset-env":"^7.9.6","babel-core":"^6.26.3","babel-preset-env":"^0.0.0","grunt":"^1.1.0","grunt-babel":"^8.0.0","grunt-contrib-uglify":"^5.2.2","grunt-contrib-watch":"^1.1.0","grunt-minify-html":"^3.0.0","grunt-umd":"^3.0.0","jest":"^30.0.2","jest-canvas-mock":"^2.2.0","jest-environment-jsdom":"^30.0.2","load-grunt-tasks":"^5.1.0"},"scripts":{"dev":"grunt watch","build":"grunt build","test":"jest --coverage"},"_id":"js-captcha@1.2.2","gitHead":"7004518be2ea2d639edd4a99c808bc2c11e662d9","bugs":{"url":"https://github.com/robiveli/js-captcha/issues"},"homepage":"https://github.com/robiveli/js-captcha#readme","_nodeVersion":"20.12.1","_npmVersion":"10.5.0","dist":{"integrity":"sha512-kVcMs2Ac6A/6H0LNb8S3IH8NiMmvPM9BX9CHidXfh8KGxGYneH3F/YG21ohabiNskHdlA1uNUvmXdLm2tJlIww==","shasum":"88f55ff69dfeaa9dd87c9d3f7f8e6c3be7d26216","tarball":"https://registry.npmjs.org/js-captcha/-/js-captcha-1.2.2.tgz","fileCount":14,"unpackedSize":47622,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDr1PrjKAZE2DidXu/qwIUu7wwWOZhxzrVZGxKNcH+VcQIgJaDvTUzXctxs+6Kj7Lbvl7BTetB7OUNq2j/MYWJoz6M="}]},"_npmUser":{"name":"robiveli","email":"roby@rvdizajn.com","actor":{"name":"robiveli","email":"roby@rvdizajn.com","type":"user"}},"directories":{},"maintainers":[{"name":"robiveli","email":"roby@rvdizajn.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/js-captcha_1.2.2_1750352568373_0.9741170306951916"},"_hasShrinkwrap":false}},"time":{"created":"2017-08-27T20:42:17.675Z","modified":"2025-06-19T17:02:48.841Z","1.0.0":"2017-08-27T20:42:17.675Z","1.1.0":"2017-08-30T06:50:12.209Z","1.2.0":"2017-09-10T17:14:31.088Z","1.1.1":"2018-10-28T10:09:07.581Z","1.3.0":"2020-05-24T17:57:49.097Z","1.2.2":"2025-06-19T17:02:48.638Z"},"bugs":{"url":"https://github.com/robiveli/js-captcha/issues"},"author":{"name":"Robert Velickovski","email":"roby@rvdizajn.com"},"license":"MIT","homepage":"https://github.com/robiveli/js-captcha#readme","keywords":["captcha","vanilla","simple","dependency-free","lightweight","javascript"],"repository":{"type":"git","url":"git+https://github.com/robiveli/js-captcha.git"},"description":"Simple captcha component written in pure JavaScript with no dependencies based on canvas element","maintainers":[{"name":"robiveli","email":"roby@rvdizajn.com"}],"readme":"# JavaScript Captcha #\n### Simple captcha component (<2KB) written in pure JavaScript with no dependencies ###\n\nSimple numeric captcha rendered within basic [canvas element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas).\n\n### Demo ###\n\nDemo can be seen [here](https://robiveli.github.io/js-captcha/).\n\n### Install ###\n\n```console\nnpm install js-captcha --save\n```\n\n### Usage ###\n\nJust include required JavaScript:\n```html\n<script src=\"jCaptcha.js\"></script>\n```\nor\n```js\nimport jCaptcha from 'jCaptcha';\n```\nDefine main captcha input element in HTML:\n```html\n<input class=\"jCaptcha\" type=\"text\" placeholder=\"Type in result please\">\n```\n\nInitialize it:\n```html\n<script>\n    let myCaptcha = new jCaptcha({\n        el: '.jCaptcha',\n        canvasClass: 'jCaptchaCanvas',\n        canvasStyle: {\n            // required properties for captcha stylings:\n            width: 100,\n            height: 15,\n            textBaseline: 'top',\n            font: '15px Arial',\n            textAlign: 'left',\n            fillStyle: '#ddd'\n        },\n        // set callback function for success and error messages:\n        callback: ( response, $captchaInputElement, numberOfTries ) => {\n            if ( response == 'success' ) {\n                // success handle, e.g. continue with form submit\n            }\n            if ( response == 'error' ) {\n                // error handle, e.g. add error class to captcha input\n\n                if (numberOfTries === 3) {\n                    // maximum attempts handle, e.g. disable form\n                }\n            }\n        }\n    });\n</script>\n```\n\nAnd then call `validate()` method when required (e.g. on form submit event):\n```html\n<script>\n    myCaptcha.validate();\n</script>\n```\n\nNo stylings included, just style it as you wish, see options below.\n\n### Options ###\n\njCaptcha can take an optional parameter - an [Object] of key/value settings:\n\n Name                | Required | Type          | Default     | Description |\n| ---                | ---      | ---           | ---         | ---         |\n| el                 | false     | [String]      | 'jCaptcha'  | CSS class for input element |\n| requiredValue      | false    | [String]      | '*'         | Render new random numbers on error validate |\n| resetOnError      | false    | [Boolean]      | true         | Mandatory field indicator |\n| focusOnError      | false    | [Boolean]      | true         | Focus input field on error validate |\n| clearOnSubmit     | false    | [Boolean]      | true'         | Clear input value on every validate |\n| callback          | false    | [Function]     | null         | As invoked function these useful arguments are returned: response (type: *String*, value: *'success'* or *'error'*), captcha (type: *Element*) and number of tries (type: *Number*) |\n| canvasClass       | false    | [String]      | 'jCaptchaCanvas'         | CSS class of canvas captcha\n| canvasStyle      | true    | [Object]      | {}         | Canvas stylings object, required for canvas appearance |\n| canvasStyle.width      | false    | [Number]      | null         | Width of canvas captcha element (in px) |\n| canvasStyle.height      | false    | [Number]      | null         | Height of canvas captcha element (in px) |\n| canvasStyle.font      | false    | [String]      | ''         | Font size and font family of canvas captcha element |\n| canvasStyle.fillStyle      | false    | [String]      | ''         | Text color of canvas captcha element |\n| canvasStyle.textAlign      | false    | [String]      | ''         | Text align of canvas captcha element |\n| canvasStyle.textBaseline      | false    | [String]      | ''         | Text baseline of canvas captcha element |\n\n\n### API ###\n\n`reset()` - generate and render new random numbers\n\n`validate()` - validate entered result in input field\n\n\n### Browser support ###\n\nWorks in every modern browser which has support for [canvas element](http://caniuse.com/#feat=canvas-text).\n\n### License  ###\n\njs-captcha is licensed under the [MIT license](http://opensource.org/licenses/MIT).\n","readmeFilename":"README.md","users":{"yichan":true}}