add the ability to lock / unlock the wallet with user's device platform autheticator
Summary:
Allow user to enable / disable wallet lock on device that has a platform authenticator
A locked wallet will require user to authenticate in order to access it.
Test Plan:
cd web/cashtab
npm start
On device without Platform Authenticator (FaceID, TouchID, Windows Hello)
- make sure everything works as before
- make sure under Settings / General Settings / Lock App - "not support" is shown
On device with Platform Authenticator
- make sure that "Wallet Lock" page is shown
- click "Skip"
- make sure everything works as before
- make sure under Settings / General Settings / Lock App - a Toggle Switch is shown
- click on the switch to bring up the Platform Authenticator
- follow the instruction (scan your fingerprint, face id, or enter pin)
- upon successfully authenticate yourself, the Toggle Switch will be "ON"
- navigate away from the wallet (minimize the browser, or switch to another tab)
- navigate back to the wallet
- make sure the Platform Authenticator prompt apprears. (on PC, it may take a few seconds) + on platform that requires user gesture to invoke the Platform Authenticator (iOS, iPadOS), 'Wallet Unlock' page is shown instead + click "Unlock" button to bring up the Platform Authentictor
- follow the instruction on the authenticator prompt
- upon successfully authenticate yourself, make sure everything works as usual
On device with Platform Authenticator
- delete the authenticationConfig from IndexedDB
- make sure that "Wallet Lock" page is shown
- click "Enable Lock" to bring up the Platform Authenticator
- follow the instruction on the authenticator prompt
- upon successfully authenticate yourself, make sure everything works as before
- make sure that Settings / General Settings / Lock App - Toggle Switch in "ON"
- navigate away from the wallet (minimized the browser)
- navigate back to the wallet
- make sure the Platform Authenticator prompt appears + on platform that requires user gesture to invoke the Platform Authenticator (iOS, iPadOS), 'Wallet Unlock' page is shown instead + click "Unlock" button to bring up the Platform Authentictor
- follow the instruction on the authenticator prompt
- upon successfully authenticate yourself, make sure everything works as usual
- turn off the Settings / Geneneral Settings / Lock App - Toggle switch
- navigate away from the wallet, wait 1 to 2 seconds and navigate back to the wallet
- make sure that authentication is no longer required
Connect mobile device to your PC and run the same test
Or deploy to Netlify and test on different mobile devices
Reviewers: bytesofman, O1 Bitcoin ABC, #bitcoin_abc
Reviewed By: bytesofman, O1 Bitcoin ABC, #bitcoin_abc
Subscribers: emack
Differential Revision: https://reviews.bitcoinabc.org/D10443