UNPKG

tickethead-sdk

Version:

SDK for the Tickethead API

29 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CredentialFactory = void 0; const __1 = require(".."); const api_key_credentials_1 = require("./api-key-credentials"); class CredentialFactory { static build(data) { switch (data.type) { case __1.CredentialType.Password: return new __1.PasswordCredentials(data.credentials); case __1.CredentialType.Wallet: return new __1.WalletCredentials(data.keyPair); case __1.CredentialType.Service: return new __1.ServiceCredentials(data.credentials); case __1.CredentialType.ApiKey: return new api_key_credentials_1.ApiKeyCredentials(data.jwt.token); case __1.CredentialType.Impersonate: { const creds = data; return new __1.ImpersonateCredentials(creds.impersonatorJwt, creds.impersonatedId); } case __1.CredentialType.Guest: case __1.CredentialType.Jwt: default: return new __1.JwtCredentials(data.jwt); } } } exports.CredentialFactory = CredentialFactory; //# sourceMappingURL=credential-factory.js.map