Skip to main content

Native JavaScript Implementation

MTE Relay Client-Side Setup

The MTE Relay server provides access to the client JavaScript module required to encode/decode data on the client. Once the server is set up, the client JS code is available at the route /public/mte-relay-browser.js.
*The MTE Relay Client is not a container. This is a JavaScript Package that you must embed in your own client-side application.

Instructional Videos

Video Series

Video Series

Simple Setup

  1. Navigate to your load balancer, and append the path /public/mte-relay-browser.js
  2. Include using a <script src=".../public/mte-relay-browser.js"></script>
  3. Include by copy/pasting into the source code of your web application.
  4. Use mteFetch() to send encrypted data. This is analogous to (and likely should replace instances of) the JavaScript Fetch API.
// use mteFetch to handle pairing, encoding data, and sending/receiving it
const response = await mteFetch(
"https://[your_relay_url]/api/[your_api_route]",
{
method: "POST",
body: JSON.stringify({ data }),
}
);
const data = await response.json();