Skip to content

@purista/infisical-secret-store v2.0.5


PURISTA API / @purista/infisical-secret-store / InfisicalClient

Class: InfisicalClient

Defined in: infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:11

The internal http client to connect to the Infisical server.

Extends

Constructors

new InfisicalClient()

new InfisicalClient(conf): InfisicalClient

Defined in: infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:16

Parameters

conf
baseUrl

string

the base url to be used

Example

typescript
const config = {
  baseUrl: 'http://localhost/api`
}
// each request will be below http://localhost/api
// get('v1/orders') will call http://localhost/api/v1/orders
basicAuth?

{ password: string; username: string; }

Basic-Auth information

basicAuth.password

string

Basic-Auth password

basicAuth.username

string

Basic-Auth username

bearerToken

string

Auth-Bearer token

defaultHeaders?

Record<string, string>

Add your default headers here These headers will be part of every request. They can be overwritten per request option

defaultTimeout?

number

set global timeout for requests in ms

Default

ts
30000
enableOpentelemetry?

boolean

enable Opentelemetry tracing. The client will be handled as own resource.

isKeepAlive?

boolean

If set to false, the HTTP client will not reuse the same connection for multiple requests. Default is true.

logger?

Logger

A logger instance

logLevel?

LogLevelName

the loglevel if no logger instance is given

name?

string

Name of the client

spanProcessor?

SpanProcessor

Opentelemetry span processor

traceId?

string

Custom trace Id

Returns

InfisicalClient

Overrides

HttpClient.constructor

Properties

auth

protected auth: AuthCredentials

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:27

Inherited from

HttpClient.auth


baseUrl

baseUrl: URL

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:24

Inherited from

HttpClient.baseUrl


config

config: object

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:22

baseUrl

baseUrl: string

the base url to be used

Example
typescript
const config = {
  baseUrl: 'http://localhost/api`
}
// each request will be below http://localhost/api
// get('v1/orders') will call http://localhost/api/v1/orders

basicAuth?

optional basicAuth: object

Basic-Auth information

basicAuth.password

basicAuth.password: string

Basic-Auth password

basicAuth.username

basicAuth.username: string

Basic-Auth username

bearerToken?

optional bearerToken: string

Auth-Bearer token

defaultHeaders?

optional defaultHeaders: Record<string, string>

Add your default headers here These headers will be part of every request. They can be overwritten per request option

defaultTimeout?

optional defaultTimeout: number

set global timeout for requests in ms

Default
ts
30000

enableOpentelemetry?

optional enableOpentelemetry: boolean

enable Opentelemetry tracing. The client will be handled as own resource.

isKeepAlive?

optional isKeepAlive: boolean

If set to false, the HTTP client will not reuse the same connection for multiple requests. Default is true.

logger?

optional logger: Logger

A logger instance

logLevel?

optional logLevel: LogLevelName

the loglevel if no logger instance is given

name?

optional name: string

Name of the client

spanProcessor?

optional spanProcessor: SpanProcessor

Opentelemetry span processor

traceId?

optional traceId: string

Custom trace Id

Inherited from

HttpClient.config


logger

logger: Logger

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:21

Inherited from

HttpClient.logger


name

name: string

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:20

Inherited from

HttpClient.name


spanProcessor

spanProcessor: undefined | SpanProcessor

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:25

Inherited from

HttpClient.spanProcessor


timeout

timeout: number

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:23

Inherited from

HttpClient.timeout


traceProvider

traceProvider: NodeTracerProvider

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:26

Inherited from

HttpClient.traceProvider

Methods

delete()

delete<T>(path, options?, payload?): Promise<T>

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:97

DELETE request

Type Parameters

T

Parameters

path

string

options?

HttpClientRequestOptions

payload?

unknown

Returns

Promise<T>

Inherited from

HttpClient.delete


execute()

protected execute(method, path, options?, payload?): Promise<any>

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:62

Helper method

Parameters

method

string

path

string

options?

HttpClientRequestOptions

payload?

unknown

Returns

Promise<any>

Throws

UnhandledError

Inherited from

HttpClient.execute


get()

get<T>(path, options?): Promise<T>

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:69

GET request

Type Parameters

T

Parameters

path

string

options?

HttpClientRequestOptions

Returns

Promise<T>

Inherited from

HttpClient.get


getSecret()

getSecret(name): Promise<undefined | string>

Defined in: infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:93

Get a single secret

Parameters

name

string

Returns

Promise<undefined | string>


getServiceTokenData()

getServiceTokenData(): Promise<TokenData>

Defined in: infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:77

Fetches the token data from the server for given access token

Returns

Promise<TokenData>


getTracer()

getTracer(): Tracer

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:34

Returns open telemetry tracer of this service

Returns

Tracer

Tracer

Inherited from

HttpClient.getTracer


getUrlAndHeader()

protected getUrlAndHeader(path, options?): object

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:44

Parameters

path

string

options?

HttpClientRequestOptions

Returns

object

headers

headers: Record<string, string>

url

url: URL

Inherited from

HttpClient.getUrlAndHeader


patch()

patch<T>(path, payload, options?): Promise<T>

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:90

PATCH request

Type Parameters

T

Parameters

path

string

payload

unknown

options?

HttpClientRequestOptions

Returns

Promise<T>

Inherited from

HttpClient.patch


post()

post<T>(path, payload, options?): Promise<T>

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:76

POST request

Type Parameters

T

Parameters

path

string

payload

unknown

options?

HttpClientRequestOptions

Returns

Promise<T>

Inherited from

HttpClient.post


put()

put<T>(path, payload, options?): Promise<T>

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:83

PUT request

Type Parameters

T

Parameters

path

string

payload

unknown

options?

HttpClientRequestOptions

Returns

Promise<T>

Inherited from

HttpClient.put


removeSecret()

removeSecret(name): Promise<void>

Defined in: infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:168

Remove a secret

Parameters

name

string

Returns

Promise<void>


setBearerToken()

setBearerToken(token): void

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:52

Set the bearer token for all following requests.

Parameters

token

the bearer token

undefined | string

Returns

void

Inherited from

HttpClient.setBearerToken


setSecret()

setSecret(name, value): Promise<void>

Defined in: infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:133

Set a secret. It will first try to update and if the secret does not exist, it will create a new one

Parameters

name

string

value

string

Returns

Promise<void>


startActiveSpan()

startActiveSpan<F>(name, opts, context, fn): Promise<F>

Defined in: core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:43

Start a child span for opentelemetry tracking

Type Parameters

F

Parameters

name

string

name of span

opts

SpanOptions

span options

context

optional context

undefined | Context

fn

(span) => Promise<F>

function to be executed within the span

Returns

Promise<F>

return value of fn

Inherited from

HttpClient.startActiveSpan