UNPKG

esiil

Version:

Minimalist library for EVE Online's ESI

27 lines 1.18 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports._loadCcpJwt = exports._buildRequestURL = void 0; const defaults_1 = __importDefault(require("../../defaults")); const Fetchd_1 = require("../../libs/Fetchd"); function _buildRequestURL(bundle) { if (bundle.state.includes('&')) console.error(`Request URL state: Must not contain '&' symbol. Sanitizing...`); const theState = bundle.state.replace(/&/g, '') || 'default'; return `${defaults_1.default.oauthURL}/authorize/?` + [ `response_type=code`, `redirect_uri=${encodeURIComponent(bundle.callbackURL)}`, `client_id=${bundle.clientID}`, `scope=${encodeURIComponent(bundle.scopes.join(' '))}`, `state=${theState}` ].join('&'); } exports._buildRequestURL = _buildRequestURL; async function _loadCcpJwt() { const resp = await (0, Fetchd_1._jwtGet)(); return resp.body.keys.filter((key) => key.alg == 'RS256')[0]; } exports._loadCcpJwt = _loadCcpJwt; //# sourceMappingURL=coreHelper.js.map