tuiHoneyPot

front and back end of my TUI honeypot
Log | Files | Refs | README

jwt.js (424B)


      1 
      2 function decodeJwt(token) {
      3     if (token == null) {
      4         return;
      5     }
      6 
      7     const res = [];
      8     const splitToken = token.split(".");
      9 
     10     // We only want the first two parts of the token decoded
     11     res.push(JSON.parse(atob(splitToken[0])));
     12     res.push(JSON.parse(atob(splitToken[1])));
     13 
     14     return res;
     15 }
     16 
     17 function getJwtBody(token) {
     18     if (token == null) {
     19         return;
     20     }
     21 
     22     return decodeJwt(token)[1];
     23 }