Function generateProxyHttpSigningMessage

  • Generates the message which the data proxy hashed and signed. This can be useful when you need to verify the data proxy signature in the tally phase. With this message there is no need to include the entire request and response data in the execution result.

    Parameters

    • requestUrl: string
    • requestMethod: string
    • requestBody: Bytes
    • responseBody: Bytes

    Returns Bytes

    the message that the data proxy should have hashed and signed

    Example

    @json
    class ApiResponse {
    name!: string;
    }

    @json
    class ExecutionResult {
    name!: string;
    proxyMessage!: string;
    }

    const url = "https://swapi.dev/api/planets/1/";
    const response = proxyHttpFetch(url);

    if (response.ok) {
    const proxyMessage = generateProxyHttpSigningMessage(url, "GET", Bytes.empty(), response.bytes);
    const data = response.bytes.toJSON<ApiResponse>();

    Process.success(Bytes.fromJSON<>({ name: data.name, proxyMessage: proxyMessage }));
    } else {
    // Error occured
    }