@types/koa-csrf
TypeScript icon, indicating that this package has built-in type declarations

5.0.4 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/koa-csrf

Weekly Downloads

14,589

Version

5.0.4

License

MIT

Unpacked Size

4.3 kB

Total Files

5

Last publish

Collaborators

  • types