@nestjs/jwt

  • Version 8.0.0
  • Published
  • 39.9 kB
  • 2 dependencies
  • MIT license

Install

npm i @nestjs/jwt
yarn add @nestjs/jwt
pnpm add @nestjs/jwt

Overview

Nest - modern, fast, powerful node.js web framework (@jwt)

Index

Classes

class JwtModule

class JwtModule {}

    method register

    static register: (options: JwtModuleOptions) => DynamicModule;

      method registerAsync

      static registerAsync: (options: JwtModuleAsyncOptions) => DynamicModule;

        class JwtService

        class JwtService {}

          constructor

          constructor(options: JwtModuleOptions);

            method decode

            decode: (
            token: string,
            options?: jwt.DecodeOptions
            ) => string | { [key: string]: any };

              method sign

              sign: (payload: string | Buffer | object, options?: JwtSignOptions) => string;

                method signAsync

                signAsync: (
                payload: string | Buffer | object,
                options?: JwtSignOptions
                ) => Promise<string>;

                  method verify

                  verify: <T extends object = any>(token: string, options?: JwtVerifyOptions) => T;

                    method verifyAsync

                    verifyAsync: <T extends object = any>(
                    token: string,
                    options?: JwtVerifyOptions
                    ) => Promise<T>;

                      Interfaces

                      interface JwtModuleAsyncOptions

                      interface JwtModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {}

                        property inject

                        inject?: any[];

                          property useClass

                          useClass?: Type<JwtOptionsFactory>;

                            property useExisting

                            useExisting?: Type<JwtOptionsFactory>;

                              property useFactory

                              useFactory?: (...args: any[]) => Promise<JwtModuleOptions> | JwtModuleOptions;

                                interface JwtModuleOptions

                                interface JwtModuleOptions {}

                                  property privateKey

                                  privateKey?: jwt.Secret;

                                    property publicKey

                                    publicKey?: string | Buffer;

                                      property secret

                                      secret?: string | Buffer;

                                        property secretOrKeyProvider

                                        secretOrKeyProvider?: (
                                        requestType: JwtSecretRequestType,
                                        tokenOrPayload: string | object | Buffer,
                                        options?: jwt.VerifyOptions | jwt.SignOptions
                                        ) => jwt.Secret;

                                          property secretOrPrivateKey

                                          secretOrPrivateKey?: jwt.Secret;

                                            property signOptions

                                            signOptions?: jwt.SignOptions;

                                              property verifyOptions

                                              verifyOptions?: jwt.VerifyOptions;

                                                interface JwtOptionsFactory

                                                interface JwtOptionsFactory {}

                                                  method createJwtOptions

                                                  createJwtOptions: () => Promise<JwtModuleOptions> | JwtModuleOptions;

                                                    interface JwtSignOptions

                                                    interface JwtSignOptions extends jwt.SignOptions {}

                                                      property privateKey

                                                      privateKey?: string | Buffer;

                                                        property secret

                                                        secret?: string | Buffer;

                                                          interface JwtVerifyOptions

                                                          interface JwtVerifyOptions extends jwt.VerifyOptions {}

                                                            property publicKey

                                                            publicKey?: string | Buffer;

                                                              property secret

                                                              secret?: string | Buffer;

                                                                Enums

                                                                enum JwtSecretRequestType

                                                                enum JwtSecretRequestType {
                                                                SIGN = 0,
                                                                VERIFY = 1,
                                                                }

                                                                  member SIGN

                                                                  SIGN = 0

                                                                    member VERIFY

                                                                    VERIFY = 1

                                                                      Package Files (4)

                                                                      Dependencies (2)

                                                                      Dev Dependencies (20)

                                                                      Peer Dependencies (1)

                                                                      Badge

                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@nestjs/jwt.

                                                                      • Markdown
                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@nestjs/jwt)
                                                                      • HTML
                                                                        <a href="https://www.jsdocs.io/package/@nestjs/jwt"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>