There's the backpack's [middleware.utils.createSecureToken()](https://github.com/mozilla/openbadges/blob/development/middleware.js#L192), if you like.