title: Is there a native method in nestjs to decode JWT?
body: <p>In nestjs I create JWT (tokens) by creating a payload object and signing it. Something like this:</p>
  <pre><code>    const jwtPayload: JwtPayload = 
      {
        iss:                issuer,
        sub:                info,
        aud:                audience,
     // exp:                - populated by fn: this.jwtService.sign(payload),
     // iat:                - populated by fn: this.jwtService.sign(payload),
        jti:                'XXXX1234' 
      }
  
  const signedJwtAccessToken: string = this.jwtService.sign(jwtPayload); 
  </code></pre>
  <p>Nest encodes the jwtPayload into a string.</p>
  <p>For cleanup work I would like to know when exactly the JWT expires. This is automatically encoded into the '<em>signedJwtAccessToken</em>' - property <em>.exp</em> - by the .sign() function.</p>
  <p>To access it right after the signing, it needs to be decoded.</p>
  <p>What would be the simplest way to decode the <em>signedJwtAccessToken</em> in the same method right after it has been signed ???</p>
  <p>Note:</p>
  <p>When the JWT comes back from client, nestjs decodes it when accessing the fn: validate(), but I want to decode right after signing it - before sending the response to client, something like:</p>
  <pre><code>                            // signing - encoding
  const signedJwtAccessToken: string = this.jwtService.sign(jwtPayload);
  
                              // decoding
  const decodedJwtAccessToken: string = decodeJwt(signedJwtAccessToken);
  
                              // parsing back to an object
  const updatedJwtPayload: JwtPayload  = JSON.parse(decodedJwtAccessToken);
  
                              // reading property of .exp
  const expires = updatedJwtPayload.exp;
  </code></pre>