A simple Express + TypeScript demo showing how to integrate Wicketkeeper into a web form and validate submissions on the server side.
- Integrate Wicketkeeper in the browser.
- Server‑side verification of Wicketkeeper payload via HTTP POST.
- TypeScript‑powered Express server with full type safety.
- Static hosting of HTML, CSS, and JS assets.
- Simple form handling for name, email, and Wicketkeeper response.
-
Clone the repository
git clone https://github.com/a-ve/wicketkeeper.git cd wicketkeeper -
Run the server
cd server docker compose up -d -
Build the front‑end widget
cd client npm install npm run build:fast cp dist/wicketkeeper.js ../example/public/
Create or update your environment variables:
export PORT=3000
export VERIFY_URL=http://localhost:8080/v0/siteverifyPORT— port on which the Express server listens (default:3000).VERIFY_URL— URL of the Wicketkeeper verification endpoint.
example/
├─ package.json
├─ package-lock.json
├─ tsconfig.json
├─ public/
│ ├─ index.html
│ └─ wicketkeeper.js ← Built client script
├─ src/
│ └─ server.ts ← Express server & verification logic
└─ dist/ ← Compiled JavaScript output
Compile TypeScript and start the server:
npx tsc
node dist/server.jsFrom the public directory, run:
npx serve| Variable | Default | Description |
|---|---|---|
PORT |
8081 |
Port on which the Express server listens |
VERIFY_URL |
http://localhost:8080/v0/siteverify |
Wicketkeeper verification endpoint URL |
Handles form submissions.
-
Request Body (JSON or URL‑encoded):
{ "name": "Alice", "email": "alice@example.com", "wicketkeeper_response": "{\"token\":\"...\",\"nonce\":123,\"response\":\"...\"}" } -
Responses:
-
200 OK: form and response valid
Thanks, Alice! We've received your email (alice@example.com). -
400 Bad Request: missing or invalid Wicketkeeper response
⚠️ Missing Wicketkeeper response⚠️ Invalid Wicketkeeper payload🚫 Wicketkeeper verification failed -
500 Internal Server Error: verification service error
❌ Verification service error
-
This project is licensed under the MIT License.