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

0.0.5 • Public • Published

Installation

npm install --save @types/socketio-jwt-auth

Summary

This package contains type definitions for socketio-jwt-auth (https://github.com/adcentury/socketio-jwt-auth#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/socketio-jwt-auth.

index.d.ts

import SocketIO = require("socket.io");

/**
 * This function returns a middleware function for use with Socket.IO that authenticates a new connection.
 *
 * @param options is an object literal that contains options.
 * @param verify is a function with two args payload, and done.
 */
export function authenticate(
    options: authOptions,
    verify: verifyFunc,
): (socket: SocketIO.Socket, fn: (err?: any) => void) => void;

/**
 * This is an object literal that contains options.
 */
export interface authOptions {
    secret: string;
    algorithm?: string | undefined;
    succeedWithoutToken?: boolean | undefined;
}

/**
 * This is a function with two args payload, and done.
 *
 * `payload` is the decoded JWT payload
 * `done` is an error-first callback with three args: done(err, user, message).
 */
export type verifyFunc = (payload: any, done: (err?: Error | null, user?: any, message?: string) => void) => void;

Additional Details

Credits

These definitions were written by Peter Harris.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/socketio-jwt-auth

Weekly Downloads

399

Version

0.0.5

License

MIT

Unpacked Size

4.57 kB

Total Files

5

Last publish

Collaborators

  • types