UNPKG

eal-sdk

Version:
96 lines (95 loc) 4.27 kB
/** * Copyright 2023 Coiin. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { CoiinEalCredentials } from '../credential-service/CoiinEalCredentials'; /** * @hidden * Get the path for the configuration file depending on the OS * @returns {string} coiin eal configuration file path * @example e.g.: "~/.coiin-eal/credentials" or "%LOCALAPPDATA%\coiin-eal\credentials" on Windows */ declare const getConfigFilePath: (injected?: any) => string; /** * @hidden * Get the endpoint for a coiin eal from environment variables * @returns {string} Coiin EAL enpdoint if found, empty string if not */ declare const getIdFromEnvVars: () => string; /** * @hidden * get the endpoint for a coiin eal from environment variables * @returns {string} Coiin EAL enpdoint if found, empty string if not */ declare const getEndpointFromEnvVars: () => string; /** * @hidden * get the credentials for a coiin eal from environment variables * @returns {CoiinEalCredentials} Coiin EAL enpdoint if found, false if not */ declare const getCredsFromEnvVars: () => any; /** * @hidden * get the default coiin eal ID from the configuration file * @returns {Promise<string>} coiin eal ID if found in file, empty string if not */ declare const getIdFromFile: (injected?: any) => Promise<string>; /** * @hidden * get the coiin eal endpoint from the configuration file * @returns {Promise<string>} coiin eal endpoint if found in file, empty string if not */ declare const getEndpointFromFile: (coiinEalId: string, injected?: any) => Promise<string>; /** * @hidden * get the coiin eal credentials from the configuration file * @returns {Promise<CoiinEalCredentials>} coiin eal credentials if found in file, false if not */ declare const getCredsFromFile: (coiinEalId: string, injected?: any) => Promise<any>; /** * @hidden * use a remote service to fetch the endpoint of a coiin eal by id * @param {string} coiinEalId coiinEalId to request endpoint for * @returns {Promise<string>} the endpoint of the coiin eal * @throws {FailureByDesign<NOT_FOUND>} if unable to contact remote service or not found */ declare const getEndpointFromRemote: (coiinEalId: string, injected?: any) => Promise<string>; /** * @hidden * get credentials for a coiin eal from the standard location for a smart contract * @returns {Promise<CoiinEalCredentials>} coiin eal credentials if found, false if not */ declare const getCredsAsSmartContract: (injected?: any) => Promise<any>; /** * Get the default configured coiinEalId from environment/config file * @returns {Promise<string>} * @throws {FailureByDesign<NOT_FOUND>} */ declare const getCoiinEalId: (injected?: any) => Promise<string>; /** * @hidden * Get the endpoint for a coiin eal. First checks environment, then configuration files, then a remote service * @param {string} coiinEalId coiinEalId to get endpoint for * @returns {Promise<string>} Endpoint of the coiin eal * @throws {FailureByDesign<NOT_FOUND>} */ declare const getCoiinEalEndpoint: (coiinEalId: string, injected?: any) => Promise<string>; /** * Get the credentials for a coiin eal. First checks environment, then configuration files, then a smart contract location * @param {string} coiinEalId coiinEalId to get credentials for * @returns {CoiinEalCredentials} Credentials of the coiin eal * @throws {FailureByDesign<NOT_FOUND>} */ declare const getCoiinEalCredentials: (coiinEalId: string, injected?: any) => Promise<CoiinEalCredentials>; export { getCoiinEalId, getCoiinEalEndpoint, getCoiinEalCredentials, getConfigFilePath, getIdFromEnvVars, getEndpointFromEnvVars, getCredsFromEnvVars, getIdFromFile, getEndpointFromFile, getCredsFromFile, getEndpointFromRemote, getCredsAsSmartContract, };