1.0.45 • Published 11 months ago
@gooddollar/react-native-facetec v1.0.45
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()
}
Update SDKs
Android
- Goto https://dev.facetec.com/downloads
- Download Android SDK
- Remove
./android/libs/*.aar
- Copy
./facetec-sdk-9.X.YY.aar
from android sdk archive to./android/libs
Web
- Goto https://dev.facetec.com/downloads
- Download Browser SDK
- Remove
./web/sdk/FaceTecSDK.web.js
./web/sdk/images/*.png
./web/sdk/resources/*.*
(keep folders) - Copy
./core-sdk/FaceTecSDK.js/FaceTecSDK.js
from browser sdk archive to./web/sdk/FaceTecSDK.web.js
(.web
suffix is mandatory) - Copy
./core-sdk/FaceTecSDK.js/resources/.
from browser sdk archive to
./web/sdk/resources/` - Copy
./core-sdk/FaceTec_images/*.png
from browser sdk archive to
./web/sdk/images/`
1.0.45
11 months ago
1.0.44
1 year ago
1.0.43
1 year ago
1.0.42
1 year ago
1.0.41
2 years ago
1.0.39
2 years ago
1.0.38
2 years ago
1.0.40
2 years ago
1.0.37
2 years ago
1.0.36
2 years ago
1.0.35
2 years ago
1.0.33
2 years ago
1.0.34
2 years ago
1.0.32
2 years ago
1.0.31
2 years ago
1.0.29
2 years ago
1.0.30
2 years ago
1.0.26
3 years ago
1.0.28
3 years ago
1.0.27
3 years ago
1.0.25
3 years ago
1.0.24
3 years ago
1.0.23
3 years ago
1.0.19
4 years ago
1.0.18
4 years ago
1.0.17
4 years ago
1.0.16
4 years ago
1.0.22
3 years ago
1.0.21
3 years ago
1.0.20
4 years ago
1.0.15
4 years ago
1.0.14
4 years ago
1.0.13
4 years ago
1.0.11
4 years ago
1.0.12
4 years ago
1.0.10
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago