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

[Wallet] Pin Setup Flow v2 #1054

Merged
merged 10 commits into from
Sep 24, 2019
Merged

[Wallet] Pin Setup Flow v2 #1054

merged 10 commits into from
Sep 24, 2019

Conversation

jmrossy
Copy link
Contributor

@jmrossy jmrossy commented Sep 19, 2019

Description

  • Implement new Secure Wallet onboarding designs
  • Fix custom pincode flow (wasn't setting account password correctly)
  • Fix navigation to send flow from tab bar icon
  • Add caching of custom pincodes
  • Convert pincode thunks to Saga and add tests
  • Rename Pincode.tsx -> PincodeSet.tsx (and mostly redo)
  • Rename SystemAuth.tsx -> PincodeEducation.tsx
  • Add migration for new redux state around pincodeType
  • Add a Number Keypad component for in-app keypad
  • Add a backspace icon
  • Add an obfuscated Pincode text component
  • Improve error handling of pin setup screens

Tested

Ran through onboarding flow using both phone auth and custom pin
Sent a tx using both phone auth and custom pin
navigated to send flow

Related issues

Backwards compatibility

Yes but I needed to add a redux migration

wa-pin1
wa-pin1-5
wa-pin2
wa-pin3

@@ -133,7 +131,10 @@ export class JoinCelo extends React.Component<Props, State> {
}

nextScreen = () => {
const nextScreen = this.props.pincodeSet ? Screens.EnterInviteCode : Screens.Pincode
const nextScreen =
this.props.pincodeType === PincodeType.Unset
Copy link
Contributor

@martinvol martinvol Sep 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not completely sure, but I think here you have an edge case when the user does the onboarding flow and then disables the security of their phone (think likely to happen with people that only set up the PIN to use the app). It probably won't explicitly fail here but when they try to send a transaction getPinFromKeystore will just throw an error.

So I'd suggest checking every time ConfirmDeviceCredentials.isDeviceSecure(), specially when sending a transaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean this as a general point or something specific to this line? Because it seems unrelated to the JoinCelo page.

In the case where the user removes phone security after onboarding with it, throwing an error in getPinFromKeystore seems like the right thing to do. Is there an alternative you'd suggest?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a general point I meant.

Yeah, getting getPinFromKeystore to throw an error is the right call but I think it should be catched so the user can get redirected to the education screen again (maybe with a slightly different copy).

Copy link
Contributor Author

@jmrossy jmrossy Sep 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, if getPinFromKeystore throws an error (of any kind), then unlockAccount will catch it, causing getConnectedUnlockedAccount to then throw an IncorrectPin error. I agree it would be good to differentiate incorrect pin from missing phone auth but IIUC it would require modifying everywhere that getConnectedUnlockedAccount is used to handle that error case. Not too bad but still a bit out of scope for this PR I think. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, opened #1090!

Copy link
Contributor

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! 👍

@@ -109,6 +108,9 @@ export const TabNavigator = createBottomTabNavigator(
tabBarOnPress: () => {
navigate(Stacks.SendStack)
},
tabBarOnLongPress: () => {
navigate(Stacks.SendStack)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if (
pincodeCache.pincode &&
pincodeCache.timestamp &&
Date.now() - pincodeCache.timestamp < PIN_TIMEOUT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this could be bypassed by changing the system time. Would be better to use a monotonic clock. https://stackoverflow.com/questions/7272395/monotonically-increasing-time-in-javascript

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add a TODO for this

@@ -31,4 +32,17 @@ describe('Redux persist migrations', () => {
const migratedSchema = migrations[1](v0Stub)
expect(migratedSchema.app.language).toEqual('es-419')
})

it('work for v1 to v2', () => {
const defaultSchema = getLatestSchema()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it should take v1Schema here instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in this and the other tests :)

...state,
account: {
...state.account,
pincodeType: state.account.pincodeSet ? PincodeType.PhoneAuth : PincodeType.Unset,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though it's harmless, we should clean up the old property by adding pincodeSet: undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done

<View style={style.row}>
{props.showDecimal ? (
<Touchable borderless={true} onPress={props.onDecimalPress}>
<Text style={style.digit}>.</Text>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be incorrect for some locales.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I haven't i18n'ed this yet, will add a TODO

)
}

export default function NumberKeypad(props: Props) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually don't like custom keyboards as they break my expectations (can't use integration with password managers, or swipe style input).
Sure we really want our own? I understand it's for security reasons, but if the system keyboard is compromised I'm not entirely convinced a custom keypad will actually prevent much.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do custom keyboards have any trouble on low end phones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of apps use custom keyboards for digits because the android numeric keyboard type varies so much across different phone vendors. And many look terrible.

@annakaz not sure why this component would cause problems on low end phones. If anything the experience is better because the component doesn't resize/redraw as the keyboard pops in and out

@annakaz annakaz removed their assignment Sep 23, 2019
@ashishb ashishb closed this Sep 24, 2019
@ashishb ashishb deleted the rossy/wa-security-choice branch September 24, 2019 01:28
@ashishb ashishb restored the rossy/wa-security-choice branch September 24, 2019 01:36
@ashishb ashishb reopened this Sep 24, 2019
@codecov
Copy link

codecov bot commented Sep 24, 2019

Codecov Report

Merging #1054 into master will decrease coverage by 0.49%.
The diff coverage is 54.16%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1054     +/-   ##
=========================================
- Coverage   66.94%   66.45%   -0.5%     
=========================================
  Files         252      256      +4     
  Lines        7322     7349     +27     
  Branches      415      424      +9     
=========================================
- Hits         4902     4884     -18     
- Misses       2334     2377     +43     
- Partials       86       88      +2
Flag Coverage Δ
#mobile 66.45% <54.16%> (-0.5%) ⬇️
Impacted Files Coverage Δ
packages/mobile/src/redux/store.ts 96% <ø> (ø) ⬆️
packages/mobile/src/language/Language.tsx 74.07% <ø> (+1.66%) ⬆️
packages/mobile/src/backup/BackupIntroduction.tsx 73.33% <ø> (ø) ⬆️
packages/mobile/src/web3/actions.ts 81.48% <ø> (+3.43%) ⬆️
packages/mobile/src/import/ImportContacts.tsx 75% <ø> (ø) ⬆️
packages/mobile/src/config.ts 94.11% <ø> (-0.33%) ⬇️
packages/mobile/src/navigator/Navigator.tsx 0% <0%> (ø) ⬆️
packages/mobile/src/navigator/TabNavigator.tsx 0% <0%> (ø) ⬆️
packages/mobile/src/pincode/PincodeEducation.tsx 0% <0%> (ø)
...ackages/mobile/src/pincode/PincodeUtils.android.ts 0% <0%> (ø)
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f80e93d...0174b74. Read the comment docs.

@jmrossy jmrossy merged commit 34a29d9 into master Sep 24, 2019
@jmrossy jmrossy deleted the rossy/wa-security-choice branch September 24, 2019 12:14
aaronmgdr added a commit that referenced this pull request Sep 25, 2019
* master: (61 commits)
  Remove locales as website is now just in English (#1050)
  Add MetadataURL to account struct (#1103)
  Allow validators to use any valid combination of gold commitments as stake (#885)
  Fix blockscout websocket jsonrpc url (#1096)
  [Wallet] Preliminary iOS support (#1098)
  [Wallet] Set security fee description translation in Spanish (#1097)
  Exclude generated in vscode file watcher setting (#1082)
  Update .env and .env.integration files (#1087)
  Allow a testnet to run without ethstats (#1085)
  Collect exchange rate time series using notification service (#1020)
  Return to preview view when Fee Education is closed (#1068)
  [Wallet] Pin Setup Flow v2 (#1054)
  Added a variable for electoral threshold (#1023)
  [celotool]Store .env config on GCS after deployment (#1086)
  Group size limit (#1035)
  Fix governance unit tests (#1084)
  Add getExchangeRate to ContractKit (#1083)
  [CLI]Unlock till the geth exits (#1070)
  Add Quorum and Refactor Governance (#430)
  Shuffle elected validators using block randomness (#1033)
  ...
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

Successfully merging this pull request may close these issues.

Users SBAT choose between system auth or pincode Send flow sometimes shows a blank white screen
7 participants