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

# IDV Module

> The IDV Module provides an all-in-one solution for implementing OCR and Biometrics in your application's onboarding flow. It seamlessly integrates with vendor SDKs and automatically handles all necessary API calls between FrankieOne and vendor systems.

## Sample Implementation

```typescript title="Complete IDV Flow Implementation" theme={null}
const idv = oneSdk.flow("idv");

idv.on("ready", () => {
  // IDV is mounted and ready
});

idv.on("loading", (isLoading) => {
  // `isLoading` is a boolean type indicating the loading state
});

idv.on("input_required", () => {
  // OCR or Biometrics failed to capture data
});

idv.on("detection_complete", () => {
  // Detection is complete, usually show a loading state here
});

idv.on("processing", (result) => {
  // Got pending result
})

idv.on("results", (result) => {
  // Do something with the results
})

idv.on("error", (error) => {
  // Handle errors
})

// Mount the IDV flow to a container
idv.mount("#idv-container");
```

<Callout icon="bell" color="#FFCA16" iconType="regular">
  If you use `daon`, you have to explicitly define the vendor name in `provider` object.<br />
  see: [Multi IDV](/docs/v1/onesdk/oneSDK/implementation-guide/module/idv/multi-idv), implementation section.
</Callout>

<Callout icon="star" color="#3DD892" iconType="regular">
  You can specify the identity verification provider at runtime by passing the `provider` option when initializing the IDV flow.<br />
  see: [Multi IDV](/docs/v1/onesdk/oneSDK/implementation-guide/module/idv/multi-idv)
</Callout>

## Event System

<Info>
  The IDV module uses an event-driven architecture to communicate state changes and results.
</Info>

<AccordionGroup>
  <Accordion title="Core Events">
    <CardGroup cols={2}>
      <Card title="ready" icon="check-circle">
        Emitted when IDV is successfully mounted

        ```javascript theme={null}
        idv.on('ready', () => {
          console.log('IDV component is ready');
        });
        ```
      </Card>

      <Card title="detection_complete" icon="flag-checkered">
        Signals successful information detection

        ```javascript theme={null}
        idv.on('detection_complete', () => {
          setMounted(false); // Clean up
        });
        ```
      </Card>
    </CardGroup>
  </Accordion>

  <Accordion title="Result Events">
    <CodeGroup>
      ```typescript title="Results Event Handler" theme={null}
      idv.on('results', (checkStatus, document, entityId) => {
        switch(checkStatus) {
          case 'COMPLETE':
            // Handle successful verification
            break;
          case 'FAILED':
            // Handle failed verification
            break;
        }
      });
      ```

      ```typescript title="Results Event Data Structure" theme={null}
      interface ResultsEvent {
        checkStatus: 'COMPLETE' | 'FAILED';
        document: Object;
        entityId: string;
      }
      ```
    </CodeGroup>

    <Callout icon="thumbtack" color="#1A6CFF" iconType="regular">
      The results event provides comprehensive verification outcomes, including document data and entity references.
    </Callout>
  </Accordion>

  <Accordion title="Input Required Events">
    ```typescript theme={null}
    interface InputRequiredEvent {
      information: {
        entityId: string
      },
      checkStatus:
        | 'AWAITING_DOCUMENT_UPLOAD_INVALID_TYPE'
        | 'WAITING_DOC_UPLOAD'
        | 'WAITING_SELFIE_UPLOAD'
        | 'INCOMPLETE'
        | 'INTERRUPTED'
    }

    idv.on('input_required', (information, checkStatus) => {
      switch(checkStatus) {
        case 'WAITING_SELFIE_UPLOAD':
          console.log("Awaiting selfie capture");
          break;
        case 'WAITING_DOC_UPLOAD':
          console.log("Awaiting document upload");
          break;
        // Handle other states...
      }
    });
    ```

    <Callout icon="bell" color="#FFCA16" iconType="regular">
      For Incode integrations, the 'INTERRUPTED' status typically indicates missing camera permissions.
    </Callout>
  </Accordion>

  <Accordion title="Error Handling">
    ```typescript theme={null}
    interface ErrorEvent {
      message: string;
      payload: object;
    }

    idv.on('error', (error) => {
      console.error(`Error: ${error.message}`, error.payload);
      // Implement your error handling logic
    });
    ```

    <Callout icon="star" color="#3DD892" iconType="regular">
      For Incode integrations, refer to the [Incode documentation <Icon icon="arrow-up-right-from-square" size={12} />](https://docs.incode.com/docs/web/integration-guide/getting_started) for detailed error payload information.
    </Callout>
  </Accordion>
</AccordionGroup>

<Callout icon="star" color="#3DD892" iconType="regular">
  ##### Implementation Tips

  1. Always test the flow on both desktop and mobile devices
  2. Implement proper cleanup on component unmount
  3. Consider implementing retry logic for failed verifications
  4. Store the entityId for future reference
</Callout>

## Typical Vendor Flows

<Tabs>
  <Tab title="Onfido">
    <Steps>
      <Step title="Country Selection">
        Users select their country of origin
      </Step>

      <Step title="Document Selection">
        Users choose their identification document type
      </Step>

      <Step title="Document Upload">
        Users capture or upload their chosen document
      </Step>

      <Step title="Biometrics Process">
        System prepares for biometric capture
      </Step>

      <Step title="Biometric Capture">
        Users complete their biometric verification
      </Step>
    </Steps>

    <Callout icon="thumbtack" color="#1A6CFF" iconType="regular">
      Onfido provides a complete in-browser verification experience without requiring device switching.
    </Callout>
  </Tab>

  <Tab title="Incode">
    <Steps>
      <Step title="QR Code Generation">
        Desktop users receive a QR code to continue the process on mobile
      </Step>

      <Step title="Mobile Flow">
        1. Consent capture
        2. Document selection
        3. Document capture
        4. Biometrics verification
      </Step>
    </Steps>

    <Callout icon="bell" color="#FFCA16" iconType="regular">
      Incode requires a mobile device for optimal document and biometric capture.
    </Callout>
  </Tab>

  <Tab title="Daon">
    <Steps>
      <Step title="Daon Welcome Screen">
        Desktop users will land to the Daon welcome screen at the start

        <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/idv-daon-desktop-1.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=e0685da828a5c26c8065f91f5f0790e1" width="1668" height="1396" data-path="images/docs/idv-daon-desktop-1.png" />
      </Step>

      <Step title="QR Code Generation">
        Desktop users will receive a QR code to continue the process on mobile.
        Once users scan the QR code, they will be redirected to the Daon flow and
        in the desktop the screen changed to waiting for users to complete the flow

        <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/idv-daon-desktop-2.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=1cdd90f473f508207e0ccfa997064342" width="1664" height="1374" data-path="images/docs/idv-daon-desktop-2.png" />

        <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/idv-daon-desktop-3.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=0345f9743e472e8a85c2aeb5ba082fda" width="1664" height="1468" data-path="images/docs/idv-daon-desktop-3.png" />
      </Step>

      <Step title="Mobile Flow">
        1. Document selection

        <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/idv-daon-mobile-1.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=9e5d716f6ec280550e2cb1623b89f51f" width="400" height="889" data-path="images/docs/idv-daon-mobile-1.png" />

        2. Document capture

        <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/idv-daon-mobile-2.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=43487bf99465b69be180a065748491a3" width="400" height="889" data-path="images/docs/idv-daon-mobile-2.png" />

        <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/idv-daon-mobile-3-0.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=fd8ed19b0fb883fe0c82ca2db1afdcd9" width="400" height="889" data-path="images/docs/idv-daon-mobile-3-0.png" />

        <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/idv-daon-mobile-3-1.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=4e566e9566bb596a4896ba2ba167da3f" width="400" height="889" data-path="images/docs/idv-daon-mobile-3-1.png" />

        <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/idv-daon-mobile-3-2.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=d8b124788dc324f862f05c834f55ad66" width="400" height="889" data-path="images/docs/idv-daon-mobile-3-2.png" />

        3. Biometrics verification

        <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/idv-daon-mobile-4-1.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=e1cfb385e800f60b2c8d4a81dc48157f" width="400" height="889" data-path="images/docs/idv-daon-mobile-4-1.png" />

        4. Finish

        <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/idv-daon-mobile-5.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=d4e76bb600bb8e69feb890f0bf3455c9" width="400" height="889" data-path="images/docs/idv-daon-mobile-5.png" />
      </Step>
    </Steps>

    <Callout icon="bell" color="#FFCA16" iconType="regular">
      Daon requires a mobile device for optimal document and biometric capture.
    </Callout>
  </Tab>
</Tabs>

## Best Practices

<CardGroup cols={2}>
  <Card title="Error Handling" icon="shield-check">
    * Implement comprehensive error handling
    * Log errors for debugging
    * Provide user-friendly error messages
  </Card>

  <Card title="User Experience" icon="user">
    * Guide users through the verification process
    * Handle device transitions smoothly
    * Provide clear instructions at each step
  </Card>
</CardGroup>

<Callout icon="star" color="#3DD892" iconType="regular">
  You may need to adjust your Content Security Policy (CSP) settings to allow the IDV module to function correctly. Refer to <a href="/docs/v1/onesdk/oneSDK/implementation-guide#content-security-policy-csp-settings">this page</a> for more details.
</Callout>
