@@ -158,7 +158,9 @@ const result = await gatekeeper.validateRequest();
158158 responseID: string, // Response ID for performance tracking (when promoted)
159159 deployment: string, // Deployment identifier from the API
160160 token: string, // The session token
161- hash: string | null // Signature hash for validation (when available)
161+ hash: string | null , // Signature hash for validation (when available)
162+ liteValidatorRedirect: boolean, // true = redirect to lite validator
163+ liteValidatorUrl: string // URL for lite validator redirect
162164}
163165```
164166
@@ -262,7 +264,16 @@ const instance = crowdhandler.init({
262264 timeout: 5000 , // API timeout in milliseconds
263265 trustOnFail: true , // Allow access if API fails
264266 fallbackSlug: ' ' , // Fallback room slug when trustOnFail is false
265- cookieName: ' crowdhandler' // Custom cookie name (default: 'crowdhandler')
267+ cookieName: ' crowdhandler' , // Custom cookie name (default: 'crowdhandler')
268+ liteValidator: false , // Enable lite validator mode (default: false)
269+ roomsConfig: [{ // Array of room configurations for lite validator
270+ domain: string, // e.g. 'https://example.com'
271+ slug: string, // Room identifier
272+ urlPattern?: string, // URL pattern to match
273+ patternType?: ' regex' | ' contains' | ' all' ,
274+ queueActivatesOn?: number, // Unix timestamp
275+ timeout?: number // Timeout in seconds
276+ }]
266277 }
267278});
268279```
@@ -567,6 +578,43 @@ await gatekeeper.recordPerformance({
567578});
568579```
569580
581+ ### Lite Validator Mode
582+
583+ Lite validator mode provides token refresh without API calls by checking room configuration locally. To enable it:
584+
585+ 1 . Set ` liteValidator: true ` in options
586+ 2 . Fetch and provide your rooms configuration from the CrowdHandler API
587+
588+ ``` javascript
589+ // First, fetch your rooms configuration
590+ const { client } = init ({ publicKey: ' YOUR_PUBLIC_KEY' });
591+ const roomsResponse = await client .rooms ().get ();
592+
593+ // Then initialize with lite validator enabled
594+ const { gatekeeper } = init ({
595+ publicKey: ' YOUR_PUBLIC_KEY' ,
596+ request: req,
597+ response: res,
598+ options: {
599+ liteValidator: true , // Enable lite validator
600+ roomsConfig: roomsResponse .result // Pass the rooms array from API
601+ }
602+ });
603+
604+ // Handle the lite validator redirect
605+ const result = await gatekeeper .validateRequest ();
606+
607+ if (result .liteValidatorRedirect ) {
608+ // Redirect to refresh token/session
609+ return gatekeeper .redirect (result .liteValidatorUrl );
610+ }
611+ ```
612+
613+ ** When lite validator activates:**
614+ - URL matches a room in your config
615+ - Token is missing or >12 hours old
616+ - Redirects to CrowdHandler to refresh session
617+
570618## Testing
571619
572620The SDK includes comprehensive testing tools:
0 commit comments