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

@blusalt-sdk/react-native-blusalt-liveness

v0.1.21

Published

Liveness SDK for Android and IOS

Downloads

34

Readme

react-native-blusalt-liveness

Facial Comparison and Face Detection SDK for Android and IOS

Get your Liveness credentials from Blusalt

Features

Facial comparison (LivenessFacialComparisonType)

  1. Dynamic Liveness Detection (Motional): This method verifies liveness by requiring the user to perform specific actions like opening their mouth or shaking their head. It's strict because attempts to bypass the action (like holding a still image) will be detected and likely terminate the process.
  2. Static Liveness Detection (Still): This approach asks users to position their face within the camera frame and validates liveness based on facial data points. It's less strict than the dynamic method. If users struggle with finding the right camera position, the process might not automatically terminate, allowing them to adjust.

Face Detection (LivenessDetectionOnlyType)

  1. Dynamic Liveness Detection (Motional)
  2. Static Liveness Detection (Still)
  3. Flash Liveness Detection (Flash): This method is only available for facial detection, not facial comparison. It works similarly to the static method but increases the device screen brightness to enhance facial data point detection.

Installation

npm install react-native-blusalt-liveness

Usage

import { startFacialComparisonSDK, startLivenessDetectionOnlySDK, LivenessType } from '@blusalt-sdk/react-native-blusalt-liveness';

// ...
const clientId="";
const appName="";
const apiKey="";
const isDev: boolean=false;
const imageBase64 = "";

const threshold = 85; // Ranges from 0-100. Value can be null or undefined so default can be used
const timeoutDurationInSec = 120; // Custom timeout you want SDK to timeout. Integer only, Can be null or undefined, defaults to 120s


  let startFacialComparison = () => {
    startFacialComparisonSDK(clientId, appName, apiKey, isDev, imageBase64,  LivenessType.motional, threshold, timeoutDurationInSec, (responseJson: any) => {
      console.log(responseJson);
    });
  }

  let startLivenessDetectionOnly = () => {
    startLivenessDetectionOnlySDK(clientId, appName, apiKey, isDev, LivenessType.still, timeoutDurationInSec, (responseJson: any) => {
      console.log(responseJson);
    });
  }

Android Setup

Android

Step 1

Create a [github.properties] file in root of android folder and put below into content. E.g. "myReactApp/android/github.properties" Replace values with your github credentials from github and make sure to grant necessary permissions especially for github packages

USERNAME_GITHUB=SampleUsername
TOKEN_GITHUB=SampleClassicToken

Step 2

Add below to project level gradle file /android/build.gradle

buildscript {
    ext.kotlin_version = '1.9.+'
    ...

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.+'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    def githubPropertiesFile = rootProject.file("github.properties")
    def githubProperties = new Properties()
    githubProperties.load(new FileInputStream(githubPropertiesFile))


    repositories {

        maven {
            name "GitHubPackages"
            url 'https://maven.pkg.github.com/Blusalt-FS/Liveness-Only-Android-Package'

            credentials {
                username githubProperties['USERNAME_GITHUB']
                password githubProperties['TOKEN_GITHUB']
            }
        }
    }
}

Step 3

Change the minimum Android sdk version to 24 (or higher) in your /android/app/build.gradle file.


android {
    ...
    defaultConfig {
      ...
      minSdkVersion 24
    }
    ...
}

Step 4

If you're experiencing crashes or timeouts. Add below to your progaurd.pro file if using progaurd or minify is enabled /android/app/proguard-rules.pro

-keep public class com.megvii.**{*;}
-keep class net.blusalt.liveness_native.** { *; }

Enable proguard in /android/app/build.gradle file like below.


android {

    ...
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    ...
}

IOS Setup

Add below to your info.plist file to request camera permission /ios/${AppFolder}/info.plist

	<key>NSCameraUsageDescription</key>
	<string>Blusalt Reactnative Liveness requires camera for liveness</string>

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library