UNPKG

tickethead-sdk

Version:

SDK for the Tickethead API

43 lines 1.69 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiKeyCredentials = void 0; const credential_1 = require("./credential"); /** * This class is used to authenticate with an api key. * This method is currently only used on the NFT service. * Be aware that, consequently, it will not work on other services. */ class ApiKeyCredentials { constructor(apiKey) { this.type = credential_1.CredentialType.ApiKey; this.jwt = { token: apiKey }; } isRefreshable() { return false; } getToken() { return this.jwt; } authorize(_authService) { return __awaiter(this, void 0, void 0, function* () { return this.jwt; }); } refreshToken() { return __awaiter(this, void 0, void 0, function* () { // You can't refresh an api key return this.jwt; }); } } exports.ApiKeyCredentials = ApiKeyCredentials; //# sourceMappingURL=api-key-credentials.js.map