Merge pull request #3437 from overleaf/em-project-specific-blobs

Use per-project v1 history blob URLs for git-bridge

GitOrigin-RevId: b68ee2129ceb57f4b7f68262c5bcbadc0952b56f
This commit is contained in:
Eric Mc Sween
2020-12-11 03:05:03 +00:00
committed by Copybot
parent ba2a89c841
commit 55bf16c06d
4 changed files with 28 additions and 0 deletions
@@ -0,0 +1,22 @@
const { callbackify, promisify } = require('util')
const JWT = require('jsonwebtoken')
const Settings = require('settings-sharelatex')
const jwtSign = promisify(JWT.sign)
async function sign(payload, options = {}) {
const key = Settings.jwt.key
const algorithm = Settings.jwt.algorithm
if (!key || !algorithm) {
throw new Error('missing JWT configuration')
}
const token = await jwtSign(payload, key, { ...options, algorithm })
return token
}
module.exports = {
sign: callbackify(sign),
promises: {
sign
}
}