@types/passport.socketio
TypeScript icon, indicating that this package has built-in type declarations

3.7.10 • Public • Published

Installation

npm install --save @types/passport.socketio

Summary

This package contains type definitions for passport.socketio (https://github.com/jfromaniello/passport.socketio#readme).

Details

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

index.d.ts

import { RequestHandler } from "express";
import { Store } from "express-session";
import { PassportStatic } from "passport";
import { Server, Socket } from "socket.io";

export interface PassportSocketIoOptions {
    /**
     * the name of the cookie where express/connect stores its session_id.
     */
    key?: string | undefined;

    /**
     * the session_secret to parse the cookie.
     */
    secret?: string | undefined;

    /**
     * we NEED to use a sessionstore. No MemoryStore please.
     */
    store: Store;

    /**
     * the same middleware you registrer in express.
     */
    cookieParser?: RequestHandler | undefined;
    passport?: PassportStatic | undefined;

    /**
     * callback on success.
     */
    success?: ((data: any, accept: (err?: any, accepted?: boolean) => void) => void) | undefined;

    /**
     * callback on fail/error.
     */
    fail?:
        | ((data: any, message: string, critical: boolean, accept: (err?: any, accepted?: boolean) => void) => void)
        | undefined;
}

export function authorize(options: PassportSocketIoOptions): (socket: Socket, fn: (err?: any) => void) => void;
export function filterSocketsByUser(io: Server, filter: (user: any) => boolean): Socket[];

Additional Details

Credits

These definitions were written by Jack Scotson.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/passport.socketio

Weekly Downloads

264

Version

3.7.10

License

MIT

Unpacked Size

5.48 kB

Total Files

5

Last publish

Collaborators

  • types