Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Error creating signature #181

Open
camboYY opened this issue Apr 2, 2022 · 11 comments
Open

Error: Error creating signature #181

camboYY opened this issue Apr 2, 2022 · 11 comments

Comments

@camboYY
Copy link

camboYY commented Apr 2, 2022

useBiometrics.ts:89 signature error: Error: Error creating signature
at Object.promiseMethodWrapper [as createSignature] (NativeModules.js:103)
at Object.createSignature (index.js:68)
at _callee4$ (VM6 useBiometrics.bundle:237)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:293)
at Generator.next (runtime.js:118)
at tryCatch (runtime.js:63)
at invoke (runtime.js:154)
at runtime.js:189
at tryCallTwo (core.js:45)

@alexfinset
Copy link

@camboYY If you'd be more specific with the reproduction steps.
In my case, I'm getting this error on Android when I enter pin instead of touch id.

The Android source code in CreateSignatureCallback.java below throws an exception in catch block.

    @Override
    public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) {
        super.onAuthenticationSucceeded(result);

        try {
          ...
        } catch (Exception e) {
            promise.reject("Error creating signature: " + e.getMessage(), "Error creating signature");
        }
    }

When I log this error, it says: android.security.KeyStoreException: Key user not authenticated

@sandergo90
Copy link

@jayfunk we also see this problem using version 2.2.0 using the following scenario:

  • Call the createKeys function
  • Call the createSignature function and don't use the fingerprint for example but enter the device pin code instead

Using the device pin code, you will receive android.security.KeyStoreException: Key user not authenticated. Setting setUserAuthenticationValidityDurationSeconds to a longer duration, fixes the problem that time. But I don't suppose that's the correct solution for this.

Can you check this please?

Thanks!

@vighfx
Copy link

vighfx commented Aug 18, 2022

@sandergo90 Curious if there was further solution that helped you resolve this? We have the same issue using device credentials, so really curious, thank you!

@sandergo90
Copy link

At the moment the fix from my comment did the trick. But still waiting for an explanation for it or a proper solution.

@jayfunk
Copy link
Member

jayfunk commented Sep 29, 2022

I have been able to recreate this issue but only on Android 31. Anything below 31 seems to work fine with the pin. @sandergo90 What duration did you set setUserAuthenticationValidityDurationSeconds to? I dont know if that is the right solution. I have been looking for options in 31.

@jayfunk
Copy link
Member

jayfunk commented Oct 19, 2022

I found a solution for the authentication error, but I ran into another issue where I was unable to verify the signed content with the new solution. Maybe someone can take a look at the PR #225 and see what I might have done that caused this regression.

@Theokalo
Copy link

Hello guys,
I am using the latest version 3.0.1 and I'm having the same problem.
I cannot create signature by using the pin code of the android phone. It always fails.
Do you have any update on this? Any workaround?

@deltasloth
Copy link

@Theokalo were you able to resolve the issue?

@aniket-holcim
Copy link

Hello guys,
I am trying to create signature on Android by entering pin code but it fails.
Do anyone have any update on this issue ?

@aniket-holcim
Copy link

@jayfunk we also see this problem using version 2.2.0 using the following scenario:

  • Call the createKeys function
  • Call the createSignature function and don't use the fingerprint for example but enter the device pin code instead

Using the device pin code, you will receive android.security.KeyStoreException: Key user not authenticated. Setting setUserAuthenticationValidityDurationSeconds to a longer duration, fixes the problem that time. But I don't suppose that's the correct solution for this.

Can you check this please?

Thanks!

Hi @sandergo90
Can you please let me know where to use 'setUserAuthenticationValidityDurationSeconds', as I need to integrate it in my project

@dbs-tuan
Copy link

@jayfunk we also see this problem using version 2.2.0 using the following scenario:

  • Call the createKeys function
  • Call the createSignature function and don't use the fingerprint for example but enter the device pin code instead

Using the device pin code, you will receive android.security.KeyStoreException: Key user not authenticated. Setting setUserAuthenticationValidityDurationSeconds to a longer duration, fixes the problem that time. But I don't suppose that's the correct solution for this.
Can you check this please?
Thanks!

Hi @sandergo90 Can you please let me know where to use 'setUserAuthenticationValidityDurationSeconds', as I need to integrate it in my project

You can follow this comment #253 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants