@bedrock/turnstile
Advanced tools
Comparing version 1.0.0 to 1.0.1
# bedrock-turnstile ChangeLog | ||
## 1.0.1 - 2023-10-20 | ||
### Fixed | ||
- Fix namespacing of `turnstile` config. | ||
- Fix config variable names to match convention. | ||
## 1.0.0 - 2023-10-16 | ||
@@ -4,0 +10,0 @@ |
@@ -7,11 +7,5 @@ /* | ||
config.turnstile = { | ||
clients: { | ||
// default client, expected to be used by most top-level apps; | ||
// other named clients can be added for more complex apps | ||
default: { | ||
// default secret testing key from turnstile | ||
SECRET_KEY: '1x0000000000000000000000000000000AA', | ||
url: 'https://challenges.cloudflare.com/turnstile/v0/siteverify' | ||
} | ||
} | ||
// default testing key for Cloudflare Turnstile | ||
secretKey: '1x0000000000000000000000000000000AA', | ||
url: 'https://challenges.cloudflare.com/turnstile/v0/siteverify' | ||
}; |
@@ -6,3 +6,2 @@ /*! | ||
import {agent} from '@bedrock/https-agent'; | ||
import assert from 'assert-plus'; | ||
import {httpClient} from '@digitalbazaar/http-client'; | ||
@@ -13,10 +12,6 @@ import './config.js'; | ||
export async function verify({token, remoteIp, client = 'default'} = {}) { | ||
export async function verify({token, remoteIp} = {}) { | ||
const cfg = config.turnstile; | ||
const clientConfig = cfg.clients[client]; | ||
assert(clientConfig, 'object', `config.turnstile.clients.${client}`); | ||
const {SECRET_KEY, url} = clientConfig; | ||
const payload = { | ||
secret: SECRET_KEY, | ||
secret: cfg.secretKey, | ||
response: token, | ||
@@ -27,3 +22,3 @@ remoteip: remoteIp | ||
try { | ||
const result = await httpClient.post(url, {agent, json: payload}); | ||
const result = await httpClient.post(cfg.url, {agent, json: payload}); | ||
if(result.data.success) { | ||
@@ -30,0 +25,0 @@ // captcha was successful, do nothing |
{ | ||
"name": "@bedrock/turnstile", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"type": "module", | ||
@@ -37,4 +37,3 @@ "description": "Cloudflare Turnstile support for Bedrock applications", | ||
"dependencies": { | ||
"@digitalbazaar/http-client": "^4.0.0", | ||
"assert-plus": "^1.0.0" | ||
"@digitalbazaar/http-client": "^4.0.0" | ||
}, | ||
@@ -41,0 +40,0 @@ "peerDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
11386
77
- Removedassert-plus@^1.0.0
- Removedassert-plus@1.0.0(transitive)