Merge branch 'master' into feature/steam-sharedfiles

This commit is contained in:
3urobeat
2023-06-15 09:17:35 +00:00
committed by GitHub
7 changed files with 266 additions and 154 deletions

View File

@@ -57,6 +57,18 @@ exports.eresultError = function(eresult) {
return err;
};
exports.decodeJwt = function(jwt) {
let parts = jwt.split('.');
if (parts.length != 3) {
throw new Error('Invalid JWT');
}
let standardBase64 = parts[1].replace(/-/g, '+')
.replace(/_/g, '/');
return JSON.parse(Buffer.from(standardBase64, 'base64').toString('utf8'));
};
/**
* Resolves a Steam profile URL to get steamID64 and vanityURL
* @param {String} url - Full steamcommunity profile URL or only the vanity part.