1.0.44 • Published 8 days ago

@gooddollar/react-native-facetec v1.0.44

Weekly downloads
348
License
MIT
Repository
github
Last release
8 days ago

ReactNative FaceTec SDK Integration

Getting started

$ npm install @gooddollar/react-native-facetec --save

Mostly automatic installation

$ react-native link @gooddollar/react-native-facetec

Usage

import FaceTec from '@gooddollar/react-native-facetec';
import Config from 'react-native-config'

const {
  REACT_APP_ZOOM_ENCRYPTION_KEY,
  REACT_APP_ZOOM_LICENSE_KEY,
  REACT_APP_ZOOM_LICENSE_TEXT,
  REACT_APP_SERVER_URL = 'http://localhost:3003',
  REACT_APP_SERVER_TOKEN,
  REACT_APP_ENROLLMENT_IDENTIFIER,
} = Config

// ... some component body
useEffect(() => {
  FaceTec.sdk.initialize(
    REACT_APP_SERVER_URL,
    REACT_APP_SERVER_TOKEN,
    REACT_APP_ZOOM_LICENSE_KEY,
    REACT_APP_ZOOM_ENCRYPTION_KEY,
    REACT_APP_ZOOM_LICENSE_TEXT
  )
  .then(() => { /* on initialized handler here */ })
  .catch(e => { /* initialized failed handler here */ })
}, [])

const onMyButtonClicked = useCallback(() => {
  FaceTec.sdk.enroll(REACT_APP_ENROLLMENT_IDENTIFIER, 3, 60000)
    .then(() => { /* verification successfull handler here */ })
    .catch(() => { /* verification failed handler here */ })
}, [])

Handling exceptions

import FaceTec, { FaceTecSDKStatus, FaceTecSessionStatus } from '@gooddollar/react-native-facetec';

// ...
FaceTec.sdk.initialize(...).then(...)
  .catch(exception => {
    // see platform API docs for complete status codes list
    if (exception.code === FaceTecSDKStatus.DeviceNotSupported) {
      // suggest user to use another device
    }
  })

FaceTec.sdk.enroll(...).then(...)
  .catch(exception => {
    // see platform API docs for complete status codes list
    if (exception.code === FaceTecSDKStatus.CameraPermissionDenied) {
     // show some help how to allow camera access on his platform/device
    }
  })

Listening events

import FaceTec, { FaceTecUxEvent } from '@gooddollar/react-native-facetec';

// ...
// subscribe
const subscriptions = [
  FaceTec.sdk.addListener(FaceTecUxEvent.UI_READY, () => { /* facetec was initialized and its UI was shown */ })),
  FaceTec.sdk.addListener(FaceTecUxEvent.CAPTURE_DONE, () => { /* user has finished capturing has face and request being sent to the FaceTec Custom Server */ }),
  FaceTec.sdk.addListener(FaceTecUxEvent.FV_RETRY, () => { /* FaceTec is asking user to retry face capture process */ }),
]

// unsubscribe
for (unsubscribe of subscriptions) {
  unsubscribe()
}
1.0.44

8 days ago

1.0.43

18 days ago

1.0.42

4 months ago

1.0.41

5 months ago

1.0.39

8 months ago

1.0.38

10 months ago

1.0.40

8 months ago

1.0.37

11 months ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.33

1 year ago

1.0.34

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.29

1 year ago

1.0.30

1 year ago

1.0.26

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.11

2 years ago

1.0.12

2 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago