panva / paseto

PASETO (Platform-Agnostic SEcurity TOkens) for Node.js with no dependencies
MIT License
428 stars 26 forks source link

Fails to verify with `complete: true` option if there is no footer. #33

Closed ksmithut closed 1 year ago

ksmithut commented 1 year ago

What happened?

When trying to extract the footer information from a token that has no footer, the verify call returns a rejected promise.

Version

3.1.0

Node.js Version

v18.9.0

Code to reproduce

import { V4 } from 'paseto'

const key = await V4.generateKey('public', { format: 'paserk' })
const token = await V4.sign({}, key.secretKey)
// This next line fails
const payload = await V4.verify(token, key.publicKey, {
  complete: true
})

Required

panva commented 1 year ago

@ksmithut thank you for this report. v3.1.1 was released with a fix.