Installation
npm install --save @types/koa-csrf
Summary
This package contains type definitions for koa-csrf (https://github.com/koajs/csrf).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-csrf.
index.d.ts
/* =================== USAGE ===================
import * as CSRF from "koa-csrf";
import * as Koa from "koa";
const app = new Koa();
app.use(new CSRF({
errorHandler(ctx) {
return ctx.throw(403, 'Invalid CSRF token');
},
excludedMethods: ['GET', 'HEAD', 'OPTIONS'],
disableQuery: false,
ignoredPathGlobs: []
}));
=============================================== */
export = CSRF;
import { Context, Middleware } from "koa";
declare module "koa" {
interface DefaultState {
_csrf: string;
}
}
declare const CSRF: {
new(opts?: {
errorHandler?: (ctx: Context) => never;
excludedMethods?: string[];
disableQuery?: boolean;
ignoredPathGlobs?: string[];
}): Middleware;
};
Additional Details
- Last updated: Tue, 07 Nov 2023 09:09:38 GMT
- Dependencies: @types/koa
Credits
These definitions were written by Haskaalo, and Kirill Shvets.