mirror of
https://github.com/zhigang1992/probot.git
synced 2026-06-14 18:08:58 +08:00
* Extract github client extensions into module * Add logging to extended GitHub client * Update test to check output * Inline GitHub App methods * Update node-github links * Remove src, which does not show up with LOG_FORMAT=simple anyway * Fix lint errors
15 lines
423 B
JavaScript
15 lines
423 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'})
|
|
}
|
|
}
|