mirror of
https://github.com/zhigang1992/probot.git
synced 2026-06-13 09:25:20 +08:00
15 lines
382 B
JavaScript
15 lines
382 B
JavaScript
const jwt = require('jsonwebtoken')
|
|
|
|
module.exports = function ({id, cert}) {
|
|
return function () {
|
|
const payload = {
|
|
iat: Math.floor(new Date() / 1000), // Issued at time
|
|
exp: Math.floor(new Date() / 1000) + 60, // JWT expiration time
|
|
iss: id // GitHub App ID
|
|
}
|
|
|
|
// Sign with RSA SHA256
|
|
return jwt.sign(payload, cert, {algorithm: 'RS256'})
|
|
}
|
|
}
|