Motty
原生桌面 SSH 工作台:终端、SFTP/SCP、端口转发、VNC 与 RDP 远程桌面、AI 助手都在一个窗口里。Go 编写,没有 Electron,空闲时保持安静。免费开源,支持 macOS、Windows 和 Linux。
翻譯準備中
JWT(JSON Web Token) encode and decode module for node.js
翻譯準備中
開發工具JavaScriptGitHub @hokaccha自行安裝營運者未確認
試用過了嗎? 點一下就好,不需要登入。
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
製作者的介紹僅有上面的一句話。 更多詳情請閱讀儲存庫 README。 儲存庫 README ↗
正在載入完整 README。
檢視完整 README ↗[!WARNING] This project is no longer maintained. No further updates or security fixes will be provided. Please migrate to an actively maintained library such as jose or jsonwebtoken.
If you continue to use jwt-simple, always pass the expected algorithm to
jwt.decode(e.g.jwt.decode(token, key, false, 'RS256')) instead of relying on thealgheader of the token.
JWT(JSON Web Token) encode and decode module for node.js.
$ npm install jwt-simple
let jwt = require('jwt-simple');
let payload = { foo: 'bar' };
let secret = 'xxx';
// HS256 secrets are typically 128-bit random strings, for example hex-encoded:
// let secret = Buffer.from('fe1a1915a379f3be5394b64d14794932', 'hex')
// encode
let token = jwt.encode(payload, secret);
// decode
let decoded = jwt.decode(token, secret);
console.log(decoded); //=> { foo: 'bar' }
/*
* jwt.decode(token, key, noVerify, algorithm)
*/
// decode, by default the signature of the token is verified
let decoded = jwt.decode(token, secret);
console.log(decoded); //=> { foo: 'bar' }
// decode without verify the signature of the token,
// be sure to KNOW WHAT ARE YOU DOING because not verify the signature
// means you can't be sure that someone hasn't modified the token payload
let decoded = jwt.decode(token, secret, true);
console.log(decoded); //=> { foo: 'bar' }
// decode with a specific algorithm (not using the algorithm described in the token payload)
let decoded = jwt.decode(token, secret, false, 'HS256');
console.log(decoded); //=> { foo: 'bar' }
By default the algorithm to encode is HS256.
The supported algorithms for encoding and decoding are HS256, HS384, HS512 and RS256.
// encode using HS512
jwt.encode(payload, secret, 'HS512')