请教大神解答,node中的ejwt模块是做什么的,有没有网址可以详细解答的?
发布于 6 年前 作者 liujinjun2018 2161 次浏览 来自 问答

QQ图片20180301114708.png

请大神解惑!!

2 回复

翻了下包的代码就是在 jwt 上再加一层签名…

function() sign{
 //...
 token = jwt.sign(tokendata,this.sign_key, {
    expiresIn: expires,
    algorithm: this.algorithm
  })

  //Encrypt the token
  cipher = crypto.createCipher('aes192', this.encryption_key);
  encrypted_token = cipher.update(token, 'utf8', 'base64');
  encrypted_token += cipher.final('base64');

  return encrypted_token;
}

什么是 jwt 可以参看这个 jwt.io

@hyj1991 明白了 谢谢

回到顶部