Files
probot/lib/github-app.js
Brandon Keepers e35028890a Improve GitHub logging (#351)
* 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
2017-11-27 10:18:58 -06:00

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'})
}
}