0.0.5 • Published 6 months ago

@types/socketio-jwt-auth v0.0.5

Weekly downloads
1,328
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for socketio-jwt-auth 0.0
// Project: https://github.com/adcentury/socketio-jwt-auth#readme
// Definitions by: Peter Harris <https://github.com/codeanimal>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1

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

  • Last updated: Tue, 06 Jul 2021 16:35:04 GMT
  • Dependencies: @types/socket.io
  • Global values: none

Credits

These definitions were written by Peter Harris.

0.0.3

8 months ago

0.0.5

6 months ago

0.0.4

7 months ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

6 years ago