> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# iframe पहचान सत्यापन: एम्बेडेड वेब KYC

> Didit के iframe से साइट पर KYC, KYB, AML और लाइवनेस जोड़ें। प्रति पूर्ण KYC जाँच $0.33 से, $10 निःशुल्क/माह, कोई अनुबंध नहीं।



iframe इंटीग्रेशन प्रॉम्प्ट
        प्रॉम्प्ट को क्लिपबोर्ड पर कॉपी करें



      
      

\<pre>

\`Embed Didit identity verification into my web page using an iframe.

\## Two Options

\### Option A: UniLink (no backend — fastest setup)
Copy your UniLink URL from Didit Console > Workflows > Copy Link.
It looks like: https://verify.didit.me/u/<BASE64_WORKFLOW_ID>
Embed it directly:

\<iframe
src="https://verify.didit.me/u/YOUR_WORKFLOW_ID_BASE64"
style="width: 100%; height: 700px; border: none; border-radius: 12px;"
allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
/>

No backend needed. Results appear in your Didit Console dashboard.

\### Option B: API session (full control)
1\. Backend creates session: POST /v3/session/ → response includes "url"
2\. Frontend embeds that "url" as the iframe src
3\. Listen for postMessage events from the iframe (event.origin === 'https://verify.didit.me', or your white-label domain)
4\. Backend receives the full, signed decision via webhook (status.updated)

\## postMessage contract (key events — full table below)
Every message is an object: { type: "didit:<event>", data: { ... }, timestamp: <ms epoch> }
Completion event: type === "didit:completed", data: { sessionId, status }
Other events: didit:ready { sessionId }, didit:started, didit:step_started { step },
didit:step_completed { step, nextStep }, didit:step_changed { step, previousStep },
didit:status_updated { status }, didit:error { error, step }, didit:cancelled, didit:close_request,
didit:layout { contentHeight, colorScheme: "light" | "dark", dir: "ltr" | "rtl" }
The payload is NESTED under event.data.data (event.data is the envelope).
For your own iframe, add sdk_presentation=embedded with the URL API to receive didit:layout.

\## Iframe size (redesigned flow)
\- Window 1024px and wider: 960px by 660px (at most 90% of the window)
\- Window 541px to 1023px: 500px wide, height = didit:layout contentHeight (700px until the first message, at most 90% of the window height)
\- Window 540px and below: full screen

\## Frontend Code (Option B — React)
function VerificationIframe({ verificationUrl }) {
useEffect(() => {
function handleMessage(event) {
  if (event.origin !== 'https://verify.didit.me') return; // use your white-label domain if configured
  const { type, data } = event.data || {};
  if (type === 'didit:completed') {
    // data.sessionId, data.status: "Approved" | "Declined" | "In Review" // open string — other session statuses possible in edge flows
    // Trust the webhook on your backend for the canonical decision.
  }
}
window.addEventListener('message', handleMessage);
return () => window.removeEventListener('message', handleMessage);
}, []);

return (
\<iframe
  src={verificationUrl}
  style={{ width: '100%', height: '700px', border: 'none', borderRadius: '12px' }}
  allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
/>
);
}

\## Required client-side permissions
If you front your site with a reverse proxy (nginx, Cloudflare, etc.) make sure it does not
strip the Permissions-Policy / Feature-Policy headers — camera and microphone access must be
allowed for your origin or the iframe will be unable to start the camera.

\## Required iframe Permissions
allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
camera: document and face capture. microphone: optional audio during video capture.
geolocation: the location step. clipboard-write: the copy buttons.
digital-credentials-get: sharing a digital ID from a wallet such as Google Wallet.

\## Backend: Create Session
POST https://verification.didit.me/v3/session/
Headers: { "x-api-key": DIDIT_API_KEY, "Content-Type": "application/json" }
Body: { "workflow_id": DIDIT_WORKFLOW_ID, "vendor_data": userId }
201 response fields (all 10, per OpenAPI):
\{ "session_id", "session_number", "session_token", "url", "vendor_data", "metadata",
"status", "workflow_id", "workflow_version", "callback" }
Use response.url as the iframe src — never build the URL from session_token by hand.

\## Rate Limits
600 session-create requests per minute per API key (falls back to bearer token, then client IP), plus a shared 300 write-requests/minute budget across all endpoints. HTTP 429 with Retry-After when exceeded.

\## Environment Variables
\- DIDIT_API_KEY (backend only)
\- DIDIT_WORKFLOW_ID (backend only)

\## Docs
\- Iframe guide: https://docs.didit.me/integration/web-sdks/incontext-iframe
\- Create Session: https://docs.didit.me/sessions-api/create-session
\- Webhooks: https://docs.didit.me/integration/webhooks`

\</pre>



      
      

यहाँ पेस्ट करें

अपने एप्लिकेशन में iframe का उपयोग करके Didit सत्यापन फ़्लो सीधे एम्बेड करें। इससे उपयोगकर्ताओं को आपकी साइट से बाहर रीडायरेक्ट किए बिना एक सहज अनुभव मिलता है।## अवलोकन| सुविधा | UniLink (बैकएंड नहीं) | API सत्र (बैकएंड के साथ) |
| - | - | - |
| सेटअप समय | \< 1 मिनट | 5-10 मिनट |
| बैकएंड आवश्यक | ❌ नहीं | ✅ हाँ |
| कस्टम `vendor_data` | ❌ नहीं | ✅ हाँ |
| कस्टम `metadata` | ❌ नहीं | ✅ हाँ |
| प्रति-सत्र कॉलबैक | ❌ नहीं | ✅ हाँ |
| सत्र ट्रैकिंग | ❌ नहीं | ✅ हाँ |***## UniLink iframe (बैकएंड की आवश्यकता नहीं)सबसे तेज़ तरीका: बस अपना UniLink URL कॉपी करके पेस्ट करें।### आपको क्या चाहिए1) एक Didit वर्कफ़्लो (जो [Didit Console](https://business.didit.me) में बनाया गया हो)
2) आपका UniLink URL (अपने वर्कफ़्लो पर **Copy Link** पर क्लिक करें)### इम्प्लीमेंटेशन```html theme={null}
<iframe 
  src="https://verify.didit.me/u/YOUR_WORKFLOW_ID_BASE64"
  style="width: 100%; height: 700px; border: none;" 
  allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
></iframe>
```> ⚠️ **आवश्यक**: लाइवनेस डिटेक्शन के दौरान कैमरा एक्सेस के लिए `allow` एट्रिब्यूट अनिवार्य है।### मुख्य लाभ- **1 मिनट से कम सेटअप**: कोई बैकएंड नहीं, कोई API कुंजी नहीं
- **शून्य कॉन्फ़िगरेशन**: कॉलबैक URL वर्कफ़्लो सेटिंग्स में सेट होता है
- **MVP के लिए आदर्श**: तुरंत शुरू करें***## API सत्र iframe (बैकएंड के साथ)उन उन्नत इंटीग्रेशन के लिए जिन्हें प्रति-सत्र अनुकूलन चाहिए।### कब उपयोग करें- हर सत्र के लिए कस्टम `vendor_data` या `metadata` पास करें
- हर सत्र के लिए अलग-अलग कॉलबैक URL सेट करें
- सत्यापन शुरू होने से पहले सर्वर-साइड पर सत्र ट्रैक करें
- सत्रों को अपनी उपयोगकर्ता ID से जोड़ें### इम्प्लीमेंटेशन**चरण 1: सत्र बनाएँ (बैकएंड)**सत्र-निर्माण रिस्पॉन्स में **`url`** नाम का फ़ील्ड होता है, इसे iframe के `src` के रूप में उपयोग करें।```javascript theme={null}
// Node.js / Express
app.post('/api/create-verification', async (req, res) => {
  const { userId } = req.body;

  const response = await fetch('https://verification.didit.me/v3/session/', {
    method: 'POST',
    headers: {
      'x-api-key': process.env.DIDIT_API_KEY,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      workflow_id: process.env.DIDIT_WORKFLOW_ID,
      vendor_data: userId,
      callback: 'https://yourapp.com/verification-callback',
      metadata: { source: 'web-app', timestamp: Date.now() },
    }),
  });

  if (!response.ok) {
    return res.status(response.status).send(await response.text());
  }

  // 201 per OpenAPI: { session_id, session_number, session_token, url, vendor_data,
  //                    metadata, status, workflow_id, workflow_version, callback }
  const session = await response.json();
  res.json({ sessionId: session.session_id, verificationUrl: session.url });
});
```**चरण 2: iframe में एम्बेड करें (फ़्रंटएंड)**```html theme={null}
<iframe 
  id="didit-verification"
  src="" <!-- Set dynamically from API response -->
  style="width: 100%; height: 650px; border: none;" 
  allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
></iframe>

<script>
  async function startVerification() {
    const response = await fetch('/api/create-verification', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ userId: 'user-123' })
    });
    
    const { verificationUrl } = await response.json();
    document.getElementById('didit-verification').src = verificationUrl;
  }
</script>
```***## इवेंट सुनना (postMessage)सत्यापन पेज पैरेंट विंडो को इवेंट भेजता है। हर मैसेज का यह एनवेलप होता है:```typescript theme={null}
{
  type: 'didit:<event>',   // e.g. 'didit:completed'
  data: { /* payload */ }, // event-specific; may be undefined
  timestamp: 1718000000000 // ms epoch
}
```पेलोड **नेस्टेड** है: `event.data.sessionId` नहीं, `event.data.data.sessionId` पढ़ें:```javascript theme={null}
window.addEventListener('message', (event) => {
  // Use your white-label domain here if you have one configured
  if (event.origin !== 'https://verify.didit.me') return;

  const { type, data } = event.data || {};

  if (type === 'didit:ready') {
    console.log('Session ID:', data.sessionId); // available as soon as the page loads
  }
  if (type === 'didit:completed') {
    console.log('Done:', data.sessionId, data.status); // e.g. "Approved" | "Declined" | "In Review"
    // UI hint only — the canonical decision arrives on your backend via webhook
  }
});
```मुख्य इवेंट: `didit:ready` (`{ sessionId }`), `didit:started`, `didit:step_started` / `didit:step_completed` / `didit:step_changed` (`{ step, ... }`), `didit:status_updated` (`{ status }`), `didit:completed` (`{ sessionId, status }`), `didit:cancelled`, `didit:error` (`{ error, step? }`), `didit:close_request`, और `didit:layout` (`{ contentHeight, colorScheme, dir }`, देखें [नीचे](#diditlayout-से-iframe-का-आकार-तय-करें))। [JavaScript SDK इवेंट संदर्भ](https://docs.didit.me/hi/integration/web-sdks/javascript-sdk.md#इवेंट-संदर्भ) में वे सत्यापन इवेंट सूचीबद्ध हैं जो टाइप्ड कॉलबैक के रूप में उपलब्ध हैं। संस्करण 0.5.0 से, SDK layout मैसेज को अंदर से संभालता है और उन्हें `onEvent` को नहीं भेजता।### `didit:layout` से iframe का आकार तय करेंसत्यापन पेज `didit:layout` मैसेज के साथ बताता है कि उसे कितनी जगह चाहिए। यह लोड होने पर एक बार भेजता है, और जब भी उसकी कंटेंट की ऊँचाई, थीम या टेक्स्ट दिशा बदलती है, तब फिर से भेजता है:```typescript theme={null}
{
  type: 'didit:layout',
  data: {
    contentHeight: 612,    // CSS px
    colorScheme: 'light',  // 'light' | 'dark'
    dir: 'ltr'             // 'ltr' | 'rtl'
  },
  timestamp: 1718000000000
}
```| फ़ील्ड | टाइप | विवरण |
| - | - | - |
| `contentHeight` | `number` | पेज के कंटेंट की स्वाभाविक ऊँचाई CSS पिक्सेल में, शीर्ष बार सहित |
| `colorScheme` | `'light' \| 'dark'` | वह थीम जिसमें पेज दिखाया जाता है। व्हाइट लेबल रंगों के साथ, पृष्ठभूमि का रंग तय करता है, डिवाइस सेटिंग नहीं |
| `dir` | `'ltr' \| 'rtl'` | पेज की भाषा की टेक्स्ट दिशा |> [!NOTE]
>
> अपने iframe में `didit:layout` प्राप्त करने के लिए, उसके सत्यापन URL में `sdk_presentation=embedded` जोड़ें। संस्करण 0.5.0 से, [JavaScript SDK](https://docs.didit.me/hi/integration/web-sdks/javascript-sdk.md) यह प्रेज़ेंटेशन स्वयं सेट करता है। प्रेज़ेंटेशन पैरामीटर के बिना, पेज अपना स्टैंडअलोन लेआउट उपयोग करता है और layout मैसेज नहीं भेजता।यह होस्ट [अनुशंसित आकार](#iframe-का-आकार) का पालन करता है: 1024px और उससे अधिक चौड़ाई पर एक निश्चित कार्ड, 540px और उससे कम पर पूरी स्क्रीन, और इनके बीच 500px चौड़ा iframe जो पेज द्वारा बताई गई ऊँचाई लेता है:```html theme={null}
<iframe
  id="didit-verification"
  class="didit-iframe"
  title="Didit verification"
  allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
></iframe>

<style>
  /* 541px to 1023px wide: 500px wide and as tall as the content */
  .didit-iframe {
    display: block;
    width: 500px;
    max-width: 100%;
    height: var(--didit-content-height, 700px); /* 700px until the first didit:layout */
    max-height: 90vh;
    max-height: 90dvh;
    margin: 0 auto;
    border: none;
    border-radius: 16px;
  }

  /* 1024px and wider: the computer card */
  @media (min-width: 1024px) {
    .didit-iframe {
      width: 960px;
      max-width: 90vw;
      height: 660px;
    }
  }

  /* 540px and below: full screen */
  @media (max-width: 540px) {
    .didit-iframe {
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100vh;
      height: 100dvh;
      max-height: none;
      border-radius: 0;
    }
  }
</style>

<script>
  const DIDIT_ORIGIN = 'https://verify.didit.me'; // or your white-label domain
  const iframe = document.getElementById('didit-verification');

  // verificationUrl: the session `url` from your backend, or your UniLink
  const src = new URL(verificationUrl);
  src.searchParams.set('sdk_presentation', 'embedded');
  window.addEventListener('message', (event) => {
    if (event.origin !== DIDIT_ORIGIN || event.source !== iframe.contentWindow) return;
    const { type, data } = event.data || {};
    if (type !== 'didit:layout') return;
    const height = data?.contentHeight;
    if (typeof height !== 'number' || !Number.isFinite(height) || height <= 0) return;

    // Only the 541px to 1023px size reads it; the other two sizes are fixed
    iframe.style.setProperty('--didit-content-height', `${height}px`);
  });
  iframe.src = src.toString();
</script>
```541px से 1023px के बीच, यह उदाहरण layout मैसेज आने तक 700px की शुरुआती ऊँचाई का उपयोग करता है, जो दिखाई दे रही विंडो की ऊँचाई के 90% तक सीमित है। कंप्यूटर और फ़ोन के आकार तुरंत लागू होते हैं। फ़ोन पर iframe पूरी विंडो को ढक लेता है, इसलिए अपने होस्ट में सत्यापन से बाहर निकलने का तरीका दें। iframe के चारों ओर बनाए गए कंट्रोल को पेज की थीम और टेक्स्ट दिशा से मिलाने के लिए `colorScheme` और `dir` का उपयोग करें।यदि उपयोगकर्ता का कनेक्शन टूट जाता है, तो पेज "No internet connection" स्क्रीन दिखाता है, जो कनेक्शन वापस आने पर अपने आप बंद हो जाती है। यदि उपयोगकर्ता वहाँ **Exit Verification** चुनता है, तो पेज `error: "network_error"` के साथ `didit:error` भेजता है, फिर `didit:cancelled`। `didit:cancelled` मिलने पर iframe बंद करें।***## मोडल इम्प्लीमेंटेशनआपके पेज पर ओवरले होने वाले एक परिष्कृत मोडल अनुभव के लिए:### HTML/CSS/JS```html theme={null}
<!DOCTYPE html>
<html>
<head>
  <style>
    .didit-modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.6);
      z-index: 9999;
      backdrop-filter: blur(4px);
    }
    
    .didit-modal-container {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 90%;
      max-width: 480px;
      height: 85vh;
      max-height: 750px;
      background: white;
      border-radius: 16px;
      overflow: hidden;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }
    
    .didit-modal-close {
      position: absolute;
      top: 12px;
      right: 12px;
      z-index: 10;
      width: 32px;
      height: 32px;
      border: none;
      background: rgba(0, 0, 0, 0.1);
      border-radius: 50%;
      cursor: pointer;
      font-size: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .didit-modal-close:hover {
      background: rgba(0, 0, 0, 0.2);
    }
    
    .didit-iframe {
      width: 100%;
      height: 100%;
      border: none;
    }
  </style>
</head>
<body>
  <button onclick="openVerification()">Verify Identity</button>

  <div id="didit-modal" class="didit-modal-overlay">
    <div class="didit-modal-container">
      <button class="didit-modal-close" onclick="closeVerification()">✕</button>
      <iframe 
        id="didit-iframe"
        class="didit-iframe"
        allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
      ></iframe>
    </div>
  </div>

  <script>
    const UNILINK_URL = 'https://verify.didit.me/u/YOUR_WORKFLOW_ID_BASE64';
    
    function openVerification() {
      document.getElementById('didit-iframe').src = UNILINK_URL;
      document.getElementById('didit-modal').style.display = 'block';
      document.body.style.overflow = 'hidden';
    }
    
    function closeVerification() {
      document.getElementById('didit-iframe').src = '';
      document.getElementById('didit-modal').style.display = 'none';
      document.body.style.overflow = '';
    }
    
    // Close on escape key
    document.addEventListener('keydown', (e) => {
      if (e.key === 'Escape') closeVerification();
    });
    
    // Close on overlay click
    document.getElementById('didit-modal').addEventListener('click', (e) => {
      if (e.target.id === 'didit-modal') closeVerification();
    });
  </script>
</body>
</html>
```***## React कंपोनेंटमोडल-आधारित सत्यापन के लिए एक पुन: उपयोग योग्य React कंपोनेंट:```tsx theme={null}
import { useState, useEffect } from 'react';

interface DiditInContextProps {
  /**
   * Either the `url` returned by POST /v3/session/ (API session)
   * or your UniLink URL copied from the Console (Workflows → Copy Link).
   * Don't derive the UniLink yourself — the path segment is a 22-character
   * base64url encoding of the workflow UUID's raw bytes, not btoa(workflowId).
   */
  verificationUrl: string;
  isOpen: boolean;
  onClose: () => void;
  onComplete?: (sessionId: string, status: string) => void;
}

export function DiditInContext({ 
  verificationUrl, 
  isOpen, 
  onClose,
  onComplete 
}: DiditInContextProps) {
  const [iframeSrc, setIframeSrc] = useState<string>('');

  useEffect(() => {
    if (isOpen) {
      setIframeSrc(verificationUrl);
      document.body.style.overflow = 'hidden';
    } else {
      setIframeSrc('');
      document.body.style.overflow = '';
    }
  }, [isOpen, verificationUrl]);

  // Listen for postMessage from iframe
  // Messages look like: { type: 'didit:<event>', data: {...}, timestamp }
  useEffect(() => {
    const handleMessage = (event: MessageEvent) => {
      // Use your white-label domain here if you have one configured
      if (event.origin !== 'https://verify.didit.me') return;

      if (event.data?.type === 'didit:completed' && onComplete) {
        onComplete(event.data.data?.sessionId, event.data.data?.status);
        onClose();
      }
    };

    window.addEventListener('message', handleMessage);
    return () => window.removeEventListener('message', handleMessage);
  }, [onComplete, onClose]);

  // Handle escape key
  useEffect(() => {
    const handleEscape = (e: KeyboardEvent) => {
      if (e.key === 'Escape' && isOpen) onClose();
    };
    
    document.addEventListener('keydown', handleEscape);
    return () => document.removeEventListener('keydown', handleEscape);
  }, [isOpen, onClose]);

  if (!isOpen) return null;

  return (
    <div 
      className="fixed inset-0 bg-black/60 backdrop-blur-sm z-50 flex items-center justify-center"
      onClick={(e) => e.target === e.currentTarget && onClose()}
    >
      <div className="relative w-[90%] max-w-[480px] h-[85vh] max-h-[750px] bg-white rounded-2xl overflow-hidden shadow-2xl">
        <button 
          onClick={onClose}
          className="absolute top-3 right-3 z-10 w-8 h-8 rounded-full bg-black/10 hover:bg-black/20 flex items-center justify-center"
          aria-label="Close"
        >
          ✕
        </button>
        <iframe 
          src={iframeSrc}
          className="w-full h-full border-0"
          allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
          title="Didit Verification"
        />
      </div>
    </div>
  );
}
```### उपयोग```tsx theme={null}
import { useState } from 'react';
import { DiditInContext } from './DiditInContext';

function App() {
  const [isVerificationOpen, setIsVerificationOpen] = useState(false);
  
  return (
    <>
      <button onClick={() => setIsVerificationOpen(true)}>
        Verify Identity
      </button>
      
      <DiditInContext
        verificationUrl="https://verify.didit.me/u/YOUR_WORKFLOW_ID_BASE64" // UniLink from Console, or the API session `url`
        isOpen={isVerificationOpen}
        onClose={() => setIsVerificationOpen(false)}
        onComplete={(sessionId, status) => {
          console.log(`Verification ${status}: ${sessionId}`);
          if (status === 'Approved') {
            // Navigate to success page
          }
        }}
      />
    </>
  );
}
```***## Vue कंपोनेंट```vue theme={null}
<template>
  <Teleport to="body">
    <div 
      v-if="isOpen"
      class="fixed inset-0 bg-black/60 backdrop-blur-sm z-50 flex items-center justify-center"
      @click.self="$emit('close')"
    >
      <div class="relative w-[90%] max-w-[480px] h-[85vh] max-h-[750px] bg-white rounded-2xl overflow-hidden shadow-2xl">
        <button 
          @click="$emit('close')"
          class="absolute top-3 right-3 z-10 w-8 h-8 rounded-full bg-black/10 hover:bg-black/20 flex items-center justify-center"
        >
          ✕
        </button>
        <iframe 
          :src="iframeSrc"
          class="w-full h-full border-0"
          allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
        />
      </div>
    </div>
  </Teleport>
</template>

<script setup lang="ts">
import { computed, watch, onMounted, onUnmounted } from 'vue';

const props = defineProps<{
  isOpen: boolean;
  // The `url` from POST /v3/session/, or your UniLink URL copied from the
  // Console (Workflows → Copy Link). Don't derive the UniLink with btoa() —
  // its path segment is base64url of the workflow UUID's raw bytes.
  verificationUrl: string;
}>();

const emit = defineEmits<{
  close: [];
  complete: [sessionId: string, status: string];
}>();

const iframeSrc = computed(() => (props.isOpen ? props.verificationUrl : ''));

// Handle escape key
const handleEscape = (e: KeyboardEvent) => {
  if (e.key === 'Escape' && props.isOpen) emit('close');
};

// Handle postMessage — messages look like { type: 'didit:<event>', data: {...}, timestamp }
const handleMessage = (event: MessageEvent) => {
  // Use your white-label domain here if you have one configured
  if (event.origin !== 'https://verify.didit.me') return;
  if (event.data?.type === 'didit:completed') {
    emit('complete', event.data.data?.sessionId, event.data.data?.status);
  }
};

onMounted(() => {
  document.addEventListener('keydown', handleEscape);
  window.addEventListener('message', handleMessage);
});

onUnmounted(() => {
  document.removeEventListener('keydown', handleEscape);
  window.removeEventListener('message', handleMessage);
});

// Lock body scroll when open
watch(() => props.isOpen, (isOpen) => {
  document.body.style.overflow = isOpen ? 'hidden' : '';
});
</script>
```***## कॉन्फ़िगरेशन### आवश्यक अनुमतियाँकैप्चर, लोकेशन, कॉपी और मीडिया संगतता के लिए इस पूरी अनुमति सूची का उपयोग करें:```html theme={null}
allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
```| अनुमति | किसलिए उपयोग होती है और इसके बिना क्या होता है |
| - | - |
| `camera` | दस्तावेज़ स्कैनिंग और चेहरा कैप्चर के लिए। इसके बिना कैमरा शुरू नहीं हो सकता और उपयोगकर्ता को कैमरा-एक्सेस से जुड़ा मार्गदर्शन दिखता है |
| `microphone` | दस्तावेज़ और चेहरे के वीडियो कैप्चर के दौरान वैकल्पिक ऑडियो के लिए। इसके बिना कैप्चर बिना ऑडियो के जारी रहता है |
| `geolocation` | लोकेशन चरण में डिवाइस की स्थिति पढ़ी जाती है। इसके बिना उपयोगकर्ता को **लोकेशन एक्सेस बंद है** दिखता है, भले ही उसने ब्राउज़र में लोकेशन की अनुमति दी हो |
| `clipboard-write` | सत्र संदर्भ या सत्यापन लिंक कॉपी करने के लिए, इन-ऐप ब्राउज़र स्क्रीन पर भी। इसके बिना कॉपी कार्रवाई विफल हो सकती है और उपयोगकर्ता को दिखने वाला टेक्स्ट या ब्राउज़र का पता मैन्युअली कॉपी करना होगा |
| `fullscreen` | मीडिया नियंत्रणों को फ़ुलस्क्रीन का अनुरोध करने देता है। इसके बिना वे नियंत्रण iframe के अंदर ही रहते हैं |
| `autoplay` | निर्देशात्मक वीडियो और कैमरा प्रीव्यू को ब्राउज़र के नियमों के अनुसार अपने-आप चलने देता है। इसके बिना प्लेबैक उपयोगकर्ता की किसी क्रिया का इंतज़ार कर सकता है |
| `encrypted-media` | संरक्षित मीडिया की संगतता के लिए रखी गई है। मौजूदा कैप्चर चरणों को इसकी ज़रूरत नहीं है; इसके बिना संरक्षित मीडिया प्लेबैक ब्लॉक हो जाएगा |
| `digital-credentials-get` | ब्राउज़र के Digital Credentials API के ज़रिए Google Wallet जैसे वॉलेट से डिजिटल ID साझा करने के लिए। इसके बिना ब्राउज़र आपके iframe के अंदर वॉलेट अनुरोध को अस्वीकार कर देता है, इसलिए उपयोगकर्ता वहाँ वॉलेट से ID साझा नहीं कर पाता |`allow` एट्रिब्यूट अनुमतियाँ सौंपता है; यह उपयोगकर्ता के चुनाव या आपके होस्ट पेज के किसी सख़्त `Permissions-Policy` हेडर को ओवरराइड नहीं करता।### iframe का आकारसत्यापन प्रवाह अपने iframe के आकार के अनुसार खुद को व्यवस्थित करता है। iframe को उस विंडो के हिसाब से आकार दें जिसमें वह दिखाया जाएगा:| विंडो की चौड़ाई | अनुशंसित iframe आकार |
| - | - |
| 1024px या उससे अधिक (कंप्यूटर) | 960px गुणा 660px, जो विंडो की चौड़ाई और ऊँचाई के अधिकतम 90% तक हो सकता है। हर चरण में यही आकार रखें |
| 541px से 1023px | 500px चौड़ा और कंटेंट जितना लंबा: ऊँचाई [`didit:layout` संदेश](#diditlayout-से-iframe-का-आकार-तय-करें) के `contentHeight` से लें, जो विंडो की ऊँचाई के अधिकतम 90% तक हो सकती है |
| 540px या उससे कम (फ़ोन) | फ़ुल स्क्रीन: विंडो की पूरी चौड़ाई और पूरी दिखने वाली ऊँचाई, बिना गोल कोनों के |मध्यम रेंज के लिए, पहला `didit:layout` संदेश आने तक 500px गुणा 700px से शुरू करें, उसी ऊँचाई सीमा के साथ। [`didit:layout` उदाहरण](#diditlayout-से-iframe-का-आकार-तय-करें) तीनों आकार लागू करता है, जिसमें कोई संदेश आने से पहले कंप्यूटर और फ़ोन के आकार भी शामिल हैं।### कंटेंट सिक्योरिटी पॉलिसी (CSP)यदि आप CSP का उपयोग करते हैं, तो Didit को अपने `frame-src` डायरेक्टिव में जोड़ें:```
Content-Security-Policy: frame-src https://verify.didit.me;
```***## क्रॉस-डिवाइस सत्यापनInContext iframe क्रॉस-डिवाइस सत्यापन को अपने-आप सपोर्ट करता है:1) उपयोगकर्ता डेस्कटॉप पर सत्यापन शुरू करता है
2) यदि कैमरा उपलब्ध नहीं है, तो QR कोड दिखाया जाता है
3) उपयोगकर्ता मोबाइल पर QR कोड स्कैन करता है
4) उपयोगकर्ता मोबाइल पर सत्यापन पूरा करता है
5) डेस्कटॉप का iframe परिणाम के साथ अपने-आप अपडेट हो जाता हैयह अपने-आप होता है, किसी अतिरिक्त कॉन्फ़िगरेशन की ज़रूरत नहीं है।***## समस्या निवारण### कैमरा काम नहीं कर रहा1) सुनिश्चित करें कि iframe में पूरी [अनुमति सूची](#आवश्यक-अनुमतियाँ) शामिल है
2) जाँचें कि आपकी साइट HTTPS पर उपलब्ध है
3) सत्यापित करें कि उपयोगकर्ता ने आपके डोमेन को कैमरे की अनुमति दी है
4) यदि iframe में कैमरा एक्सेस विफल हो, तो [Redirect](https://docs.didit.me/hi/integration/web-sdks/web-redirect.md) विधि आज़माएँ### iframe लोड नहीं हो रहा1) कंटेंट सिक्योरिटी पॉलिसी (CSP) से जुड़ी समस्याएँ जाँचें
2) `https://verify.didit.me` को अपने `frame-src` डायरेक्टिव में जोड़ें
3) ब्राउज़र कंसोल में त्रुटियाँ जाँचें### postMessage प्राप्त नहीं हुआ1) सुनिश्चित करें कि आप सही ओरिजिन सुन रहे हैं (`https://verify.didit.me`, या आपका व्हाइट लेबल डोमेन)
2) जाँचें कि iframe खोलने से पहले इवेंट लिसनर जोड़ा गया है
3) इवेंट का नाम और ढाँचा जाँचें: टाइप्स पर प्रीफ़िक्स होता है (`didit:completed`, `verification_complete` नहीं), और पेलोड `event.data.data` के अंदर नेस्टेड होता है***## उदाहरण रिपॉज़िटरी> [card] [GitHub रिपॉज़िटरी](https://github.com/didit-protocol/iframe-example)
>
> GitHub पर स्रोत कोड और उदाहरण देखें***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.