
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
@usewayn/checkpoint
Advanced tools
DDOS protection middleware for Express.js and React applications using Proof-of-Work (PoW) challenges. Similar to Cloudflare's "Checking your browser" page, Wayn Checkpoint protects your applications from automated attacks and spam.
npm install @usewayn/checkpoint
const express = require('express');
const { createCheckpoint } = require('@usewayn/checkpoint');
const app = express();
// Protect all routes with checkpoint
app.use(createCheckpoint({
secret: 'your-secret-key-here',
questionCount: 5,
questionHardness: 5,
jwtTtlHours: 24
}));
app.get('/', (req, res) => {
res.send('Hello, verified human!');
});
app.listen(3000);
import React from 'react';
import { CheckpointProvider } from '@usewayn/checkpoint';
function App() {
return (
<CheckpointProvider
config={{
questionCount: 5,
questionHardness: 5,
jwtTtlHours: 24,
apiEndpoint: '/__wayn_checkpoint'
}}
>
<div>
<h1>Protected App</h1>
<p>Only verified users can see this content.</p>
</div>
</CheckpointProvider>
);
}
export default App;
| Option | Type | Default | Description |
|---|---|---|---|
secret | string | Required | JWT secret key for signing tokens |
questionCount | number | 5 | Number of PoW challenges to solve |
questionHardness | number | 5 | Difficulty level (higher = more computation) |
jwtTtlHours | number | 24 | JWT token validity in hours |
apiEndpoint | string | /__wayn_checkpoint | API endpoint for challenges |
cookieName | string | __wayn-clarification | Name of the verification cookie |
excludePaths | string[] | [] | Paths to exclude from protection |
customTemplate | string | undefined | Custom HTML template for checkpoint page |
debug | boolean | false | Enable debug logging |
rateLimit | object | See below | Rate limiting configuration |
rateLimit: {
windowMs: 15 * 60 * 1000, // Time window in milliseconds
maxAttempts: 5 // Max attempts per window
}
createCheckpoint(config: CheckpointConfig)Creates an Express middleware function that protects routes with PoW challenges.
import { createCheckpoint } from '@usewayn/checkpoint';
const middleware = createCheckpoint({
secret: 'your-secret-key',
questionCount: 5,
questionHardness: 5
});
app.use(middleware);
WaynCheckpoint ClassFor more advanced usage, you can use the WaynCheckpoint class directly:
import { WaynCheckpoint } from '@usewayn/checkpoint';
const checkpoint = new WaynCheckpoint({
secret: 'your-secret-key',
questionCount: 5,
questionHardness: 5
});
app.use(checkpoint.middleware());
CheckpointProviderReact context provider that protects child components:
import { CheckpointProvider } from '@usewayn/checkpoint';
<CheckpointProvider config={config}>
<App />
</CheckpointProvider>
withCheckpoint(Component, config)Higher-order component that wraps a component with checkpoint protection:
import { withCheckpoint } from '@usewayn/checkpoint';
const ProtectedApp = withCheckpoint(App, { config });
useCheckpoint(config)React hook for checkpoint verification status:
import { useCheckpoint } from '@usewayn/checkpoint';
function MyComponent() {
const { isVerified, isLoading, error } = useCheckpoint(config);
if (isLoading) return <div>Checking...</div>;
if (!isVerified) return <div>Verification required</div>;
return <div>Protected content</div>;
}
See examples.md for more detailed usage examples.
Wayn Checkpoint consists of:
@usewayn/server): Generates and verifies PoW challenges@usewayn/widget): Browser-side PoW solvergit checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.
@usewayn/server - Server-side PoW verification@usewayn/widget - Browser-side PoW solver widgetFor support, please open an issue on GitHub or contact the maintainers.
FAQs
PoW captcha middlewares for Wayn applications
We found that @usewayn/checkpoint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.