### Clone and Navigate to Example Directory Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Clone the repository and change the directory to the example project to run the demo. ```shell git clone https://github.com/vouched/vouched-react-native cd vouched-react-native/example ``` -------------------------------- ### Install Dependencies and Pods Source: https://github.com/vouched/vouched-react-native/blob/master/example/README.md Install project dependencies using npm ci and then install iOS pods. ```shell # npm npm ci # pods cd ios && pod install && cd .. ``` -------------------------------- ### Set Public Key Source: https://github.com/vouched/vouched-react-native/blob/master/example/README.md Create a .env file in the example directory and add your Vouched public key. ```shell PUBLIC_KEY= ``` -------------------------------- ### Example of Using Params for Verification Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Demonstrates how to pass user input parameters to the Vouched API for verification. ```javascript const verifyParams = { "firstName" : "Joe", "lastName" : "Smith", "birthDate" : "07/27/1959" }; try { let job = await session.postFrontId(cardDetectionResult, verifyParams); ... } ``` -------------------------------- ### Install iOS Pods Manually Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Manually install iOS pods after linking the package. ```shell cd ios && pod install ``` -------------------------------- ### Start Metro Server Source: https://github.com/vouched/vouched-react-native/blob/master/example/README.md Start the Metro bundler server, which is necessary for running the React Native application. ```shell npm start ``` -------------------------------- ### Install Vouched React Native Package Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Add the Vouched React Native package to your project using npm. ```shell npm i -S @vouched.id/vouched-react-native ``` -------------------------------- ### Initialize VouchedSession Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Create a new VouchedSession instance with an API key and session parameters. ```javascript const session = new VouchedSession(apiKey, sessionParams); ``` -------------------------------- ### Add VouchedFaceCamera to View Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Import and use the VouchedFaceCamera component. It requires a ref for control and an onFaceStream callback. Liveness mode can be configured, and the component processes the face when the step is 'POSTABLE'. ```javascript import { VouchedFaceCamera } from '@vouched.id/vouched-react-native'; ... { const { instruction, step } = faceDetectionResult; if (step === "POSTABLE") { cameraRef.current.stop(); setMessage("Processing Image"); try { let job = await session.postFrontId(faceDetectionResult); let insights = await VouchedUtils.extractInsights(job); // optionally retry based on insights // proceed to next step } catch (e) { // handle error } } else { setMessage(instruction) } }} /> ``` -------------------------------- ### VouchedSession Initialization Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Initializes a new Vouched session with the provided API key and session parameters. This session object is used for the entire verification process. ```APIDOC ## VouchedSession Initialization ### Description Initializes a new Vouched session with the provided API key and session parameters. This session object is used for the entire verification process. ### Method `new VouchedSession(apiKey, sessionParams)` ### Parameters - **apiKey** (String) - Your Vouched Public Key. - **sessionParams** ([SessionParams](#sessionparams-object)) - An object containing parameters for the session, such as `callbackURL`. ``` -------------------------------- ### Initialize Session with Webhook Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Configure session parameters to include a callback URL for job completion notifications. ```javascript const sessionParams = { callbackURL: "https://webhook.site/97148fec-bd05-4c1f-8b03-ab16d0e6b212", properties: [], }; initSession(PUBLIC_KEY, sessionParams); ``` -------------------------------- ### Link Vouched React Native Package Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Link the Vouched React Native package to your project. ```shell react-native link @vouched.id/vouched-react-native ``` -------------------------------- ### Instruction String Enum Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Provides user instructions during the verification flow. ```string "ONLY_ONE" | "MOVE_CLOSER" | "MOVE_AWAY" | "HOLD_STEADY" | "OPEN_MOUTH" | "CLOSE_MOUTH" | "LOOK_FORWARD" | "BLINK_EYES" | "NO_CARD" | "NO_FACE" ``` -------------------------------- ### Add VouchedIdCamera to View Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Import and use the VouchedIdCamera component. It requires a ref for control and an onIdStream callback to handle detection results. The component processes the ID when the step is 'POSTABLE'. ```javascript import { VouchedIdCamera } from '@vouched.id/vouched-react-native'; ... { const { instruction, step } = cardDetectionResult; if (step === "POSTABLE") { cameraRef.current.stop(); setMessage("Processing Image"); try { let job = await session.postFrontId(cardDetectionResult); let insights = await VouchedUtils.extractInsights(job); // optionally retry based on insights // proceed to next step } catch (e) { // handle error } } else { setMessage(instruction) } }} /> ``` -------------------------------- ### Add VouchedBarcodeCamera to View Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Import and use the VouchedBarcodeCamera component. It requires a ref for control and an onBarcodeStream callback. The component processes the barcode when the step is 'POSTABLE'. ```javascript import { BarcodeCamera } from '@vouched.id/vouched-react-native'; ... { cameraRef.current.stop(); setMessage("Processing Image"); try { let job = await session.postBarcode(barcodeResult); let insights = await VouchedUtils.extractInsights(job); // optionally retry based on insights // proceed to next step } catch (e) { // handle error } } else { setMessage(instruction) } }} /> ``` -------------------------------- ### Open iOS Workspace Source: https://github.com/vouched/vouched-react-native/blob/master/example/README.md Open the iOS workspace file in Xcode to run the application on an iOS device. ```shell xed ios/example.xcworkspace ``` -------------------------------- ### Instruction Enum Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Provides instructions to the user during the verification process. ```APIDOC ## Instruction Enum ### Description Provides specific instructions to the user during the verification process to guide their actions. ### Values - **"ONLY_ONE"** - **"MOVE_CLOSER"** - **"MOVE_AWAY"** - **"HOLD_STEADY"** - **"OPEN_MOUTH"** - **"CLOSE_MOUTH"** - **"LOOK_FORWARD"** - **"BLINK_EYES"** - **"NO_CARD"** - **"NO_FACE"** ``` -------------------------------- ### SessionParams Object Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Parameters used to configure a Vouched session. ```APIDOC ## SessionParams Object ### Description Parameters used to configure a Vouched session, including callback URLs and group IDs. ### Fields - **callbackURL** (String?) - The URL to which callbacks will be sent. - **groupId** (String?) - An identifier for a group of sessions. - **properties** (Property[])? - An array of properties to configure the session. ``` -------------------------------- ### Run on Android Source: https://github.com/vouched/vouched-react-native/blob/master/example/README.md Build and run the React Native application on an Android device. ```shell react-native run-android ``` -------------------------------- ### Params Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Optional parameters for Vouched session calls, including user input for comparison. ```javascript { "birthDate": String?, "email": String?, "firstName": String?, "lastName": String?, "phone": String? } ``` -------------------------------- ### Property Object Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents a key-value pair property for session configuration. ```APIDOC ## Property Object ### Description Represents a key-value pair property used for session configuration. ### Fields - **name** (String) - The name of the property. - **value** (String) - The value of the property. ``` -------------------------------- ### SessionParams Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Parameters for configuring a verification session. ```javascript { "callbackURL": String?, "groupId": String?, "properties": Property[]? } ``` -------------------------------- ### POST Front ID Image Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Submits the front image of an ID document for verification. This method is part of the VouchedSession and requires card detection results and optional parameters. ```APIDOC ## POST Front ID Image ### Description Submits the front image of an ID document for verification. This method is part of the VouchedSession and requires card detection results and optional parameters. ### Method `session.postFrontId(cardDetectionResult, params)` ### Parameters - **cardDetectionResult** ([CardDetectResult](#carddetectresult-object)) - The result of card detection on the front ID image. - **params** ([Params](#params-object)) - Optional parameters for the request. ### Returns - **[Job](#job-object)** - The job object representing the verification process. ``` -------------------------------- ### Step String Enum Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents the current step in the identity verification process. ```string "PRE_DETECTED" | "DETECTED" | "POSTABLE" ``` -------------------------------- ### Property Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents a key-value pair for session properties. ```javascript { "name": String, "value": String, } ``` -------------------------------- ### Step Enum Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents the current step or stage in the verification process. ```APIDOC ## Step Enum ### Description Represents the current step or stage in the verification process. ### Values - **"PRE_DETECTED"** - **"DETECTED"** - **"POSTABLE"** ``` -------------------------------- ### Restart IdCamera Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Call the restart method on the camera ref to resume the IdCamera's operation. ```javascript cameraRef.current.restart(); ``` -------------------------------- ### Params Object with Optional User Input Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Parameters that can be sent to the API service during the verification process, including optional user input for comparison. ```APIDOC ## Params Object with Optional User Input ### Description Parameters that can be sent to the API service during the verification process. This includes standard parameters like ID images and selfies, as well as optional user input (verification properties) that can be compared against discovered values to determine job pass/fail status. ### Fields - **birthDate** (String?) - Optional user's birth date. - **email** (String?) - Optional user's email address. - **firstName** (String?) - Optional user's first name. - **lastName** (String?) - Optional user's last name. - **phone** (String?) - Optional user's phone number. ### Example Usage ```javascript const verifyParams = { "firstName" : "Joe", "lastName" : "Smith", "birthDate" : "07/27/1959" }; try { let job = await session.postFrontId(cardDetectionResult, verifyParams); // ... } catch (error) { // ... } ``` ``` -------------------------------- ### Post Front ID Image Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Submit the front image of an ID for verification. Requires card detection results and optional parameters. ```javascript const job = await session.postFrontId(cardDetectionResult, params); ``` -------------------------------- ### POST Back ID Image Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Submits the back image of an ID document for verification. This method is part of the VouchedSession and requires card detection results and optional parameters. ```APIDOC ## POST Back ID Image ### Description Submits the back image of an ID document for verification. This method is part of the VouchedSession and requires card detection results and optional parameters. ### Method `session.postBackId(cardDetectionResult, params)` ### Parameters - **cardDetectionResult** ([CardDetectResult](#carddetectresult-object)) - The result of card detection on the back ID image. - **params** ([Params](#params-object)) - Optional parameters for the request. ### Returns - **[Job](#job-object)** - The job object representing the verification process. ``` -------------------------------- ### Extract Job Insights Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Utilize VouchedUtils to extract insights from the job object. ```javascript const insights = await VouchedUtils.extractInsights(job); ``` -------------------------------- ### POST Re-verification Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Submits an image for re-verification against an existing job. This method is part of the VouchedSession and requires face detection results, a job ID, and the photo type to match against. ```APIDOC ## POST Re-verification ### Description Submits an image for re-verification against an existing job. This method is part of the VouchedSession and requires face detection results, a job ID, and the photo type to match against. ### Method `session.postReverify(faceDetectionResult, jobId, photoType)` ### Parameters - **faceDetectionResult** ([FaceDetectResult](#facedetectresult-object)) - The result of face detection on the image. - **jobId** (String) - The ID of the job to re-verify against. - **photoType** (String) - The type of photo to match against ('selfie' or 'id'). ### Returns - **[Job](#job-object)** - The job object representing the verification process. ``` -------------------------------- ### LivenessMode String Enum Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Defines the possible modes for liveness detection during verification. ```string "DISTANCE" | "MOUTH_MOVEMENT" | "BLINKING" | "NONE" ``` -------------------------------- ### AuthenticateResult Object Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents the result of an authentication process, typically indicating a match status. ```APIDOC ## AuthenticateResult Object ### Description Represents the result of an authentication process, typically indicating a match status. ### Fields - **match** (Number) - Indicates whether a match was found (e.g., 1 for match, 0 for no match). ``` -------------------------------- ### Post Back ID Image Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Submit the back image of an ID for verification. Requires card detection results and optional parameters. ```javascript const job = await session.postBackId(cardDetectionResult, params); ``` -------------------------------- ### POST Selfie Image Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Submits a selfie image for verification. This method is part of the VouchedSession and requires face detection results. ```APIDOC ## POST Selfie Image ### Description Submits a selfie image for verification. This method is part of the VouchedSession and requires face detection results. ### Method `session.postFace(faceDetectionResult)` ### Parameters - **faceDetectionResult** ([FaceDetectResult](#facedetectresult-object)) - The result of face detection on the selfie image. ### Returns - **[Job](#job-object)** - The job object representing the verification process. ``` -------------------------------- ### Post Selfie Image Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Submit a selfie image for verification. Requires face detection results. ```javascript const job = await session.postFace(faceDetectionResult); ``` -------------------------------- ### Reverse Port for Android Source: https://github.com/vouched/vouched-react-native/blob/master/example/README.md Reverse the TCP port for the Metro server on an Android device, which may be required if running in Android Studio. ```shell adb -s YOUR_DEVICE_ID reverse tcp:8081 tcp:8081 ``` -------------------------------- ### Confirm Verification Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Finalize the verification process and retrieve the job data. ```javascript const job = await session.confirm(); ``` -------------------------------- ### CardDetectResult Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Defines the structure of the data returned by the onIdStream callback. The image and distanceImage fields are optional. The data should only be posted when the step is 'POSTABLE'. ```json { "instruction" : String, "step": String, "image": String?, "distanceImage": String? } ``` -------------------------------- ### Job Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Defines the structure of a Job object, which contains the result, ID, errors, and token. ```json { "result": JobResult, "id": String, "errors": JobError[], "token": String } ``` -------------------------------- ### AuthenticateResult Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents the result of an authentication check, typically indicating a match. ```javascript { "match": Number } ``` -------------------------------- ### POST Confirm Verification Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Confirms the completion of the verification process. This method is part of the VouchedSession and should be called once all verification steps are complete to retrieve finalized job data. ```APIDOC ## POST Confirm Verification ### Description Confirms the completion of the verification process. This method is part of the VouchedSession and should be called once all verification steps are complete to retrieve finalized job data. ### Method `session.confirm()` ### Returns - **[Job](#job-object)** - The job object representing the finalized verification data. ``` -------------------------------- ### Stop IdCamera Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Call the stop method on the camera ref to halt the IdCamera's operation. ```javascript cameraRef.current.stop(); ``` -------------------------------- ### FaceDetectResult Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Defines the structure of the data returned by the onFaceStream callback. The image and userDistanceImage fields are optional. ```json { "instruction" : String, "step": String, "image": String?, "userDistanceImage": String? } ``` -------------------------------- ### Post Re-verification Image Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Submit an image for re-verification against an existing job ID. Specify 'selfie' or 'id' for photo type. ```javascript const authResult = await session.postReverify( faceDetectionResult, jobId, photoType ); ``` -------------------------------- ### Insight String Enum Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents insights or observations made during the verification process. ```string "UNKNOWN" | "NON_GLARE" | "QUALITY" | "BRIGHTNESS" | "FACE" | "GLASSES" ``` -------------------------------- ### LivenessMode Enum Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Specifies the type of liveness detection to be performed. ```APIDOC ## LivenessMode Enum ### Description Specifies the type of liveness detection to be performed during the verification process. ### Values - **"DISTANCE"** - **"MOUTH_MOVEMENT"** - **"BLINKING"** - **"NONE"** ``` -------------------------------- ### JobResult Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Defines the structure of the JobResult object, including details like ID, issue date, country, confidences, expiration date, success status, state, and name fields. ```json { "id": String?, "issueDate": String?, "country": String?, "confidences": JobConfidence, "expireDate": String?, "success": Boolean, "state": String?, "lastName": String?, "firstName": String?, "birthDate": String?, "type": String? } ``` -------------------------------- ### BarcodeResult Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Defines the structure of the data returned by the onBarcodeStream callback. The image and value fields are optional. ```json { "image": String?, "value": String? } ``` -------------------------------- ### JobError Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Defines the structure for error objects returned during a verification job. ```javascript { "type" : String, "message": String } ``` -------------------------------- ### JobError Object Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents an error that occurred during a job, including its type and a descriptive message. ```APIDOC ## JobError Object ### Description Represents an error that occurred during a job, including its type and a descriptive message. ### Fields - **type** (String) - The type of error. - **message** (String) - A message describing the error. ``` -------------------------------- ### Extract Job Insights Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Extracts insights from a completed job object. This utility method is provided by VouchedUtils. ```APIDOC ## Extract Job Insights ### Description Extracts insights from a completed job object. This utility method is provided by VouchedUtils. ### Method `VouchedUtils.extractInsights(job)` ### Parameters - **job** ([Job](#job-object)) - The job object from which to extract insights. ### Returns - **[Insight](#insight-string)[]** - An array of insight strings. ``` -------------------------------- ### JobConfidence Object Structure Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents the confidence scores for various aspects of an identity verification job. ```javascript { "id": Number?, "faceMatch": Number?, "idGlareQuality": Number?, "idQuality": Number?, "idMatch": Number?, "nameMatch": Number?, "selfie": Number?, "birthDateMatch": Number?, "idQuality": Number? } ``` -------------------------------- ### Insight Enum Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents insights or observations made during the verification process. ```APIDOC ## Insight Enum ### Description Represents insights or observations made during the verification process, such as quality assessments or detected features. ### Values - **"UNKNOWN"** - **"NON_GLARE"** - **"QUALITY"** - **"BRIGHTNESS"** - **"FACE"** - **"GLASSES"** ``` -------------------------------- ### JobConfidence Object Source: https://github.com/vouched/vouched-react-native/blob/master/README.md Represents the confidence scores for various aspects of a job, such as face matching and ID quality. ```APIDOC ## JobConfidence Object ### Description Represents the confidence scores for various aspects of a job, including face matching, ID quality, and name matching. ### Fields - **id** (Number?) - Confidence score for the ID. - **faceMatch** (Number?) - Confidence score for the face match. - **idGlareQuality** (Number?) - Confidence score for ID glare quality. - **idQuality** (Number?) - Confidence score for ID quality. - **idMatch** (Number?) - Confidence score for ID match. - **nameMatch** (Number?) - Confidence score for name match. - **selfie** (Number?) - Confidence score for the selfie. - **birthDateMatch** (Number?) - Confidence score for birth date match. - **idQuality** (Number?) - Confidence score for ID quality (duplicate field, likely intended to be different or an error in source). ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.