set()

in lib/token.js [82:105]


    set(token) {
      this.raw = token;
      this.errors = [];
      let details;
      try {
         details = decodeToken(this.raw);
      } catch (e) { 
         console.log('JWS Decode Fail', e);
         return false; 
      }      
      if (details && typeof details === 'object') {
         this.header = details.header;
         this.signature = details.signature;
         if (details.payload && typeof details.payload === 'object') {
            this.payload = details.payload;
            this.user = this.payload.sub;
            const exp = Number(this.payload.exp);
            if (!isNaN(exp)) {
               this.expires = exp < 946728000000 ? exp*1000 : exp;
            }
         }
      }
      return this;
    }