UNPKG

insomnia-plugin-valorant

Version:
36 lines 1.2 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRegion = void 0; const node_fetch_1 = __importDefault(require("node-fetch")); const regionToShardMap = new Map([ ['na', 'na'], ['latam', 'na'], ['br', 'na'], ['eu', 'eu'], ['ap', 'ap'], ['kr', 'kr'] ]); /** * Get the region and shard from a token and entitlement * @param token The auth token * @param idToken The ID token */ async function getRegion(token, idToken) { const region = (await (await (0, node_fetch_1.default)('https://riot-geo.pas.si.riotgames.com/pas/v1/product/valorant', { method: 'PUT', body: JSON.stringify({ id_token: idToken }), headers: { 'Authorization': `Bearer ${token}`, 'User-Agent': '' } })).json())['affinities']['live']; const shard = regionToShardMap.get(region); if (shard === undefined) throw new Error(`Unknown region: ${region}`); return { region, shard }; } exports.getRegion = getRegion; //# sourceMappingURL=get-region.js.map