{"_id":"@blackcube/aurelia2-recaptcha","_rev":"6-fca4876983ec658b3d0e995c9dd79a99","name":"@blackcube/aurelia2-recaptcha","dist-tags":{"latest":"2.3.1"},"versions":{"2.0.0":{"name":"@blackcube/aurelia2-recaptcha","version":"2.0.0","author":{"name":"Gaultier Philippe","email":"pgaultier@gmail.com"},"license":"BSD-3-Clause","_id":"@blackcube/aurelia2-recaptcha@2.0.0","maintainers":[{"name":"pgaultier","email":"pgaultier@gmail.com"}],"homepage":"https://github.com/blackcubeio/blackcube-aurelia2#readme","bugs":{"url":"https://github.com/blackcubeio/blackcube-aurelia2/issues"},"dist":{"shasum":"937e26d008ed95dc9bb34e82d53defb52fe0ca31","tarball":"https://registry.npmjs.org/@blackcube/aurelia2-recaptcha/-/aurelia2-recaptcha-2.0.0.tgz","fileCount":21,"integrity":"sha512-UpFSjbLSwuQgYeKS7UYKkD5DDgd7Dsl62MEOY1Fn+yBdxt+kakNEtrzVaxRVckJsKlbbWr39DaxCcST+Jl16Bg==","signatures":[{"sig":"MEUCIEarrSeduCxJCAqNasQh6SrQ3fmS/NiSoygRVP81+5IJAiEAmqae+pbC9pktcOAl+nd8GtuVRwYpYZKB/+z2SgUxaQ8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":127951},"main":"./dist/index.js","type":"module","types":"./dist/types/index.d.ts","module":"./dist/index.es.js","gitHead":"074799d58f78df662cba47fdc2da168519d10e6e","scripts":{"build":"rimraf dist && rollup -c && rimraf .rollup.cache","clean":"rimraf dist && rimraf .rollup.cache","deploy":"npm  publish --access public"},"_npmUser":{"name":"pgaultier","email":"pgaultier@gmail.com"},"repository":{"url":"git+https://github.com/blackcubeio/blackcube-aurelia2.git","type":"git"},"_npmVersion":"10.5.0","description":"Blackcube Aurelia 2 Google Recaptcha","directories":{},"_nodeVersion":"21.7.1","dependencies":{"aurelia":"^2.0.0-beta.15"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.6.3","rimraf":"^5.0.7","rollup":"^4.18.0","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/aurelia2-recaptcha_2.0.0_1718799898314_0.173056505586475","host":"s3://npm-registry-packages"}},"2.0.1":{"name":"@blackcube/aurelia2-recaptcha","version":"2.0.1","author":{"name":"Gaultier Philippe","email":"pgaultier@gmail.com"},"license":"BSD-3-Clause","_id":"@blackcube/aurelia2-recaptcha@2.0.1","maintainers":[{"name":"pgaultier","email":"pgaultier@gmail.com"}],"homepage":"https://github.com/blackcubeio/blackcube-aurelia2#readme","bugs":{"url":"https://github.com/blackcubeio/blackcube-aurelia2/issues"},"dist":{"shasum":"0969c68023a3ac2e866ddb13ce3e08a3a8427946","tarball":"https://registry.npmjs.org/@blackcube/aurelia2-recaptcha/-/aurelia2-recaptcha-2.0.1.tgz","fileCount":21,"integrity":"sha512-A4/DBjtrZ0WB+lgFaDN6relDGrVdpscZuB129rlvOOFp7inH9MWrdlcXdLUtT15pJyDtZKjuYMD1aFgO7Z170Q==","signatures":[{"sig":"MEYCIQCDFDPWJuXJWqxtNtzhOmg5oowG/R9+mzbqRRHBXsrO3QIhAJzVOCw7vA1y/Y42ymPjdgvBnlCvneD+JtfF+r2tEVXz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":127951},"main":"./dist/index.js","type":"module","types":"./dist/types/index.d.ts","module":"./dist/index.es.js","gitHead":"e23f38e37ed50be7865a211f08f1c4e1e0cdf371","scripts":{"build":"rimraf dist && rollup -c && rimraf .rollup.cache","clean":"rimraf dist && rimraf .rollup.cache","deploy":"npm  publish --access public"},"_npmUser":{"name":"pgaultier","email":"pgaultier@gmail.com"},"repository":{"url":"git+https://github.com/blackcubeio/blackcube-aurelia2.git","type":"git"},"_npmVersion":"10.5.0","description":"Blackcube Aurelia 2 Google Recaptcha","directories":{},"_nodeVersion":"21.7.1","dependencies":{"aurelia":"^2.0.0-beta.15"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.6.3","rimraf":"^5.0.7","rollup":"^4.18.0","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/aurelia2-recaptcha_2.0.1_1720623394213_0.3002388311300572","host":"s3://npm-registry-packages"}},"2.1.0":{"name":"@blackcube/aurelia2-recaptcha","version":"2.1.0","author":{"name":"Gaultier Philippe","email":"pgaultier@gmail.com"},"license":"BSD-3-Clause","_id":"@blackcube/aurelia2-recaptcha@2.1.0","maintainers":[{"name":"pgaultier","email":"pgaultier@gmail.com"}],"homepage":"https://github.com/blackcubeio/blackcube-aurelia2#readme","bugs":{"url":"https://github.com/blackcubeio/blackcube-aurelia2/issues"},"dist":{"shasum":"98d18ef9cadbb11d8a710d28178a52cfee0b653f","tarball":"https://registry.npmjs.org/@blackcube/aurelia2-recaptcha/-/aurelia2-recaptcha-2.1.0.tgz","fileCount":21,"integrity":"sha512-ZGfllRbLPvlqK8069SbhZmMXdn1tAnmluIyEW0DhiflH87y70uDw+EHh2Ad1zsn1krof1Givfb4JPaRpk/FmyQ==","signatures":[{"sig":"MEUCIA2zeduNq6BVAiJHgskA4cwzalTt4HBKkN4rqjuVDv/kAiEArrkZag1lj2UxVpkO4/X6WFF6cZWgDEMS0KQrOYLtdi0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":127951},"main":"./dist/index.js","type":"module","types":"./dist/types/index.d.ts","module":"./dist/index.es.js","gitHead":"27652893bfc70141b262954de6ec1783068062dd","scripts":{"build":"rimraf dist && rollup -c && rimraf .rollup.cache","clean":"rimraf dist && rimraf .rollup.cache","deploy":"npm  publish --access public"},"_npmUser":{"name":"pgaultier","email":"pgaultier@gmail.com"},"repository":{"url":"git+https://github.com/blackcubeio/blackcube-aurelia2.git","type":"git"},"_npmVersion":"10.8.2","description":"Blackcube Aurelia 2 Google Recaptcha","directories":{},"_nodeVersion":"20.17.0","dependencies":{"aurelia":"^2.0.0-beta.21"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.6.3","rimraf":"^5.0.7","rollup":"^4.18.0","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/aurelia2-recaptcha_2.1.0_1727076678438_0.6614448100935404","host":"s3://npm-registry-packages"}},"2.1.1":{"name":"@blackcube/aurelia2-recaptcha","version":"2.1.1","author":{"name":"Gaultier Philippe","email":"pgaultier@gmail.com"},"license":"BSD-3-Clause","_id":"@blackcube/aurelia2-recaptcha@2.1.1","maintainers":[{"name":"pgaultier","email":"pgaultier@gmail.com"}],"homepage":"https://github.com/blackcubeio/blackcube-aurelia2#readme","bugs":{"url":"https://github.com/blackcubeio/blackcube-aurelia2/issues"},"dist":{"shasum":"3706263b86a4688f03d6f84f030845e3a78aac2a","tarball":"https://registry.npmjs.org/@blackcube/aurelia2-recaptcha/-/aurelia2-recaptcha-2.1.1.tgz","fileCount":21,"integrity":"sha512-mc3kzs/pqHfp2dKlUtEL+ghbJvxrexcIQndMWOFDycazsQVQR2LJGMHj6fkL/eTWHpVPmuBpLD+AmUrglON5rw==","signatures":[{"sig":"MEUCIQCYBAG1V8eYZ0pg3cGRO+13IQ/zBT2Im4VUBK3iOvTJHwIgV4Db1HiXKuHTlcEP2g47ZLK6vKYu4mGTxVDwzUjvedA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":128007},"main":"./dist/index.js","type":"module","types":"./dist/types/index.d.ts","module":"./dist/index.es.js","gitHead":"8ee733081bdcebc45f736b2442e077e4fb662d22","scripts":{"build":"rimraf dist && rollup -c && rimraf .rollup.cache","clean":"rimraf dist && rimraf .rollup.cache","deploy":"npm  publish --access public"},"_npmUser":{"name":"pgaultier","email":"pgaultier@gmail.com"},"repository":{"url":"git+https://github.com/blackcubeio/blackcube-aurelia2.git","type":"git"},"_npmVersion":"10.8.3","description":"Blackcube Aurelia 2 Google Recaptcha","directories":{},"_nodeVersion":"22.9.0","dependencies":{"aurelia":"latest"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.6.3","rimraf":"^5.0.7","rollup":"^4.18.0","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/aurelia2-recaptcha_2.1.1_1727888884923_0.5217848874224968","host":"s3://npm-registry-packages"}},"2.2.2":{"name":"@blackcube/aurelia2-recaptcha","version":"2.2.2","author":{"name":"Gaultier Philippe","email":"pgaultier@gmail.com"},"license":"BSD-3-Clause","_id":"@blackcube/aurelia2-recaptcha@2.2.2","maintainers":[{"name":"pgaultier","email":"pgaultier@gmail.com"}],"homepage":"https://github.com/blackcubeio/blackcube-aurelia2#readme","bugs":{"url":"https://github.com/blackcubeio/blackcube-aurelia2/issues"},"dist":{"shasum":"50a8597bf9e5db35667c1f7db056ae80eca4271a","tarball":"https://registry.npmjs.org/@blackcube/aurelia2-recaptcha/-/aurelia2-recaptcha-2.2.2.tgz","fileCount":21,"integrity":"sha512-fogaSy/jyiNbvbRfljKtH/VJpTw5CzghN5rhJlUIoEkS1bEgfHSp+OL4Fdy6e0C06UtIb0g0w2QOx8uJSN3Lmg==","signatures":[{"sig":"MEUCIDKsUqw30UAsh6IyiY11+I096C5T/4Re91SEn290nbAeAiEAgwVjN9mHzmeFguYTC4Mvg8G6JL5ajGWhLfGmkEtNWxs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":130961},"main":"./dist/index.js","type":"module","types":"./dist/types/index.d.ts","module":"./dist/index.es.js","gitHead":"69d922919770c813532ef80e41a2555c50c26743","scripts":{"build":"rimraf dist && rollup -c && rimraf .rollup.cache","clean":"rimraf dist && rimraf .rollup.cache","deploy":"npm  publish --access public"},"_npmUser":{"name":"pgaultier","email":"pgaultier@gmail.com"},"repository":{"url":"git+https://github.com/blackcubeio/blackcube-aurelia2.git","type":"git"},"_npmVersion":"10.8.3","description":"Blackcube Aurelia 2 Google Recaptcha","directories":{},"_nodeVersion":"22.9.0","dependencies":{"aurelia":"latest"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.6.3","rimraf":"^5.0.7","rollup":"^4.24.0","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/aurelia2-recaptcha_2.2.2_1729789052427_0.23968916260510564","host":"s3://npm-registry-packages"}},"2.3.0":{"name":"@blackcube/aurelia2-recaptcha","version":"2.3.0","author":{"name":"Gaultier Philippe","email":"pgaultier@gmail.com"},"license":"BSD-3-Clause","_id":"@blackcube/aurelia2-recaptcha@2.3.0","maintainers":[{"name":"pgaultier","email":"pgaultier@gmail.com"}],"homepage":"https://github.com/blackcubeio/blackcube-aurelia2#readme","bugs":{"url":"https://github.com/blackcubeio/blackcube-aurelia2/issues"},"dist":{"shasum":"18f34de012a74830bf352e7b0c64d315ad51b37b","tarball":"https://registry.npmjs.org/@blackcube/aurelia2-recaptcha/-/aurelia2-recaptcha-2.3.0.tgz","fileCount":21,"integrity":"sha512-FRXimpcoxiGwZzHjLps9I0Z4U9QMJ0NvTHnCw1f14su3nvEaT/i4/oPmYxQGnxsyPcb5vjoJZo1C5iM/JQxw3A==","signatures":[{"sig":"MEQCID9j01fi8koWKEJrDNxuKZgtV5F2eKbRfLTuMjGKrWXkAiA+bto5X2xZrdiPxdgTb8AvfMcQMmGxfPz3NwBRc5Xcog==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":130961},"main":"./dist/index.js","type":"module","types":"./dist/types/index.d.ts","module":"./dist/index.es.js","gitHead":"14577e38fb4d179a269f97d4f02d39bba4fa89c8","scripts":{"build":"rimraf dist && rollup -c && rimraf .rollup.cache","clean":"rimraf dist && rimraf .rollup.cache","deploy":"npm  publish --access public"},"_npmUser":{"name":"pgaultier","email":"pgaultier@gmail.com"},"repository":{"url":"git+https://github.com/blackcubeio/blackcube-aurelia2.git","type":"git"},"_npmVersion":"10.8.3","description":"Blackcube Aurelia 2 Google Recaptcha","directories":{},"_nodeVersion":"22.9.0","dependencies":{"aurelia":"latest"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.6.3","rimraf":"^5.0.7","rollup":"^4.24.0","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/aurelia2-recaptcha_2.3.0_1729896114434_0.2910936758666198","host":"s3://npm-registry-packages"}},"2.3.1":{"name":"@blackcube/aurelia2-recaptcha","version":"2.3.1","description":"Blackcube Aurelia 2 Google Recaptcha","repository":{"type":"git","url":"git+https://github.com/blackcubeio/blackcube-aurelia2.git"},"author":{"name":"Gaultier Philippe","email":"pgaultier@gmail.com"},"license":"BSD-3-Clause","type":"module","module":"./dist/index.es.js","main":"./dist/index.js","types":"./dist/types/index.d.ts","scripts":{"build":"rimraf dist && rollup -c && rimraf .rollup.cache","deploy":"npm  publish --access public","clean":"rimraf dist && rimraf .rollup.cache"},"dependencies":{"aurelia":"latest"},"devDependencies":{"@rollup/plugin-typescript":"^11.1.6","rimraf":"^5.0.7","rollup":"^4.24.0","tslib":"^2.6.3"},"_id":"@blackcube/aurelia2-recaptcha@2.3.1","gitHead":"83fa718d0ee10acc1ba21729689c218287ebd48c","bugs":{"url":"https://github.com/blackcubeio/blackcube-aurelia2/issues"},"homepage":"https://github.com/blackcubeio/blackcube-aurelia2#readme","_nodeVersion":"22.9.0","_npmVersion":"10.8.3","dist":{"integrity":"sha512-zhyBF/hoZENBp7hoTo6aCeVcX1b9mAtngnWTUigcUDyhLh+pBjKpXO6hQvaI9a2wRR/fcEx0Lj7rHTW0PXQ16Q==","shasum":"6a154b71d942b10fee6a64f6674a1e621b339944","tarball":"https://registry.npmjs.org/@blackcube/aurelia2-recaptcha/-/aurelia2-recaptcha-2.3.1.tgz","fileCount":21,"unpackedSize":129173,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDAWtSUdHomEBUCZbubg5YhA/wd83MJ5cxBptgeKDPMzAiEAzdg6fvKdW8uuT506dQf8rNNFIZyvc7L16INsrDjRJ30="}]},"_npmUser":{"name":"pgaultier","email":"pgaultier@gmail.com"},"directories":{},"maintainers":[{"name":"pgaultier","email":"pgaultier@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/aurelia2-recaptcha_2.3.1_1730026985177_0.17457770524955407"},"_hasShrinkwrap":false}},"time":{"created":"2024-06-19T12:24:58.229Z","modified":"2024-10-27T11:03:05.626Z","2.0.0":"2024-06-19T12:24:58.501Z","2.0.1":"2024-07-10T14:56:34.349Z","2.1.0":"2024-09-23T07:31:18.617Z","2.1.1":"2024-10-02T17:08:05.197Z","2.2.2":"2024-10-24T16:57:32.669Z","2.3.0":"2024-10-25T22:41:54.683Z","2.3.1":"2024-10-27T11:03:05.411Z"},"bugs":{"url":"https://github.com/blackcubeio/blackcube-aurelia2/issues"},"author":{"name":"Gaultier Philippe","email":"pgaultier@gmail.com"},"license":"BSD-3-Clause","homepage":"https://github.com/blackcubeio/blackcube-aurelia2#readme","repository":{"type":"git","url":"git+https://github.com/blackcubeio/blackcube-aurelia2.git"},"description":"Blackcube Aurelia 2 Google Recaptcha","maintainers":[{"name":"pgaultier","email":"pgaultier@gmail.com"}],"readme":"# Blackcube Aurelia 2 Google reCaptcha\n\nThis toolkit allows easy use setup of Google reCaptcha.\n\n## Install\n\nPackage is available on npm\n\nThen you can install the package:\n\n```shell\nnpm install @blackcube/aurelia2-recaptcha\n```\n\n## Additional configuration if needed\n\nYou can configure the toolkit by passing a configuration object to the configure method:\n\n## usage `bc-google-recaptcha`\n\n```typescript\nimport Aurelia, { ConsoleSink, LoggerConfiguration, LogLevel} from 'aurelia';\nimport { RecaptchaConfiguration } from \"@blackcube/aurelia2-recaptcha\";\nimport { MyApp } from './my-app';\n\n\nAurelia\n    .register(RecaptchaConfiguration.configure({\n        apiKey: '6Lxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n        // size: 'normal' default to 'invisible'\n    }))\n    .register(LoggerConfiguration.create({\n        level: LogLevel.trace,\n        colorOptions: 'colors',\n        sinks: [ConsoleSink]\n    }))\n    .app(MyApp)\n    .start();\n```\n\nAPI Key can also be set in the html:\n\n```html\n<script>\n    var googleRecaptchaApiKey = '6Lxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';\n</script>\n```\n```typescript\nimport Aurelia, { ConsoleSink, LoggerConfiguration, LogLevel} from 'aurelia';\nimport { RecaptchaConfiguration } from \"@blackcube/aurelia2-recaptcha\";\nimport { MyApp } from './my-app';\n\n\nAurelia\n    .register(RecaptchaConfiguration.configure({\n        verifyUrl: '/api/recaptcha-verify',\n    }))\n    .register(LoggerConfiguration.create({\n        level: LogLevel.trace,\n        colorOptions: 'colors',\n        sinks: [ConsoleSink]\n    }))\n    .app(MyApp)\n    .start();\n```\n\n```html\n<form bc-google-recaptcha=\"\">\n    <input type=\"text\">\n    <button type=\"submit\">Validate</button>\n</form>\n```\n\nOn submit the form will be validated and if valid the form will be submitted.\n\n## verify usage\n\nCreate verify action\n\n```php\n<?php\n/**\n * RecaptchaAction.php\n *\n * PHP version 8.1+\n *\n * @author Philippe Gaultier <pgaultier@gmail.com>\n * @copyright 2018-2024 Blackcube\n * @license https://www.blackcube.io/license license\n * @version XXX\n * @link https://www.blackcube.io\n */\n\n//todo:correct namespace\nnamespace webapp\\actions;\n\nuse Exception;\nuse GuzzleHttp\\Client;\nuse Yii;\nuse yii\\base\\Action;\nuse yii\\helpers\\Json;\nuse yii\\web\\NotAcceptableHttpException;\n\n/**\n * Class RecaptchaAction\n *\n * @author Philippe Gaultier <pgaultier@gmail.com>\n * @copyright 2018-2024 Blackcube\n * @license https://www.blackcube.io/license license\n * @version XXX\n * @link https://www.blackcube.io\n */\nclass RecaptchaAction extends Action\n{\n    public $apiSiteSecret = null;\n    public function run()\n    {\n        try {\n            $request = Yii::$app->request;\n            if (Yii::$app->request->isPost) {\n                $token = Yii::$app->request->getBodyParam('token');\n                if (empty($token)) {\n                    throw new NotAcceptableHttpException('Invalid token');\n                }\n                $client = new Client();\n                $guzzaleResponse = $client->request('POST', 'https://www.google.com/recaptcha/api/siteverify', [\n                    'form_params' => [\n                        'secret' => $this->apiSiteSecret,\n                        'response' => $token,\n                    ]\n                ]);\n                Yii::$app->response->format = \\yii\\web\\Response::FORMAT_JSON;\n                $jsonResponse = Json::decode($guzzaleResponse->getBody()->getContents());\n                if ($guzzaleResponse->getStatusCode() !== 200) {\n                    throw new NotAcceptableHttpException('Invalid response from google');\n                }\n                Yii::$app->response->data = $jsonResponse;\n            } else {\n                throw new NotAcceptableHttpException('Invalid request method');\n            }\n            return Yii::$app->response;\n        } catch (Exception $e) {\n            Yii::error($e->getMessage(), __METHOD__);\n            throw $e;\n        }\n    }\n}\n\n```\n\nAdd action to API controller\n\n```php \npublic function actions()\n    {\n        $actions = parent::actions();\n        $actions['recaptcha-verify'] = [\n            'class' => RecaptchaAction::class,\n            'apiSiteSecret' => '6Lxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n        ];\n        return $actions;\n    }\n```\n\nConfigure App:\n\n```typescript\nimport Aurelia, { ConsoleSink, LoggerConfiguration, LogLevel} from 'aurelia';\nimport { RecaptchaConfiguration } from \"@blackcube/aurelia2-recaptcha\";\nimport { MyApp } from './my-app';\n\n\nAurelia\n    .register(RecaptchaConfiguration.configure({\n        apiKey: '6Lxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n        // size: 'normal' default to 'invisible'\n        verifyUrl: '/api/recaptcha-verify', // verify url created above\n    }))\n    .register(LoggerConfiguration.create({\n        level: LogLevel.trace,\n        colorOptions: 'colors',\n        sinks: [ConsoleSink]\n    }))\n    .app(MyApp)\n    .start();\n```\nUse `bc-google-recaptcha` in your form as usual","readmeFilename":"README.md"}