Socket
Socket
Sign inDemoInstall

@nestjs/jwt

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestjs/jwt - npm Package Compare versions

Comparing version 7.1.0 to 7.2.0

2

dist/interfaces/jwt-module-options.interface.d.ts

@@ -28,5 +28,7 @@ /// <reference types="node" />

secret?: string | Buffer;
privateKey?: string | Buffer;
}
export interface JwtVerifyOptions extends jwt.VerifyOptions {
secret?: string | Buffer;
publicKey?: string | Buffer;
}

2

dist/jwt.service.d.ts
/// <reference types="node" />
import * as jwt from 'jsonwebtoken';
import { JwtModuleOptions, JwtVerifyOptions, JwtSignOptions } from './interfaces/jwt-module-options.interface';
import { JwtModuleOptions, JwtSignOptions, JwtVerifyOptions } from './interfaces/jwt-module-options.interface';
export declare class JwtService {

@@ -5,0 +5,0 @@ private readonly options;

@@ -49,2 +49,8 @@ "use strict";

delete options.secret;
if (key === 'signOptions') {
delete options.privateKey;
}
else {
delete options.publicKey;
}
return options

@@ -54,5 +60,12 @@ ? Object.assign(Object.assign({}, (this.options[key] || {})), options) : this.options[key];

getSecretKey(token, options, key, secretRequestType) {
var _a, _b;
let secret = this.options.secretOrKeyProvider
? this.options.secretOrKeyProvider(secretRequestType, token, options)
: (options === null || options === void 0 ? void 0 : options.secret) || this.options.secret || this.options[key];
: (options === null || options === void 0 ? void 0 : options.secret) ||
this.options.secret ||
(key === 'privateKey'
? ((_a = options) === null || _a === void 0 ? void 0 : _a.privateKey) || this.options.privateKey
: ((_b = options) === null || _b === void 0 ? void 0 : _b.publicKey) ||
this.options.publicKey) ||
this.options[key];
if (this.options.secretOrPrivateKey) {

@@ -59,0 +72,0 @@ this.logger.warn(`"secretOrPrivateKey" has been deprecated, please use the new explicit "secret" or use "secretOrKeyProvider" or "privateKey"/"publicKey" exclusively.`);

{
"name": "@nestjs/jwt",
"version": "7.1.0",
"version": "7.2.0",
"description": "Nest - modern, fast, powerful node.js web framework (@jwt)",

@@ -24,22 +24,22 @@ "author": "Kamil Mysliwiec",

"devDependencies": {
"@commitlint/cli": "9.0.1",
"@commitlint/config-angular": "9.0.1",
"jest": "26.1.0",
"ts-jest": "26.1.1",
"@commitlint/cli": "11.0.0",
"@commitlint/config-angular": "11.0.0",
"jest": "26.6.3",
"ts-jest": "26.4.3",
"reflect-metadata": "0.1.13",
"@nestjs/core": "7.3.2",
"@nestjs/testing": "7.3.2",
"@types/jest": "26.0.4",
"@typescript-eslint/eslint-plugin": "3.6.0",
"@typescript-eslint/parser": "3.6.0",
"eslint": "7.4.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-import": "2.22.0",
"@nestjs/common": "7.3.2",
"@nestjs/core": "7.5.1",
"@nestjs/testing": "7.5.1",
"@types/jest": "26.0.15",
"@typescript-eslint/eslint-plugin": "4.6.1",
"@typescript-eslint/parser": "4.6.1",
"eslint": "7.12.1",
"eslint-config-prettier": "6.15.0",
"eslint-plugin-import": "2.22.1",
"@nestjs/common": "7.5.1",
"@types/node": "7.10.9",
"husky": "4.2.5",
"lint-staged": "10.2.11",
"prettier": "2.0.5",
"release-it": "13.6.4",
"typescript": "3.9.6"
"husky": "4.3.0",
"lint-staged": "10.5.1",
"prettier": "2.1.2",
"release-it": "14.2.1",
"typescript": "4.0.5"
},

@@ -46,0 +46,0 @@ "dependencies": {

@@ -64,3 +64,3 @@ <p align="center">

JwtModule.register({
/* Secret has precedance over keys */
/* Secret has precedence over keys */
secret: 'hard!to-guess_secret',

@@ -74,3 +74,3 @@

/* Dynamic key provider has precedance over static secret or pub/private keys */
/* Dynamic key provider has precedence over static secret or pub/private keys */
secretOrKeyProvider: (

@@ -116,3 +116,3 @@ requestType: JwtSecretRequestType,

useFactory: async (configService: ConfigService) => ({
secret: configService.getString('SECRET'),
secret: configService.get<string>('SECRET'),
}),

@@ -160,3 +160,3 @@ inject: [ConfigService],

The sign method is an implementation of jsonwebtoken `.sign()`. Differing from jsonwebtoken it also allows an additional `secret` property on `options` to override the secret passed in from the module. It only overrides the `secret`, `publicKey` or `privateKey` though not a `secretOrKeyProvider`.
The sign method is an implementation of jsonwebtoken `.sign()`. Differing from jsonwebtoken it also allows an additional `secret`, `privateKey`, and `publicKey` properties on `options` to override options passed in from the module. It only overrides the `secret`, `publicKey` or `privateKey` though not a `secretOrKeyProvider`.

@@ -169,3 +169,3 @@ #### jwtService.signAsync(payload: string | Object | Buffer, options?: JwtSignOptions): Promise\<string\>

The verify method is an implementation of jsonwebtoken `.verify()`. Differing from jsonwebtoken it also allows an additional `secret` property on `options` to override the secret passed in from the module. It only overrides the `secret`, `publicKey` or `privateKey` though not a `secretOrKeyProvider`.
The verify method is an implementation of jsonwebtoken `.verify()`. Differing from jsonwebtoken it also allows an additional `secret`, `privateKey`, and `publicKey` properties on `options` to override options passed in from the module. It only overrides the `secret`, `publicKey` or `privateKey` though not a `secretOrKeyProvider`.

@@ -172,0 +172,0 @@ #### jwtService.verifyAsync\<T extends object = any>(token: string, options?: JwtVerifyOptions): Promise\<T\>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc