Skip to content

Type check the secretOrPublicKey arguments more strictly. #595

Open
@amir-bio

Description

@amir-bio

I ran into a bug which was quite puzzling at first. It turned out my secretOrPublicKey was a promise (not any of String, Buffer, function types which are supported), however, I was getting an invalid algorithm error. (The error was also not documented, see #594)

For the verify function, I believe adding more typeof checks here https://github.com/auth0/node-jsonwebtoken/blob/master/verify.js#L87 should be sufficient but I'm not certain.

Additional validation checks on the arguments would everyone greatly with debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions