Documentation

Setup

Create an API key under Developers → API keys, then set your backend address as the Callback URL under Developers → Webhooks.

Required environment variables
VariableDescription
TQ_API_KEYThe API key from Developers → API keys Required
TQ_API_SECRETThe API secret for HMAC signing Required
Where the SDK plugs into your backend
EndpointDirectionDescription
/api/loginMiddlewarerequireTouchque('LOGIN') on your login route
/api/transferMiddlewarerequireTouchque('SEND_MONEY') on any sensitive route
Install the SDK using npm: npm install @touchque/node. Set up environment variables server-side.
Browser and React

Your pages use the browser SDK: npm install @touchque/web (@touchque/web 2.2.0). With React, add the hooks and components too: npm install @touchque/react @touchque/web (@touchque/react 2.1.0). Neither needs your API key or secret: those stay on your server.

Package installation
npm install @touchque/node
Browser and React
# Browser (@touchque/web 2.2.0)
npm install @touchque/web

# React (@touchque/react 2.1.0)
npm install @touchque/react @touchque/web
Client initialization
import { requireTouchque } from '@touchque/node';

// TQ_API_KEY / TQ_API_SECRET read from the environment automatically —
// no client to construct by hand.
Environment settings
# .env
TQ_API_KEY=tq_abc123
TQ_API_SECRET=your_secret_here

# callbackUrl:
# https://yourdomain.com/api/2fa/callback