fix(android/security): allow device credential for the app lock - #730
Merged
Merged
Conversation
available() reports biometrics:false on a secure device with no enrolled biometric, so the lock was reported unavailable and enabling it always failed with no feedback. Use `any`, pass pinFallback so the prompt accepts the device credential, and surface the error when no screen lock is set up. Refs #681 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The JS peer of the plugin AuthenticationCallback gets collected while the device credential UI is in front, so onAuthenticationSucceeded ran on a fresh peer with default fields: it took the crypto branch and crashed on a null CryptoObject. Track the pending call in module scope, keep a reference to the callback and guard the null crypto object. Refs #681 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
available()resolves{ any: true, biometrics: false }there, and the old check only looked atbiometrics/touch/face(iOS-only fields). Availability now comes fromany.verifyBiometricis called withpinFallback: trueon Android, so the system prompt allowsDEVICE_CREDENTIALalongsideBIOMETRIC_STRONG— without it the plugin also fails at keystore key generation (setUserAuthenticationRequiredrequires an enrolled biometric). Prompt title is now translated. iOS is untouched (it already usesLAPolicy.DeviceOwnerAuthentication).Promise.allinapp.ts), and the startup lock check still runs when the lock is enabled.@nativescript/biometrics@1.3.1: authenticating with the device credential brings another activity to the front, the JS peer of the plugin'sAuthenticationCallbackgets collected, andonAuthenticationSucceededthen runs on a fresh peer with default fields — it took the crypto branch and crashed on a nullCryptoObject(TypeError: cannot read property 'getCipher' of null, uncaught on the main thread). The patch tracks the pending call in module scope, keeps a reference to the callback and guards the null crypto object. Worth sending upstream.biometric_lock_desc(English source only) — it advertised a "PIN code" that was never actually accepted.Testing
eslintandyarn svelte-checkclean (0 errors). No unit test possible — the service pulls the NativeScript runtime and the native plugin.Manual Android check:
Refs #681