npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

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

v1.3.0

Published

CAF React Native library for face authenticator

Downloads

1,757

Readme

About

The @caf.io/react-native-face-authenticator 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 and authentication.

Minimum Requirements

Android

| Settings | Minimum version | | ----------------- | --------------- | | minSdkVersion | 21 | | compileSdkVersion | 34 | | Java version | 8 |

iOS

| Settings | Minimum version | | ----------------- | --------------- | | Target | 12 | | Xcode | 13.4.1 |

Getting Started

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

Usage

import React from 'react';
import { View, Button, StyleSheet } from 'react-native';
import { 
  startFaceAuthenticator,
  useFaceAuthenticator, 
  FaceAuthenticatorOptions, 
  Stage, 
  Filter, 
  Time 
} from '@caf.io/react-native-face-authenticator';

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

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

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

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

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

Methods

startFaceAuthenticator

This method inicialize the face authenticator.

Params

| Param | Type | Default | Description |
| -------------- | ------ | ------------ | ------------------------------------------------- | | mobileToken | string | Required | Usage token associated with your Identity account | | peopleId | string | Required | User CPF |

Hooks

useFaceAuthenticator

This hook provides the responses of method startFaceAuthenticator and make the settings for face authenticator.

Params

| Param | Type | Default | Description | | ----------- | ---------------------------- | ------------ | ------------------------------------------------- | | options | FaceAuthenticatorOptions | Optional | Settings for the face authenticator |

Responses

FaceAuthenticatorResponse

Types

FaceAuthenticatorResult

| Name | Type | Description | | -------------- | -------------- | -------------------------------------------------------- | | signedResponse | string | Signed 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

| Name | Type | Description | | ---------- | ------- | -------------------------------------------------------- | | requestId | string | Request identifier. | | isAlive | boolean | Validation of a living person, identifies whether the user passed successfully or not. | | token | string | Request token. | | userId | string | User identifier provided for the request. | | imageUrl | string | Temporary link to the image, generated by our API. | | personId | string | User identifier provided for the SDK. | | sdkVersion | string | Sdk version in use. | | iat | string | Token expiration. |

FaceAuthenticatorError

| Name | Type | Description | | ---------- | -------| -------------------------------------------------------- | | statusCode | string | Https code status | | message | string | Error message | | error | Error | Error enum |

FaceAuthenticatorResponse

| Name | Type | Description | | --------- | -------------- | ---------------------------------------------------------- | | result | FaceAuthenticatorResult or null | Shows when face authenticator returns a successful capture | | error | FaceAuthenticatorError or null | Shows when the face authenticator return some error | | cancelled | boolean | Shows when user cancel the face authenticator | | isLoading | boolean | Shows when the face authenticator is loading |

FaceAuthenticatorOptions

| Name | Type | Description | | ---------------------- | ------------------ | ---------------------------------------------------- | | cafStage | Stage | Change the development environment | | filter | Filter | Change face authenticator mask | | imageUrlExpirationTime | Time | Change the expiration time of the face liveness url | | enableScreenshots | boolean | Toggle user screenshots | | loadingScreen | boolean | Toggle face authenticator loading screen |

Enums

Stage

| Enum | Description | | ---- | ----------------------- | | BETA | Beta environment | | PROD | Production environment | | DEV | Development environment |

Filter

| Enum | Description | | ------------ | ---------------------------------- | | LINE_DRAWING | Alternative mask for face liveness | | NATURAL | Normal mask for face liveness |

Time

| Enum | Description | | ------------| --------------------------------------------------- | | THREE_HOURS | Image url expiration time expires in three hours | | THIRTY_DAYS | Image url expiration time expires in thirty days | | THIRTY_MIN | Image url expiration time expires in thirty minutes |

Error

| Enum | Description | | ----------------- | --------------------------------------------------- | | ServerReason | A server-side error/token invalidation occurred. The associated string (if available) will contain further information about the error. | | NetworkReason | An error occurred with the video streaming process. The associated string (if available) will contain further information about the error. | | UnknownReason | An unknown error has occurred. The associated string will contain further information about the error. These errors should be reported to iProov for further investigation. | | UnexpectedReason | An unxpected error has occurred | | CameraPermission | The user disallowed access to the camera when prompted. You should direct the user to re-try. |