tradle / react-native-facetec-zoom

10 stars 13 forks source link

Missing Parameters in the react-native-facetec-zoom Initialization #5

Closed h-ghandour closed 5 years ago

h-ghandour commented 5 years ago

Hey

I am trying to integrate zoOm sdk to react-native using what you guys have made , but i am facing an issue regarding facemapEncryptionKey that is being null.Is the issue something related to the way i am calling it or something wrong else is wrong ?

Screenshot_20190523_120132_com azevisa

` "use strict";

import { TouchableOpacity, View, Text } from "react-native"; import { detailsStyles } from "./styles"; import Zoom from "react-native-facetec-zoom";

import React from "react";

class Details extends React.Component { static navigationOptions = { title: "Details" };

constructor(props) { super(props); }

componentDidMount() { Zoom.preload(); // as early as possible for best performance this.verifyLiveness(); }

verifyLiveness = async () => { // ensure zoom is initialized // this only needs to be done once console.log(Zoom);

const { success, status } = await Zoom.initialize({
  appToken: "dHUZ8XvYP1g3mUcoMxDiBcr2ytL2EXNv",
  showPreEnrollmentScreen: false,
  showUserLockedScreen: false,
  showRetryScreen: false,
  enableLowLightMode: false,
  centerFrame: true
});
console.log("here");
if (!success) {
  // see constants.js SDKStatus for explanations of various
  // reasons why initialize might not have gone through
  throw new Error(`failed to init. SDK status: ${status}`);
}

// launch Zoom's verification process
const result = await Zoom.verify({
  // default to storing in ImageStoreManager to avoid sending base64 over bridge
  returnBase64: false,
  useOverlay: false
});

// result looks like this:
// {
//   "countOfZoomSessionsPerformed": 1,
//   "sessionId": "45D5D648-3B14-46B1-86B0-55A91AB9E7DD",
//   "faceMetrics": {
//     "livenessResult": "Alive",
//     "livenessScore": 86.69999694824219,
//     "auditTrail": [
//       "..base64 image 1..",
//       "..base64 image 2..",
//       "..base64 image 3.."
//     ],
//     "externalImageSetVerificationResult": "CouldNotDetermineMatch"
//   }
// }

} render() { return ( <View style={{ flex: 1 }}> <TouchableOpacity onPress={() => this.verifyLiveness()}> <Text style={{ color: "red" }}>verify Liveness ); } }

export default Details; `

h-ghandour commented 5 years ago

Tried to provide it with a facemapEncryptionKey as an extra parameter like this : `let pbkey =***;

const { success, status } = await Zoom.initialize({ appToken: "dHUZ8XvYP1g3mUcoMxDiBcr2ytL2EXNv", facemapEncryptionKey: pbkey showPreEnrollmentScreen: false, showUserLockedScreen: false, showRetryScreen: false, enableLowLightMode: false, centerFrame: true });`

which causes the app to crash instantly when trying to executing it

logs of the crash:

Screen Shot 2019-05-23 at 3 03 37 PM

mvayngrib commented 5 years ago

@hassang11 i think unless ur running your own zoom server, you should be using the encryption key they provide in the sample apps here https://dev.zoomlogin.com/zoomsdk/#/downloads

h-ghandour commented 5 years ago

@mvayngrib

[ANDRIOD] I had generated my own encryption key and used it like they described here : https://dev.zoomlogin.com/zoomsdk/#/android-guide

The issue is relted t the lack of paramters and documentation in the README.md i guess.

Thing is in the README.md file it's not docmentatedwell , since some parameters are missing making it hard for anyone reading this guide to be able to run ZoOm more smoothly on phone .

Intializing Zoom according the README.md file :

await Zoom.initialize({
    appToken: '.. get this from https://dev.zoomlogin.com/ ..',
    // optional customization options
    // see defaults.js for the full list
    showPreEnrollmentScreen: false,
    showUserLockedScreen: false,
    showRetryScreen: false,
    enableLowLightMode: false,
    centerFrame: true,
  })

should be :

await Zoom.initialize({
      appToken: "dHUZ8XvYP1g3mUcoMxDiBcr2ytL2EXNv",
      facemapEncryptionKey:
        "-----BEGIN PUBLIC KEY-----\n" +
        "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxrNuM7A71QdXsr4KwZdz\n" +
        "Mxx3/8FLzxlYoJKPNvDnwmZ+l6j5yFBorQTdp4AEZvxmxbRnhMgmSEg3fuvu+yhR\n" +
        "OVBHpER0ub75i63jVaZbQRiQn0xmta+GQri8B7kPmFoxIJE1KIKlRnSSsA6qP721\n" +
        "+MC4TzEPvme+kdB5qpmzHdko6O2pcfl9m2j9/+rPG8mPUQYBxDvrNuMVB08HRKvh\n" +
        "5wjK32C1n+79tLFh0ruaQbtddCljZtzX6lmbJEUwFDNH7KTuriUDUvkfk9Ocsecn\n" +
        "p3B5uLCsGmP7K2+KENJ0mN78VkDsTOZzLl0Lf8FKRTZr5GyPu/H+7LKhSXlga3By\n" +
        "6wIDAQAB\n" +
        "-----END PUBLIC KEY-----",
      showPreEnrollmentScreen: false,
      showUserLockedScreen: false,
      showRetryScreen: false,
      enableLowLightMode: false,
      centerFrame: true,
      topMargin: 20,
      sizeRatio: 40
    });

it misses 3 parameters topMargin, sizeRatio(I have filled them randomly just to make it work), and facemapEncryptionKey which makes the app crash with no error !!

as For [IOS]: I am still wrestling my way to make it work with these kind of errors : Screen Shot 2019-05-24 at 7 05 56 AM