mTLS Client Certificate

Tie your API key to a certificate that stays on your server, so a leaked key cannot be used anywhere else.

Lock your API key to your own server.

An API key and its secret can be copied, so they may leak in several ways, for example through source code published by mistake, a log file, or a device that is no longer in use. With a client certificate, the system refuses requests from any other machine even when they carry the same key, because the private key of the certificate is kept only on your server.

Example: a withdrawal request sent from another machine with your API key and secret

POST https://mainnet.trustsig.xyz/v1/withdrawal/createRequest/fiat

x-api-key: <your API key>

x-signature: <computed with your secret>

Before mTLS200The withdrawal is accepted
After mTLS is enforced403The request is refusedcode 2044 MTLS_CLIENT_CERT_REQUIRED

The change on your side is small: attach the certificate in your HTTP client and set the base URL to https://api-mtls.trustsig.xyz. Your API key, secret, headers and request formats stay as they are.

For Production calls made from your own server only. Browsers and mobile apps cannot attach a certificate.

Set up in four steps

1

Create a key and a certificate request

Run this on your server, then send only trustsig-client.csr to our team. The .key file stays with you. Please do not send it to anyone.

openssl req -new -newkey rsa:2048 -nodes \
  -keyout trustsig-client.key -out trustsig-client.csr \
  -subj "/CN=<your company name>"
chmod 600 trustsig-client.key
2

Receive the certificate

We send back trustsig-client.pem. Put it next to the .key on every server that calls the API.

3

Attach it and change the base URL

Everything else in your code stays as it is.

import https from 'node:https'
import fs from 'node:fs'
import axios from 'axios'

const httpsAgent = new https.Agent({
  cert: fs.readFileSync('/etc/trustsig/trustsig-client.pem'),
  key: fs.readFileSync('/etc/trustsig/trustsig-client.key'),
})

export const api = axios.create({ baseURL: 'https://api-mtls.trustsig.xyz', httpsAgent })

unconfirmedWhich host goes into the URL you sign is still being confirmed. Make sure step 4 passes before you move real traffic.

4

Test, then tell us

You should see "verified": true. Then call GET /v1/balance/query through the new host. When it returns 200, tell our team.

curl --cert trustsig-client.pem --key trustsig-client.key https://api-mtls.trustsig.xyz/__mtls
# {"presented":true,"verified":true,"status":"SUCCESS", ...}

What happens next

  • We watch your traffic for 3 to 7 days without refusing anything, then tell you the enforcement date in advance.
  • Once enforced, the key works only with the certificate. Calls to the original host are refused with code 2044.
  • The certificate lasts one year. Renew it by sending a new CSR. If a server is lost, tell us to revoke it; the API key does not need to change.