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 选择多少位?

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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)