UNPKG

@stratosphere-network/wallet

Version:

Wallet module for StratoSphere SDK

49 lines 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseService = void 0; class BaseService { httpClient; bearerToken; constructor(httpClient) { this.httpClient = httpClient; } /** * Set the bearer token for user authentication */ setBearerToken(token) { this.bearerToken = token; } /** * Clear the bearer token */ clearBearerToken() { this.bearerToken = undefined; } /** * Get the current bearer token */ getBearerToken() { return this.bearerToken; } /** * Make an authenticated request with bearer token */ async authenticatedRequest(config) { const headers = { ...config.headers }; if (this.bearerToken) { headers.Authorization = `Bearer ${this.bearerToken}`; } return this.httpClient.request({ ...config, headers, }); } /** * Make a public request (no authentication required) */ async publicRequest(config) { return this.httpClient.request(config); } } exports.BaseService = BaseService; //# sourceMappingURL=base-service.js.map