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

react-native-onfido-auth-sdk

v0.2.6

Published

The Onfido Authentication SDK provides a set of screens for React Native applications to capture 3D face scans for the purpose of identity authentication.

Downloads

20

Readme

react-native-onfido-auth-sdk

Table of contents

Overview

The Onfido Authentication SDK provides a set of screens for React Native applications to capture 3D face scans for the purpose of identity authentication.

Installation

yarn add react-native-onfido-auth-sdk

Usage

You can launch the app with a call to OnfidoAuth.start.

import { OnfidoAuth } from 'react-native-onfido-auth-sdk';
// ...
OnfidoAuth.start({ sdkToken: 'sdkToken' })
  .then(/* ... */)
  .catch(/* ... */);

1. Creating the SDK configuration

Once you have an added the SDK as a dependency and you have a SDK token, you can configure the SDK:

Example configuration:

config = {
  sdkToken: 'EXAMPLE-TOKEN-123',
  retryCount: 2,
}

2. Parameter details

  • sdkToken: Required. This is the JWT sdk token obtained by making a call to the SDK token API.
  • retryCount: Optional. This value is used to set the number of repeat attempts a user can do after the first unsuccessful try.

3. Success Response

Success is when the user has reached the end of the flow. The result has the verified, uuid and token properties. If authentication was successful, verified will be true and token will be the JWT. This JWT token can be used to validate the response.

Example:

{
  token: 'EXAMPLE-TOKEN-456',
  uuid: 'uuid',
  verified: true,
}

4. Failure Response

The SDK will reject the promise any time the OnfidoAuth SDK exits without a success. Error messages are not in a presentable format to the end user and are not localised.

UI Customization

iOS

You can customize the iOS UI by adding a customization.ios.json file to your project at the same level as your node_modules directory. The file should contain a single json object with the desired keys and values. For example:

{
  "onfidoPrimaryTextColor": "",
  "onfidoPrimaryTextDynamicDimmingColor": "",

  "onfidoPrimaryButtonColor": "#4BC0B1",
  "onfidoPrimaryButtonDynamicDimmingColor": "",
  "onfidoPrimaryButtonPressedColor": "#2EAC9C",
  "onfidoPrimaryButtonDisabledColor": "",
  "onfidoPrimaryButtonDisabledDynamicDimmingColor": "",
  "onfidoPrimaryButtonTextColor": "#FFFFFF",
  "onfidoPrimaryButtonTextDynamicDimmingColor": "",
  "onfidoPrimaryButtonTextPressedColor": "",
  "onfidoPrimaryButtonTextDisabledColor": "",
  "onfidoPrimaryButtonTextDisabledDynamicDimmingColor": "",

  "onfidoSecondaryButtonPressedColor": "",
  "onfidoDualSpinnerColor": "",
  "onfidoRetryScreenOvalStrokeColor": "",
  "onfidoUploadProgressFillColor": "",

  "onfidoButtonCornerRadius": 24,

  "onfidoFontRegular": "",
  "onfidoFontMedium": "", 
  "onfidoFontBold": ""
}

Once you've added the customization.ios.json to your project, you should add customization.ios.json file to your xcode project as bundle resource. You can create symbolic link (rather than copy paste) to prevent redundancy. Then when running on an iOS device the values will be picked up dynamically at runtime.

Below is a description of all available keys:

| Color | Description | | -----|-------| | onfidoPrimaryTextColor | Color of most text | | onfidoPrimaryTextDynamicDimmingColor | Color of text in Dynamic Dimming modeDynamic Dimming mode is automatically enabled in certain lighting conditions and will include UI differences such as the background turning black | | onfidoPrimaryButtonColor | Background color of buttons | | onfidoPrimaryButtonDynamicDimmingColor | Background color of buttons in Dynamic Dimming modeDynamic Dimming mode is automatically enabled in certain lighting conditions and will include UI differences such as the background turning black | | onfidoPrimaryButtonPressedColor | Background color of buttons while being pressed | | onfidoPrimaryButtonDisabledColor | Background color of buttons that are disabled | | onfidoPrimaryButtonDisabledDynamicDimmingColor | Background color of buttons that are disabled in Dynamic Dimming modeDynamic Dimming mode is automatically enabled in certain lighting conditions and will include UI differences such as the background turning black | | onfidoPrimaryButtonTextColor | Color of text in buttons | | onfidoPrimaryButtonTextDynamicDimmingColor | Color of text in buttons in Dynamic Dimming modeDynamic Dimming mode is automatically enabled in certain lighting conditions and will include UI differences such as the background turning black | | onfidoPrimaryButtonTextPressedColor | Color of text in buttons while being pressed | | onfidoPrimaryButtonTextDisabledColor | Color of text in buttons that are disabled | | onfidoPrimaryButtonTextDisabledDynamicDimmingColor | Color of text in buttons that are disabled in Dynamic Dimming modeDynamic Dimming mode is automatically enabled in certain lighting conditions and will include UI differences such as the background turning black | | onfidoSecondaryButtonPressedColor | Background color of secondary button (currently this is only the “Do not accept” button in the optional consent screen) | | onfidoDualSpinnerColor | Color of dual spinner rotating around selfie preview | | onfidoRetryScreenOvalStrokeColor | Stroke color of oval on ideal selfie image in retry screen | | onfidoUploadProgressFillColor | Color of completed portion of upload progress bar | | onfidoButtonCornerRadius | Corner radius of buttons (should be set to 40 maximum, otherwise will not work on some buttons) | | onfidoFontRegular | Name of font to use on regular text | | onfidoFontMedium | Name of font to use on medium text | | onfidoFontBold | Name of font to use on bold text |

Android

You can customize the Android UI by adding a customization.android.json file to your project at the same level as your node_modules directory. The file should contain a single json object with the desired keys and values. For example:

{
  "onfidoColorPrimaryDark": "",
  "onfidoTextColorPrimary": "",

  "onfidoPrimaryButtonTextColor": "#FFFFFF",
  "onfidoPrimaryButtonDisabledTextColor": "#FFFFFF",
  "onfidoPrimaryButtonColor": "#4BC0B1",
  "onfidoPrimaryButtonColorPressed": "#2EAC9C",
  "onfidoPrimaryButtonColorDisabled": "",

  "onfidoSecondaryButtonColor": "",
  "onfidoSecondaryButtonColorPressed": "",

  "onfidoColorAccent": "#4BC0B1",
  "onfidoAuthDualSpinnerColor": "",
  "onfidoAuthRetryScreenOvalStrokeColor": "",
  "onfidoUploadProgressFillColor": "",

  "onfidoPrimaryButtonColorDynamicDimmingMode": "",
  "onfidoPrimaryButtonColorPressedDynamicDimmingMode": "",
  "onfidoPrimaryButtonColorDisabledDynamicDimmingMode": "",

  "onfidoButtonCornerRadius": 32
}

Below is a description of all available keys:

| Color | Description | | -----|-------| | onfidoColorPrimaryDark | Color of the status bar | | onfidoColorAccent | Default color of certain UI elements such as dual spinner around selfie preview, oval around images in retry screen, and upload progress color. These elements can also be customised individually | | onfidoTextColorPrimary | Primary color of the texts used throughout the screens | | onfidoPrimaryButtonTextColor | Color of the text inside the primary action buttons | | onfidoPrimaryButtonDisabledTextColor | Color of the text inside the primary action buttons when disabled | | onfidoPrimaryButtonColor | Background color of the primary action buttons | | onfidoPrimaryButtonColorPressed | Background color of the primary action buttons when pressed | | onfidoPrimaryButtonColorDisabled | Background color of the primary action buttons when disabled | | onfidoSecondaryButtonColor | Background color of the secondary action buttons | | onfidoSecondaryButtonColorPressed | Background color of the secondary action buttons when pressed | | onfidoAuthDualSpinnerColor | Color of dual spinner rotating around selfie preview. This will override the default color provided by onfidoColorAccent | | onfidoAuthRetryScreenOvalStrokeColor | Stroke color of oval on ideal selfie image in retry screen. This will override the default color provided by onfidoColorAccent | | onfidoUploadProgressFillColor | Fill color of the uploading progress indicator bar. This will override the default color provided by onfidoColorAccent | | onfidoPrimaryButtonColorDynamicDimmingMode | Background color of the primary action buttons in dark mode | | onfidoPrimaryButtonColorPressedDynamicDimmingMode | Background color of the primary action buttons when pressed in dark mode | | onfidoPrimaryButtonColorDisabledDynamicDimmingMode | Background color of the primary action buttons when disabledin dark mode |

You can customize the corner radius of all buttons by providing onfidoButtonCornerRadius in your customization.android.json resource file.

Once you've added the customization.android.json to your project, you should run the following command at the same level of your node_modules directory.

$ npm --prefix node_modules/react-native-onfido-auth-sdk/ run customizeAndroid

Contributing

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

License

MIT