Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/koa-csrf

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/koa-csrf - npm Package Compare versions

Comparing version 3.0.2 to 5.0.0

41

koa-csrf/index.d.ts

@@ -1,4 +0,5 @@

// Type definitions for koa-csrf 3.0
// Type definitions for koa-csrf 5.0
// Project: https://github.com/koajs/csrf
// Definitions by: Haskaalo <https://github.com/haskaalo>
// Kirill Shvets <https://github.com/kirillshvets97>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

@@ -8,35 +9,33 @@ // TypeScript Version: 2.3

/* =================== USAGE ===================
import * as koaCsrf from 'koa-csrf';
import * as CSRF from "koa-csrf";
import * as Koa from "koa";
const app = new Koa();
app.use(new koaCsrf({
invalidSessionSecretMessage: 'Invalid session secret',
invalidSessionSecretStatusCode: 403,
invalidTokenMessage: 'Invalid CSRF token',
invalidTokenStatusCode: 403,
excludedMethods: [ 'GET', 'HEAD', 'OPTIONS' ],
disableQuery: false
app.use(new CSRF({
errorHandler(ctx) {
return ctx.throw(403, 'Invalid CSRF token');
},
excludedMethods: ['GET', 'HEAD', 'OPTIONS'],
disableQuery: false,
ignoredPathGlobs: []
}));
=============================================== */
export = koaCsrf;
export = CSRF;
import { Middleware } from 'koa';
import { Context, Middleware } from 'koa';
declare module "koa" {
interface Context {
csrf: string;
declare module 'koa' {
interface DefaultState {
_csrf: string;
}
}
declare const koaCsrf: {
declare const CSRF: {
new (opts?: {
invalidSessionSecretMessage?: string | undefined;
invalidSessionSecretStatusCode?: number | undefined;
invalidTokenMessage?: string | undefined;
invalidTokenStatusCode?: number | undefined;
excludedMethods?: string[] | undefined;
disableQuery?: boolean | undefined;
errorHandler?: (ctx: Context) => never;
excludedMethods?: string[];
disableQuery?: boolean;
ignoredPathGlobs?: string[];
}): Middleware;
};
{
"name": "@types/koa-csrf",
"version": "3.0.2",
"version": "5.0.0",
"description": "TypeScript definitions for koa-csrf",

@@ -12,2 +12,7 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-csrf",

"githubUsername": "haskaalo"
},
{
"name": "Kirill Shvets",
"url": "https://github.com/kirillshvets97",
"githubUsername": "kirillshvets97"
}

@@ -26,4 +31,4 @@ ],

},
"typesPublisherContentHash": "fbd8c9daadc6d321a133bf1d3bf7652017352f2d4d85638eec0ec169cd82059b",
"typeScriptVersion": "3.6"
"typesPublisherContentHash": "a168bf010f87cc25f11450606ad9c13d9a03f6b327fcc5695a112051d72d19c0",
"typeScriptVersion": "4.0"
}

@@ -11,5 +11,6 @@ # Installation

````ts
// Type definitions for koa-csrf 3.0
// Type definitions for koa-csrf 5.0
// Project: https://github.com/koajs/csrf
// Definitions by: Haskaalo <https://github.com/haskaalo>
// Kirill Shvets <https://github.com/kirillshvets97>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

@@ -19,34 +20,32 @@ // TypeScript Version: 2.3

/* =================== USAGE ===================
import * as koaCsrf from 'koa-csrf';
import * as CSRF from "koa-csrf";
import * as Koa from "koa";
const app = new Koa();
app.use(new koaCsrf({
invalidSessionSecretMessage: 'Invalid session secret',
invalidSessionSecretStatusCode: 403,
invalidTokenMessage: 'Invalid CSRF token',
invalidTokenStatusCode: 403,
excludedMethods: [ 'GET', 'HEAD', 'OPTIONS' ],
disableQuery: false
app.use(new CSRF({
errorHandler(ctx) {
return ctx.throw(403, 'Invalid CSRF token');
},
excludedMethods: ['GET', 'HEAD', 'OPTIONS'],
disableQuery: false,
ignoredPathGlobs: []
}));
=============================================== */
export = koaCsrf;
export = CSRF;
import { Middleware } from 'koa';
import { Context, Middleware } from 'koa';
declare module "koa" {
interface Context {
csrf: string;
declare module 'koa' {
interface DefaultState {
_csrf: string;
}
}
declare const koaCsrf: {
declare const CSRF: {
new (opts?: {
invalidSessionSecretMessage?: string | undefined;
invalidSessionSecretStatusCode?: number | undefined;
invalidTokenMessage?: string | undefined;
invalidTokenStatusCode?: number | undefined;
excludedMethods?: string[] | undefined;
disableQuery?: boolean | undefined;
errorHandler?: (ctx: Context) => never;
excludedMethods?: string[];
disableQuery?: boolean;
ignoredPathGlobs?: string[];
}): Middleware;

@@ -58,3 +57,3 @@ };

### Additional Details
* Last updated: Thu, 08 Jul 2021 16:23:20 GMT
* Last updated: Wed, 17 Aug 2022 17:02:25 GMT
* Dependencies: [@types/koa](https://npmjs.com/package/@types/koa)

@@ -64,2 +63,2 @@ * Global values: none

# Credits
These definitions were written by [Haskaalo](https://github.com/haskaalo).
These definitions were written by [Haskaalo](https://github.com/haskaalo), and [Kirill Shvets](https://github.com/kirillshvets97).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc