JWT 令牌公钥/私钥对生成器

时间:2021-03-20 05:21:26

标签: jwt express-jwt

在我的 Nodejs 12.16.x 应用程序中,JWT 令牌生成如下:

const token = jwt.sign(
    {
      uid: this.id,
      did: this.device_id,
    },
    process.env.jwtPrivateKey,  //<<==here is the private key
    {
      expiresIn: (parseInt(process.env.jwt_token_expire_days) * 24).toString() + 'h',
      algorithm: 'HS256'  //<<==here is the algorithm
    }
  );

我可以用来为 JWT 令牌生成公钥/私钥的公钥/私钥生成器是什么?有人推荐ssh-keygen。我应该为算法 HS256 选择多少位?

另外,如果已经给定了私钥,如何找到与其关联的公钥?

0 个答案:

没有答案