- Skips asking the user to confirm their email address
- Uses the authenticated email automatically when escalating to a human agent
- Has access to the user’s identity for the duration of the session
How it works
- Your server computes
HMAC-SHA256(secret, userEmail)using your widget secret. - You pass the email and the hash to the embed script as
data-*attributes. - The widget’s iframe URL carries those values as query params.
- Layerup’s server verifies the hash using the same secret before trusting the email.
Setup
1. Get your widget secret
Open your Chat Widget integration in the Layerup dashboard. In the Identity Verification section, click Generate to create a secret. Copy it and store it as an environment variable on your server.2. Compute the hash on your server
3. Pass the values to the embed snippet
Adddata-user-email and data-user-hash attributes to the script tag. These are rendered server-side into your HTML — they must never be hard-coded or sourced from client storage.
4. Mobile webview
For native apps, append the parameters to the webview URL. Compute the hash server-side and inject it into the URL before opening the webview — do not compute it in the app.- iOS (Swift)
- Android (Kotlin)
Verification flow
Layerup uses a constant-time comparison (timingSafeEqual) to prevent timing attacks. An invalid hash produces no error — the session continues as anonymous.
What changes for verified users
Email confirmation skipped
The AI agent won’t ask the user to spell out or confirm their email address before escalating to a human agent.
Escalation pre-filled
When the AI creates a support ticket, it uses the authenticated email as the reply-to address automatically.
OTP not required
Users who are already authenticated in your app don’t need to re-verify their identity through an OTP inside the widget.
Session continuity
The authenticated email is attached to the session for its entire duration, across multiple messages.
Security checklist
Keep the secret server-side
Store it in an environment variable. Never include it in client JavaScript, mobile app binaries, or version control.
Compute the hash per-request
Generate the hash fresh for each page render or API response. Don’t cache hashes in the browser or in cookies.
Use HTTPS
The widget URL and all chat API calls require HTTPS. Don’t serve the embed script over HTTP.

