Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
var base64_url_decode = require('./base64_url_decode');
|
||||
|
||||
function InvalidTokenError(message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
InvalidTokenError.prototype = new Error();
|
||||
InvalidTokenError.prototype.name = 'InvalidTokenError';
|
||||
|
||||
module.exports = function (token,options) {
|
||||
if (typeof token !== 'string') {
|
||||
throw new InvalidTokenError('Invalid token specified');
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
var pos = options.header === true ? 0 : 1;
|
||||
try {
|
||||
return JSON.parse(base64_url_decode(token.split('.')[pos]));
|
||||
} catch (e) {
|
||||
throw new InvalidTokenError('Invalid token specified: ' + e.message);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.InvalidTokenError = InvalidTokenError;
|
||||
Reference in New Issue
Block a user