t.js, call start(), and call getSession() when the user performs a sensitive action.
Load and initialize
Start Tripwire as early as possible on your page. The SDK begins collecting signals immediately.API reference
Module exports
| Export | Description |
|---|---|
start({ publishableKey }) | Bootstrap the runtime and start collection. Returns a TripwireClient. |
version | SDK bundle version string. |
TripwireClient
| Method | Returns | Description |
|---|---|---|
getSession() | Promise<{ sessionId, sealedToken }> | Flush pending observations and return a sealed handoff for your backend. |
waitForFingerprint() | Promise<void> | Resolve when fingerprinting is complete. No identity data is returned. |
onError(handler) | () => void (unsubscribe) | Subscribe to TripwireError events. |
destroy() | void | Stop timers and tear down the runtime. |
Getting a session handoff
CallgetSession() right before the protected action — not on page load.
Error handling
All async methods reject with a structuredTripwireError:
| Field | Description |
|---|---|
code | Stable identifier like config.validation_failed or transport.upgrade_required |
retryable | Whether retrying may succeed |
fatal | Whether the runtime is in a terminal state |
operation | The failing operation (start, wait_for_fingerprint, get_session) |
Best practices
- Start early — initialize on page load, not at action time
- Call
getSession()late — right before the sensitive action for the freshest signal data - Handle errors gracefully — if the SDK fails, your app should still work (degrade to a fallback policy)
- Don’t expose verdicts client-side — the browser API intentionally doesn’t return them
What’s next
- Server verification — verify the handoff on your backend
- Browser compatibility — supported browsers and known differences
- Quickstart — end-to-end integration in 5 minutes