Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-jwt

Package Overview
Dependencies
Maintainers
7
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-jwt - npm Package Compare versions

Comparing version 3.3.1 to 3.3.2

2

package.json
{
"name": "fast-jwt",
"version": "3.3.1",
"version": "3.3.2",
"description": "Fast JSON Web Token implementation",

@@ -5,0 +5,0 @@ "author": "NearForm Ltd",

@@ -29,3 +29,3 @@ 'use strict'

const privateKeyPemMatcher = /^-----BEGIN(?: (RSA|EC|ENCRYPTED))? PRIVATE KEY-----/
const publicKeyPemMatcher = '-----BEGIN PUBLIC KEY-----'
const publicKeyPemMatcher = /^-----BEGIN( RSA)? PUBLIC KEY-----/
const publicKeyX509CertMatcher = '-----BEGIN CERTIFICATE-----'

@@ -48,3 +48,3 @@ const privateKeysCache = new Cache(1000)

if (!useNewCrypto) {
directSign = function(alg, data, options) {
directSign = function (alg, data, options) {
if (typeof alg === 'undefined') {

@@ -60,3 +60,3 @@ throw new TokenError(TokenError.codes.signError, 'EdDSA algorithms are not supported by your Node.js version.')

const PrivateKey = asn.define('PrivateKey', function() {
const PrivateKey = asn.define('PrivateKey', function () {
this.seq().obj(

@@ -75,3 +75,3 @@ this.key('version').int(),

const PublicKey = asn.define('PublicKey', function() {
const PublicKey = asn.define('PublicKey', function () {
this.seq().obj(

@@ -89,3 +89,3 @@ this.key('algorithm')

const ECPrivateKey = asn.define('ECPrivateKey', function() {
const ECPrivateKey = asn.define('ECPrivateKey', function () {
this.seq().obj(

@@ -111,3 +111,3 @@ this.key('version').int(),

function performDetectPrivateKeyAlgorithm(key) {
if (key.includes(publicKeyPemMatcher) || key.includes(publicKeyX509CertMatcher)) {
if (key.match(publicKeyPemMatcher) || key.includes(publicKeyX509CertMatcher)) {
throw new TokenError(TokenError.codes.invalidKey, 'Public keys are not supported for signing.')

@@ -166,3 +166,3 @@ }

throw new TokenError(TokenError.codes.invalidKey, 'Private keys are not supported for verifying.')
} else if (!key.includes(publicKeyPemMatcher) && !key.includes(publicKeyX509CertMatcher)) {
} else if (!key.match(publicKeyPemMatcher) && !key.includes(publicKeyX509CertMatcher)) {
// Not a PEM, assume a plain secret

@@ -236,3 +236,2 @@ return hsAlgorithms

}
// Check cache first

@@ -254,3 +253,2 @@ const [cached, error] = publicKeysCache.get(key) || []

}
return cacheSet(publicKeysCache, key, performDetectPublicKeyAlgorithms(key))

@@ -257,0 +255,0 @@ } catch (e) {

@@ -35,2 +35,3 @@ import 'node'

| 'FAST_JWT_VERIFY_ERROR'
| 'FAST_JWT_MISSING_REQUIRED_CLAIM'
| 'FAST_JWT_MISSING_SIGNATURE'

@@ -56,2 +57,3 @@

verifyError: 'FAST_JWT_VERIFY_ERROR'
missingRequiredClaim: 'FAST_JWT_MISSING_REQUIRED_CLAIM'
missingSignature: 'FAST_JWT_MISSING_SIGNATURE'

@@ -69,3 +71,3 @@ }

header: { [key: string]: any },
payload: string,
payload: any,
signature: string

@@ -72,0 +74,0 @@ }

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