mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2026-08-19 13:13:28 +08:00
Merge branch 'master' into feature/steam-sharedfiles
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user