tidev / titanium-identity

A collection of API's to authenticate with your device: Keychain/Keystore, Touch ID and Face ID
Other
39 stars 28 forks source link

Error: CryptoObject cannot be null #301

Open jordanbisato opened 2 years ago

jordanbisato commented 2 years ago

Hi,

i get many crash logs like this in Firebase Crashlytics, but can't reproduce while debugging.

The most affected manufacturer is Samsung Galaxy.

Someone else get this error?

Non-fatal Exception: java.lang.Throwable at /alloy/controllers/login.js.Uncaught Error: CryptoObject cannot be null.(TiIdentity.authenticate({:553) at androidx.biometric.BiometricPrompt.authenticate(BiometricPrompt.java:939) at ti.identity.FingerPrintHelper.startListening(FingerPrintHelper.java:153) at ti.identity.TitaniumIdentityModule.authenticate(TitaniumIdentityModule.java:165) at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63) at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:985) at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1219) at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:260) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:246) at at Label.autenticar (login.js:553) at at Label.value (kroll.js:1604) at at Label.value (kroll.js:1656)

My code:

  var TiIdentity = require('ti.identity');
  var keychainItem = TiIdentity.createKeychainItem({
    identifier: '******',
    cancelTitle: "Cancelar",
    fallbackTitle: "Utilizar Senha",
});

  TiIdentity.authenticate({
    reason: 'Use sua impressão digital para logar',
    fallbackTitle: 'Usar senha',
    cancelTitle: 'Cancelar', 
    callback: function (e) {
        Ti.API.info('authenticate e: ' + JSON.stringify(e));
        if (e.success) {
            keychainItem.read();
        } else {
            TiIdentity.invalidate();
        }
    }
});
yuranevmer commented 1 year ago

The same. Did you find a solution?

jordanbisato commented 1 year ago

@yuranevmer Probably happened in this line, but i don't know how to solve it.

https://github.com/tidev/titanium-identity/blob/50b09e3f907bc8106c991dfdf3d0ce53dd08e4eb/android/src/ti/identity/FingerPrintHelper.java#L340

m1ga commented 1 year ago

can you check https://github.com/tidev/titanium-identity/pull/309

Shouldn't crash at that place now.

yuranevmer commented 1 year ago

thanks! I could not reproduce in single device. but I will check firebase crashlytics results with fixed version

jordanbisato commented 1 year ago

309 fix this error