Saltar al contenido principal
Version: Guardian v0.2.1 (deprecated)

Quick Start

1
Install
Add the SDK to your project
2
Initialize
Configure at app startup
3
Verify
Call verify() on sensitive actions

1. Install

npm install @surtai/guardian-web

2. Initialize

No initialization step, the web SDK exposes a single static collect() function with no API key, no provider, and no setup. Skip to step 3.

3. Set Customer & Verify

Web is collect-only, the SDK returns an encrypted payload your backend forwards to Surt.

SignInButton.tsx
import { collect } from '@surtai/guardian-web';

async function handleSignIn() {
const { payload } = await collect({ collectLocation: false });

await fetch('/api/sign-in', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ userId: 'user_123', payload }),
});
// Your /api/sign-in forwards `payload` to Surt's evaluate endpoint
// and decides what to return to the client.
}

Next Steps

Choose your platform for the full integration guide: