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

1.0.13 • Public • Published

Installation

npm install --save @types/feathersjs__authentication-jwt

Summary

This package contains type definitions for @feathersjs/authentication-jwt (https://feathersjs.com).

Details

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

index.d.ts

import { Application } from "@feathersjs/feathers";
import { Request } from "express";
// eslint-disable-next-line @definitelytyped/no-self-import
import * as self from "@feathersjs/authentication-jwt";

declare const feathersAuthenticationJwt:
    & ((options?: Partial<FeathersAuthenticationJWTOptions>) => () => void)
    & typeof self;
export default feathersAuthenticationJwt;

export interface FeathersAuthenticationJWTOptions {
    /**
     * the name to use when invoking the authentication Strategy
     */
    name: string;
    /**
     * the entity that you pull from if an 'id' is present in the payload
     */
    entity: string;
    /**
     * the service to look up the entity
     */
    service: string;
    /**
     * whether the request object should be passed to `verify`
     */
    passReqToCallback: boolean;
    /**
     * a passport-jwt option determining where to parse the JWT
     */
    jwtFromRequest: JwtFromRequestFunction;
    /**
     * Your main secret provided to passport-jwt
     */
    secretOrKey: string;
    /**
     * whether to use sessions,
     */
    session: boolean;
    /**
     * A Verifier class. Defaults to the built-in one but can be a custom one. See below for details.
     */
    Verifier: typeof Verifier;
}

export class Verifier {
    constructor(app: Application, options: any); // the class constructor

    verify(req: Request, payload: any, done: (error: any, user?: any, info?: any) => void): void;
}

export type JwtFromRequestFunction = (req: Request) => string | null;

export const ExtractJwt: {
    fromHeader(header_name: string): JwtFromRequestFunction;
    fromBodyField(field_name: string): JwtFromRequestFunction;
    fromUrlQueryParameter(param_name: string): JwtFromRequestFunction;
    fromAuthHeaderWithScheme(auth_scheme: string): JwtFromRequestFunction;
    fromAuthHeader(): JwtFromRequestFunction;
    fromExtractors(extractors: JwtFromRequestFunction[]): JwtFromRequestFunction;
    fromAuthHeaderAsBearerToken(): JwtFromRequestFunction;
};

export const defaults: {
    name: string;
    bodyKey: string;
};

Additional Details

Credits

These definitions were written by Jan Lohage.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/feathersjs__authentication-jwt

Weekly Downloads

67

Version

1.0.13

License

MIT

Unpacked Size

7.08 kB

Total Files

5

Last publish

Collaborators

  • types