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
Simple Setup
- Navigate to your load balancer, and append the path
/public/mte-relay-browser.js
- Include using a
<script src=".../public/mte-relay-browser.js"></script>
- Include by copy/pasting into the source code of your web application.
- 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();