Vonage / vonage-node-sdk

Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Apache License 2.0
375 stars 178 forks source link

fix(jwt): Fix ttl in claims #846

Closed dragonmantank closed 11 months ago

dragonmantank commented 11 months ago

Description

When passing in a ttl to generate a new token, we accidentally leave the ttl parameter in the claims. This is causing a problem with tokens being rejected. The exp is calculated properly, but we just leave the additional ttl claim there due to object unpacking.

Motivation and Context

This breaks JWT validation

Testing Details

Added a unit test

Example Output or Screenshots (if appropriate)

Types of changes

Checklist

codecov-commenter commented 11 months ago

Codecov Report

Merging #846 (9f5fc1a) into 3.x (8760b0f) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              3.x     #846      +/-   ##
==========================================
+ Coverage   83.42%   83.44%   +0.02%     
==========================================
  Files         119      119              
  Lines        1484     1486       +2     
  Branches      282      283       +1     
==========================================
+ Hits         1238     1240       +2     
  Misses        245      245              
  Partials        1        1              
Files Changed Coverage Δ
packages/jwt/lib/jwt.ts 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more