Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@caf.io/react-native-face-liveness

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@caf.io/react-native-face-liveness

CAF React Native library for face liveness

  • 1.4.0
  • npm
  • Socket score

Version published
Weekly downloads
363
increased by8.68%
Maintainers
3
Weekly downloads
 
Created
Source

@caf.io/react-native-face-liveness

About

The @caf.io/react-native-face-liveness library is a powerful tool for integrating facial liveness detection functionality into React Native applications. It allows developers to easily incorporate live facial verification, adding an extra layer of security.

Minimum Requirements

Android

SettingsMinimum version
minSdkVersion21
compileSdkVersion34
Java version8

iOS

SettingsMinimum version
Target12
Xcode13.4.1

Getting Started

yarn add @caf.io/react-native-face-liveness
# or 
npm install @caf.io/react-native-face-liveness

Usage

import React from 'react';
import { View, Button, StyleSheet } from 'react-native';
import { 
  startFaceLiveness,
  useFaceLiveness, 
  FaceLivenessOptions, 
  Stage, 
  Filter, 
  Time 
} from '@caf.io/react-native-face-liveness';

export default function App() {
  const mobileToken: string = "";
  const peopleId: string = "";

  const options: FaceLivenessOptions = {
    cafStage: Stage.PROD,
    filter: Filter.NATURAL,
    imageUrlExpirationTime: Time.THREE_HOURS,
    enableScreenshots: true,
    loadingScreen: true
  } // optional

  const { 
    result, 
    error, 
    cancelled, 
    isLoading 
  } = useFaceLiveness(options);

  return (
    <View style={styles.container}>
      <Button 
        title="Press" 
        onPress={() => startFaceLiveness(mobileToken, peopleId)} 
      />
    </View>
  );
} 

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Methods

startFaceLiveness

This method inicialize the face liveness.

Params

ParamTypeDefaultDescription
mobileTokenstringRequiredUsage token associated with your Identity account
peopleIdstringRequiredUser CPF

Hooks

useFaceLiveness

This hook provides the responses of method startFaceLiveness and make the settings for face liveness.

Params

ParamTypeDefaultDescription
optionsFaceLivenessOptionsOptionalSettings for the face liveness

Responses

FaceLivenessResponse

Types

FaceLivenessResult

NameTypeDescription
signedResponsestringSigned response from the CAF server confirming that the captured selfie has a real face. This parameter is used to get an extra layer of security, checking that the signature of the response is not broken, or caused by request interception. If it is broken, there is a strong indication of request interception.

signedResponse params

NameTypeDescription
requestIdstringRequest identifier.
isAlivebooleanValidation of a living person, identifies whether the user passed successfully or not.
tokenstringRequest token.
userIdstringUser identifier provided for the request.
imageUrlstringTemporary link to the image, generated by our API.
personIdstringUser identifier provided for the SDK.
sdkVersionstringSdk version in use.
iatstringToken expiration.

FaceLivenessError

NameTypeDescription
statusCodestringHttps code status
messagestringError message
errorErrorError enum

FaceLivenessResponse

NameTypeDescription
resultFaceLivenessResult or nullShows when face liveness returns a successful capture
errorFaceLivenessError or nullShows when the face livenes return some error
cancelledbooleanShows when user cancel the liveness
isLoadingbooleanShows when the face liveness is loading

FaceLivenessOptions

NameTypeDescription
cafStageStageChange the development environment
filterFilterChange face liveness mask
imageUrlExpirationTimeTimeChange the expiration time of the face liveness url
enableScreenshotsbooleanToggle user screenshots
loadingScreenbooleanToggle face liveness loading screen

Enums

Stage

EnumDescription
BETABeta environment
PRODProduction environment
DEVDevelopment environment

Filter

EnumDescription
LINE_DRAWINGAlternative mask for face liveness
NATURALNormal mask for face liveness

Time

EnumDescription
THREE_HOURSImage url expiration time expires in three hours
THIRTY_DAYSImage url expiration time expires in thirty days
THIRTY_MINImage url expiration time expires in thirty minutes

Error

EnumDescription
ServerReasonA server-side error/token invalidation occurred. The associated string (if available) will contain further information about the error.
NetworkReasonAn error occurred with the video streaming process. The associated string (if available) will contain further information about the error.
UnknownReasonAn unknown error has occurred. The associated string will contain further information about the error. These errors should be reported to iProov for further investigation.
UnexpectedReasonAn unxpected error has occurred
CameraPermissionThe user disallowed access to the camera when prompted. You should direct the user to re-try.

Keywords

FAQs

Package last updated on 28 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc