894c9e6ab9
optimizations, format releases widget@0.1.38; standalone@2.2.0
693 B
693 B
Hono checkpoint
Installation
bun add hono @cap.js/checkpoint-hono
Usage
import { Hono } from "hono";
import { serveStatic } from "hono/bun";
import { capCheckpoint } from "@cap.js/checkpoint-hono";
const app = new Hono();
app.use(
"*",
capCheckpoint({
token_validity_hours: 32, // how long the token is valid for
tokens_store_path: ".data/tokensList.json",
token_size: 16, // token size in bytes
verification_template_path: join(dirname(fileURLToPath(import.meta.url)), "./index.html"),
}),
);
app.get("/", (c) => c.text("Hello Hono!"));
export default app;
That's it! You can now use the middleware to protect your routes.