Enclave SDK
HTTP Request

Making HTTP Requests

Klave SDK provides an interface for you to make HTTP requests from within your application in the secure hardware enclave.

Using HTTP from Applications

Klave SDK provides a simple interface to create and send HTTP request from your application.


As querying an HTTP endpoint is not a deterministic operation, HTTP request can only be used in the context of a Query.

The set of operations is the following one:

HTTPrequestHttpRequestHttpResponseExecute and HttpRequest and return an HttpResponse
HTTPrequestAsStringHttpRequestHttpResponse as stringExecute and HttpRequest and return an HttpResponse as a string
HTTPrequestAsArrayBufferHttpRequestHttpResponse as ArrayBufferExecute and HttpRequest and return an HttpResponse as an ArrayBuffer
import { Notifier, JSON, HTTP, HttpRequest } from '@klave/sdk';
import { ErrorMessage, FxRateData, FxRateResult } from './types';
 * @query
export function grabFxRates(): void {
    const query: HttpRequest = {
        hostname: '',
        port: 443,
        path: '/?from=USD&to=EUR,GBP,CHF',
        headers: [],
        body: ''
    const response = HTTP.request(query);
    if (!response) {
            success: false,
            message: `HTTP call went wrong !`
    const ratesData = JSON.parse<FxRateData>(response.body);
        success: true,
        rates: ratesData