diff --git a/Boop/Boop/scripts/JWTDecode.js b/Boop/Boop/scripts/JWTDecode.js index 0208a5a3..b558b7a3 100644 --- a/Boop/Boop/scripts/JWTDecode.js +++ b/Boop/Boop/scripts/JWTDecode.js @@ -10,18 +10,18 @@ **/ -const { base64decode } = require('@boop/base64') +const { decode } = require('@boop/base64'); function main(input) { - var t = input.text - var jwtParts = t.split(".") - if(jwtParts.length != 3) { - input.postError("Invalid Token") - return + var t = input.text; + var jwtParts = t.split("."); + if (jwtParts.length != 3) { + input.postError("Invalid Token"); + return; } - var header = base64decode(jwtParts[0]); - var payload = base64decode(jwtParts[1]); + var header = decode(jwtParts[0]); + var payload = decode(jwtParts[1]); var signature = jwtParts[2]; try { @@ -29,11 +29,11 @@ function main(input) { "header": JSON.parse(header), "payload": JSON.parse(payload), "signature": signature - } + }; // Prettyprint the JSOM input.text = JSON.stringify(fullJson, null, 2); } catch(err) { - input.postError("Error while parsing JSON") + input.postError("Error while parsing JSON"); } }