jwt-web-token-hs256
v1.0.2
Published
```js import webToken from 'jwt-web-token-hs256';
Downloads
13
Readme
使用方法
import webToken from 'jwt-web-token-hs256';
/**
* @param payload 负载(必填)数据格式如下
* {
* iss (issuer):签发人
* sub (subject):主题
* aud (audience):受众
* jti (JWT ID):编号
* exp:过期时间(分钟)
* }
* @param secret 密钥 (必填)
*
* @returns {String} 返回 token
*/
const payload = {
iss: '9b8f-0c15-4a10-a456-3a8e',
sub: '1234567890',
};
const secret = '323c-c6b7-40a1-bb15-8c7c';
const token = webToken(payload, secret);
console.log('--- my token -->', token);