Skip to content

Commit

Permalink
Merge pull request #955 from flamewow/feat/plain_module_import
Browse files Browse the repository at this point in the history
feat(): JWT_MODULE_OPTIONS set to be optional
  • Loading branch information
kamilmysliwiec authored May 19, 2022
2 parents 3fcead1 + 78c9bb3 commit c5c2939
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/jwt.service.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { Inject, Injectable, Logger } from '@nestjs/common';
import { Inject, Injectable, Logger, Optional } from '@nestjs/common';
import * as jwt from 'jsonwebtoken';
import {
JwtModuleOptions,
JwtSecretRequestType,
JwtSignOptions,
JwtVerifyOptions
} from './interfaces/jwt-module-options.interface';
} from './interfaces';
import { JWT_MODULE_OPTIONS } from './jwt.constants';

@Injectable()
export class JwtService {
private readonly logger = new Logger('JwtService');

constructor(
@Inject(JWT_MODULE_OPTIONS) private readonly options: JwtModuleOptions
@Optional()
@Inject(JWT_MODULE_OPTIONS)
private readonly options: JwtModuleOptions = {}
) {}

sign(payload: string | Buffer | object, options?: JwtSignOptions): string {
Expand Down

0 comments on commit c5c2939

Please sign in to comment.