@nestjs/jwt

  • Version 10.2.0
  • Published
  • 51 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: <T = any>(token: string, options?: jwt.DecodeOptions) => T;

              method sign

              sign: {
              (
              payload: string,
              options?: Omit<JwtSignOptions, keyof jwt.SignOptions>
              ): string;
              (payload: any, options?: JwtSignOptions): string;
              };

                method signAsync

                signAsync: {
                (
                payload: string,
                options?: Omit<JwtSignOptions, keyof jwt.SignOptions>
                ): Promise<string>;
                (payload: any, 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>;

                      class WrongSecretProviderError

                      class WrongSecretProviderError extends Error {}

                        Interfaces

                        interface JwtModuleAsyncOptions

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

                          property extraProviders

                          extraProviders?: Provider[];

                            property global

                            global?: boolean;

                              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 global

                                        global?: boolean;

                                          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 | Promise<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?: jwt.Secret;

                                                                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

                                                                              Type Aliases

                                                                              type GetSecretKeyResult

                                                                              type GetSecretKeyResult = string | Buffer | jwt.Secret;

                                                                                Package Files (5)

                                                                                Dependencies (2)

                                                                                Dev Dependencies (21)

                                                                                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>