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:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user