Interface: IMTLSClient

This client makes use of the LP mTLS Service and will perform calls to domains using the configured certificates. For communication with the LP mTLS service you will need OAuth2 App Installation with the right permissons mtls.external.

Please make sure you performed the necessary onboarding and configuration of domain <=> cert mappings before attempting to use the client.

Example OAuth2 App Installation

{
  "client_name": "PLACEHOLDER",
  "description": "PLACEHOLDER",
  "grant_types": [
    "client_credentials"
  ],
  "scope": "mtls.external"
}

Table of contents

Methods

Methods

get

get(url, headers?, body?, options?): Promise<LPMtlsResponse>

Performs a Get Call via the LP mTLS Service. It handles setting the correct headers and using the client credentials to retrieve an bearer token which is used for authentication. Any none 2xx/3xx status code will be thrown as MTLSError.

Parameters

Name Type Description
url string  
headers? Header  
body? any  
options? LPMtlsOptions Request specific options

Returns

Promise<LPMtlsResponse>


post

post(url, headers?, body?, options?): Promise<LPMtlsResponse>

Performs a Post Call via the LP mTLS Service. It handles setting the correct headers and using the client credentials to retrieve an bearer token which is used for authentication. Any none 2xx/3xx status code will be thrown as MTLSError.

Parameters

Name Type Description
url string  
headers? Header  
body? any  
options? LPMtlsOptions Request specific options

Returns

Promise<LPMtlsResponse>

Interface: LPMtlsResponse

Properties:

  • headers: [key: string]: string
  • statusCode: number
  • Optional body: unknown

Interface: LPMtlsOptions

Properties:

  • Optional json: boolean

Set this flag to true, to automatically stringify body + set correct content header. And parse response to json.

  • Optional timeout: number

Time in ms until request should timeout. Please be aware that a mTLS call takes longer then regular http calls.

Interface: IOAuth2ClientCreds

Properties:

  • clientId: string

Client ID of the OAuth2 App Installation.

  • clientSecret: string

Client Secret of the OAuth2 App Installation.

Interface: Header

Properties:

  • [name: string]: string

Error: MTLSError

Properties:

  • code: string

A list of possible errors is below.

  • message: string

Message indicating the origin of the error.

  • Optional originalBody: unknown

The original body returned by the called service in it's unparsed form. Which most likely will be of type string.

Possible Codes:

Code Description  
com.liveperson.faas.mtls.remote-threw Called Service responded with none successfull status code  
com.liveperson.faas.mtls.invalid-request Call to LP mTLS Service failed due to invalid Data (could indicate issues with Client Credentials/Permissions)  
com.liveperson.faas.mtls.missing-conf No configuration for specific domain + path  
com.liveperson.faas.mtls.issue-with-proxy Communication between Proxy and mTLS Service failed