1.11.5 • Published 6 months ago

@types/csurf v1.11.5

Weekly downloads
36,478
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/csurf

Summary

This package contains type definitions for csurf (https://www.npmjs.org/package/csurf).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/csurf.

index.d.ts

// Type definitions for csurf 1.11
// Project: https://www.npmjs.org/package/csurf
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
//                 Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import express = require('express-serve-static-core');

declare global {
    namespace Express {
        interface Request {
            csrfToken(): string;
        }
    }
}

declare function csurf(options?: {
    value?: ((req: express.Request) => string) | undefined;
    /**
     * @default false
     */
    cookie?: csurf.CookieOptions | boolean | undefined;
    ignoreMethods?: string[] | undefined;
    sessionKey?: string | undefined;
}): express.RequestHandler;

declare namespace csurf {
    interface CookieOptions extends express.CookieOptions {
        /**
         * @default '_csrf'
         */
        key?: string | undefined;
    }
}

export = csurf;

Additional Details

Credits

These definitions were written by Hiroki Horiuchi, and Piotr Błażejewicz.