PURISTA API / Modules / @purista/infisical-secret-store / InfisicalClient
Class: InfisicalClient
@purista/infisical-secret-store.InfisicalClient
The internal http client to connect to the Infisical server.
Hierarchy
HttpClient
<HttpClientConfigCustom
>↳
InfisicalClient
Table of contents
Constructors
Properties
Methods
- delete
- encryptSecret
- execute
- get
- getSecret
- getServiceTokenData
- getTracer
- getUrlAndHeader
- patch
- post
- put
- removeSecret
- setBearerToken
- setSecret
- startActiveSpan
Constructors
constructor
• new InfisicalClient(conf
): InfisicalClient
Parameters
Name | Type | Description |
---|---|---|
conf | Object | - |
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 |
conf.basicAuth? | Object | Basic-Auth information |
conf.basicAuth.password | string | Basic-Auth password |
conf.basicAuth.username | string | Basic-Auth username |
conf.bearerToken | string | Auth-Bearer token |
conf.defaultHeaders? | Record <string , string > | Add your default headers here These headers will be part of every request. They can be overwritten per request option |
conf.defaultTimeout? | number | set global timeout for requests in ms Default ts 30000 |
conf.enableOpentelemetry? | boolean | enable Opentelemetry tracing. The client will be handled as own ressource. |
conf.isKeepAlive? | boolean | If set to false, the HTTP client will not reuse the same connection for multiple requests. Default is true. |
conf.logLevel? | LogLevelName | the loglevel if no logger instance is given |
conf.logger? | Logger | A logger instance |
conf.name? | string | Name of the client |
conf.spanProcessor? | SpanProcessor | Opentelemetry span processor |
conf.traceId? | string | Custom trace Id |
Returns
Overrides
Defined in
infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:16
Properties
auth
• Protected
auth: AuthCredentials
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:27
baseUrl
• baseUrl: URL
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:24
config
• config: Object
Type declaration
Name | Type | Description |
---|---|---|
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 ressource. |
isKeepAlive? | boolean | If set to false, the HTTP client will not reuse the same connection for multiple requests. Default is true. |
logLevel? | LogLevelName | the loglevel if no logger instance is given |
logger? | Logger | A logger instance |
name? | string | Name of the client |
spanProcessor? | SpanProcessor | Opentelemetry span processor |
traceId? | string | Custom trace Id |
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:22
logger
• logger: Logger
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:21
name
• name: string
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:20
projectKey
• Private
projectKey: string
= ''
Defined in
infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:14
serviceTokenSecret
• Private
serviceTokenSecret: string
Defined in
infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:12
spanProcessor
• spanProcessor: undefined
| SpanProcessor
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:25
timeout
• timeout: number
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:23
tokenData
• Private
tokenData: undefined
| TokenData
Defined in
infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:13
traceProvider
• traceProvider: NodeTracerProvider
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:26
Methods
delete
▸ delete<T
>(path
, options?
, payload?
): Promise
<T
>
DELETE request
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
path | string |
options? | HttpClientRequestOptions |
payload? | unknown |
Returns
Promise
<T
>
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:97
encryptSecret
▸ encryptSecret(secretKey
, secretValue
, secretComment?
): Object
Encrypt the given key, value and optional comment
Parameters
Name | Type | Default value |
---|---|---|
secretKey | string | undefined |
secretValue | string | undefined |
secretComment | string | '' |
Returns
Object
Name | Type |
---|---|
secretCommentCiphertext | string |
secretCommentIV | string |
secretCommentTag | string |
secretKeyCiphertext | string |
secretKeyIV | string |
secretKeyTag | string |
secretValueCiphertext | string |
secretValueIV | string |
secretValueTag | string |
Defined in
infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:33
execute
▸ execute(method
, path
, options?
, payload?
): Promise
<any
>
Helper method
Parameters
Name | Type |
---|---|
method | string |
path | string |
options? | HttpClientRequestOptions |
payload? | unknown |
Returns
Promise
<any
>
Throws
UnhandledError
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:62
get
▸ get<T
>(path
, options?
): Promise
<T
>
GET request
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
path | string |
options? | HttpClientRequestOptions |
Returns
Promise
<T
>
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:69
getSecret
▸ getSecret(name
): Promise
<undefined
| string
>
Get a single secret
Parameters
Name | Type |
---|---|
name | string |
Returns
Promise
<undefined
| string
>
Defined in
infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:93
getServiceTokenData
▸ getServiceTokenData(): Promise
<TokenData
>
Fetches the token data from the server for given access token
Returns
Promise
<TokenData
>
Defined in
infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:77
getTracer
▸ getTracer(): Tracer
Returns open telemetry tracer of this service
Returns
Tracer
Tracer
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:34
getUrlAndHeader
▸ getUrlAndHeader(path
, options?
): Object
Parameters
Name | Type |
---|---|
path | string |
options? | HttpClientRequestOptions |
Returns
Object
Name | Type |
---|---|
headers | Record <string , string > |
url | URL |
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:44
patch
▸ patch<T
>(path
, payload
, options?
): Promise
<T
>
PATCH request
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
path | string |
payload | unknown |
options? | HttpClientRequestOptions |
Returns
Promise
<T
>
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:90
post
▸ post<T
>(path
, payload
, options?
): Promise
<T
>
POST request
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
path | string |
payload | unknown |
options? | HttpClientRequestOptions |
Returns
Promise
<T
>
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:76
put
▸ put<T
>(path
, payload
, options?
): Promise
<T
>
PUT request
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
path | string |
payload | unknown |
options? | HttpClientRequestOptions |
Returns
Promise
<T
>
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:83
removeSecret
▸ removeSecret(name
): Promise
<void
>
Remove a secret
Parameters
Name | Type |
---|---|
name | string |
Returns
Promise
<void
>
Defined in
infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:168
setBearerToken
▸ setBearerToken(token
): void
Set the bearer token for all following requests.
Parameters
Name | Type | Description |
---|---|---|
token | undefined | string | the bearer token |
Returns
void
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:52
setSecret
▸ setSecret(name
, value
): Promise
<void
>
Set a secret. It will first try to update and if the secret does not exist, it will create a new one
Parameters
Name | Type |
---|---|
name | string |
value | string |
Returns
Promise
<void
>
Defined in
infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts:133
startActiveSpan
▸ startActiveSpan<F
>(name
, opts
, context
, fn
): Promise
<F
>
Start a child span for opentelemetry tracking
Type parameters
Name |
---|
F |
Parameters
Name | Type | Description |
---|---|---|
name | string | name of span |
opts | SpanOptions | span options |
context | undefined | Context | optional context |
fn | (span : Span ) => Promise <F > | function to be executed within the span |
Returns
Promise
<F
>
return value of fn
Inherited from
Defined in
core/dist/commonjs/HttpClient/HttpClient.impl.d.ts:43