Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bedrock/turnstile

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bedrock/turnstile - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

6

CHANGELOG.md
# 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 @@

12

lib/config.js

@@ -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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc