Socket
Socket
Sign inDemoInstall

fast-jwt

Package Overview
Dependencies
Maintainers
5
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.2 to 3.3.3

2

package.json
{
"name": "fast-jwt",
"version": "3.3.2",
"version": "3.3.3",
"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( RSA)? PUBLIC KEY-----/
const publicKeyPemMatcher = /^-----BEGIN(?: (RSA))? PUBLIC KEY-----/
const publicKeyX509CertMatcher = '-----BEGIN CERTIFICATE-----'

@@ -159,5 +159,10 @@ const privateKeysCache = new Cache(1000)

function performDetectPublicKeyAlgorithms(key) {
const publicKeyPemMatch = key.match(publicKeyPemMatcher)
if (key.match(privateKeyPemMatcher)) {
throw new TokenError(TokenError.codes.invalidKey, 'Private keys are not supported for verifying.')
} else if (!key.match(publicKeyPemMatcher) && !key.includes(publicKeyX509CertMatcher)) {
} else if (publicKeyPemMatch && publicKeyPemMatch[1] === 'RSA') {
// pkcs1 format - Can only be RSA key
return rsaAlgorithms
} else if (!publicKeyPemMatch && !key.includes(publicKeyX509CertMatcher)) {
// Not a PEM, assume a plain secret

@@ -164,0 +169,0 @@ return hsAlgorithms

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