Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test
- run: npm run check:edge
4 changes: 2 additions & 2 deletions examples/captcha-express/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ app.use(webdecoyCaptcha({ secret: SECRET }));
// this check so single-use replay protection spans both.)
const captcha = new Captcha({ secret: SECRET });

app.post('/login', (req: Request, res: Response) => {
app.post('/login', async (req: Request, res: Response) => {
const token = req.body?.webdecoy_token as string | undefined;
if (!token) {
res.status(400).json({ ok: false, error: 'missing token' });
return;
}
const result = captcha.verifyToken(token, req.ip);
const result = await captcha.verifyToken(token, req.ip);
if (!result.valid) {
res.status(403).json({ ok: false, error: `captcha failed: ${result.reason}` });
return;
Expand Down
301 changes: 146 additions & 155 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@
"lint": "turbo run lint",
"test": "turbo run test",
"clean": "turbo run clean && rm -rf node_modules",
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\""
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
"check:edge": "npm run check:edge -w @webdecoy/node -w @webdecoy/nextjs"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@types/node": "^20.11.0",
"prettier": "^3.2.4",
"tsup": "^8.0.1",
"turbo": "^1.12.0",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"esbuild": "^0.27.7",
"@edge-runtime/vm": "^5.0.0"
},
"packageManager": "npm@10.2.4",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webdecoy/client",
"version": "0.4.1",
"version": "0.5.0",
"description": "Web Decoy browser widget - signal collection, proof-of-work, and captcha UI",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
6 changes: 3 additions & 3 deletions packages/express/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webdecoy/express",
"version": "0.4.1",
"version": "0.5.0",
"description": "Web Decoy middleware for Express.js",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -17,7 +17,7 @@
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
"test": "jest",
"test": "jest --passWithNoTests",
"lint": "eslint src/**/*.ts",
"clean": "rm -rf dist"
},
Expand All @@ -40,7 +40,7 @@
"url": "https://github.com/WebDecoy/node/issues"
},
"dependencies": {
"@webdecoy/node": "^0.4.1"
"@webdecoy/node": "^0.5.0"
},
"peerDependencies": {
"express": "^4.18.0 || ^5.0.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/fastify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webdecoy/fastify",
"version": "0.4.1",
"version": "0.5.0",
"description": "Web Decoy plugin for Fastify",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -17,7 +17,7 @@
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
"test": "jest",
"test": "jest --passWithNoTests",
"lint": "eslint src/**/*.ts",
"clean": "rm -rf dist"
},
Expand All @@ -40,7 +40,7 @@
"url": "https://github.com/WebDecoy/node/issues"
},
"dependencies": {
"@webdecoy/node": "^0.4.1",
"@webdecoy/node": "^0.5.0",
"fastify-plugin": "^4.5.1"
},
"peerDependencies": {
Expand Down
9 changes: 5 additions & 4 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webdecoy/nextjs",
"version": "0.4.1",
"version": "0.5.0",
"description": "Web Decoy middleware for Next.js",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -17,9 +17,10 @@
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
"test": "jest",
"test": "jest --passWithNoTests",
"lint": "eslint src/**/*.ts",
"clean": "rm -rf dist"
"clean": "rm -rf dist",
"check:edge": "node ../../scripts/check-edge.mjs src/index.ts"
},
"keywords": [
"web-decoy",
Expand All @@ -41,7 +42,7 @@
"url": "https://github.com/WebDecoy/node/issues"
},
"dependencies": {
"@webdecoy/node": "^0.4.1"
"@webdecoy/node": "^0.5.0"
},
"peerDependencies": {
"next": ">=13.0.0"
Expand Down
8 changes: 3 additions & 5 deletions packages/webdecoy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webdecoy/node",
"version": "0.4.1",
"version": "0.5.0",
"description": "Web Decoy SDK for Node.js - Bot detection with TLS fingerprinting",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -19,7 +19,8 @@
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
"test": "jest",
"lint": "eslint src/**/*.ts",
"clean": "rm -rf dist"
"clean": "rm -rf dist",
"check:edge": "node ../../scripts/check-edge.mjs src/index.ts"
},
"keywords": [
"web-decoy",
Expand All @@ -41,9 +42,6 @@
"bugs": {
"url": "https://github.com/WebDecoy/node/issues"
},
"dependencies": {
"axios": "^1.6.5"
},
"devDependencies": {
"@types/jest": "^29.5.11",
"@types/node": "^20.11.0",
Expand Down
Loading