mirror of
https://github.com/hanzoai/node-jwks-rsa.git
synced 2026-09-24 17:00:54 +00:00
Compiling is no longer needed. Node 10+ supports all the features used in this library.
15 lines
401 B
JavaScript
15 lines
401 B
JavaScript
const jwt = require('jsonwebtoken');
|
|
|
|
function createToken(key, kid, payload) {
|
|
return jwt.sign(payload, key, { noTimestamp: true, algorithm: 'RS256', header: { alg: 'RS256', kid } });
|
|
}
|
|
|
|
function createSymmetricToken(key, payload) {
|
|
return jwt.sign(payload, key, { noTimestamp: true, algorithm: 'HS256', header: { alg: 'HS256' } });
|
|
}
|
|
|
|
module.exports = {
|
|
createToken,
|
|
createSymmetricToken
|
|
};
|