Tidied up JWT tests

This commit is contained in:
n1474335 2021-02-09 14:23:02 +00:00
parent f4784d49e7
commit 24548e3a48
2 changed files with 5 additions and 5 deletions

View file

@ -42,9 +42,11 @@ class JWTVerify extends Operation {
*/
run(input, args) {
const [key] = args;
const algos = JWT_ALGORITHMS;
algos[algos.indexOf("None")] = "none";
try {
const verified = jwt.verify(input, key, { algorithms: JWT_ALGORITHMS });
const verified = jwt.verify(input, key, { algorithms: algos });
if (Object.prototype.hasOwnProperty.call(verified, "name") && verified.name === "JsonWebTokenError") {
throw new OperationError(verified.message);