Skip to content
This repository has been archived by the owner on Jun 2, 2019. It is now read-only.

Add generic passwork checker before sending transaction #867

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented Jul 30, 2018

Referencing #830, I will create new coordinator for this one, and reuse the LockEnterPasscodeViewController.
I would like to get some info before finishing:

  1. Should we include biometric confirm, as well as passcode?
  2. Should we include 'Cancel' button for passcode screen? If so, should we store the current number of unsuccessful attempts?
  3. If the number of unsuccessful attempts is exceeded, should we log the user out?

@vikmeup
Copy link
Contributor

vikmeup commented Jul 30, 2018

@BloodyPixy I have added a new coordinator, forgot that name, take a look in the Lock coordinators. I haven’t done much tho.

@vikmeup
Copy link
Contributor

vikmeup commented Jul 30, 2018

Take a look at: https://github.com/TrustWallet/trust-wallet-ios/blob/55c1d9e48e3c9f5809fb2f1bd60c58cbac511e8b/Trust/Lock/Coordinators/AuthenticateUserCoordinator.swift

this has to be separated an tested.
In order to make this work you need to add an option settings to ask for confirmation.
Make sure use correct view model with messanging.

@vikmeup
Copy link
Contributor

vikmeup commented Jul 31, 2018

@BloodyPixy You need to pass view model that will describe actions!


let transaction = configurator.signTransaction
if needsPasscodeCheck {
delegate?.confirmPaymentControllerNeedsAuthentication(self)
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way to check this on coordinator level?

Copy link
Author

Choose a reason for hiding this comment

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

Done

…ansactions

* master:
  Add option to skip import main wallet
  Disable AuthenticateUserCoordinatorTests
  Version bump
  Use valueToSend()
  Add RPCServer as new parameter of the NonFungibleTokenObject. So now we could open nftokens. (#872)
  Fix an issue with adding extra ether to each transaction
  Enable deletion of the main wallet
  Average USD field update on QR code scanning. (#861)
Copy link
Contributor

@vikmeup vikmeup left a comment

Choose a reason for hiding this comment

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

@BloodyPixy can you add tests?

$0.title = self?.viewModel.verifyTransactionsWithPasscodeTitle
$0.value = self?.viewModel.isPasscodeTransactionLockEnabled
$0.hidden = Condition.function([Values.passcodeRow], { form in
return !((form.rowBy(tag: Values.passcodeRow) as? SwitchRow)?.value ?? false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do something along this:

var privateKeyRow: TextAreaRow? {
    return form.rowBy(tag: Values.privateKey)
}

Copy link
Author

Choose a reason for hiding this comment

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

you mean for passcodeRow, and use it instead of this
!((form.rowBy(tag: Values.passcodeRow) as? SwitchRow)?.value ?? false)
like this
!(self?.passcodeRow?.value ?? false),
did I get you right?

@@ -328,6 +349,12 @@ final class SettingsViewController: FormViewController, Coordinator {
self.autoLockRow.reload()
}

private func updatePasscodeTransactionLockRow(enabled: Bool) {
self.viewModel.isPasscodeTransactionLockEnabled = enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

do not use self

Copy link
Author

Choose a reason for hiding this comment

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

Done

}

var verifyTransactionsWithPasscodeTitle: String {
return NSLocalizedString("settings.lockTransactions.label.title", value: "Authenticate Transactions", comment: "")
Copy link
Contributor

Choose a reason for hiding this comment

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

Use R

Copy link
Author

Choose a reason for hiding this comment

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

Done


extension ConfirmCoordinator: ConfirmPaymentAuthenticationDelegate {
func confirmPaymentControllerNeedsAuthentication(_ controller: ConfirmPaymentViewController) {
guard let needsPasscodeCheck = PreferencesController()
Copy link
Contributor

Choose a reason for hiding this comment

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

This means you can modify user defaults to enable this feature?

It needs to be stored on keychain level then

Copy link
Author

Choose a reason for hiding this comment

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

Done

…ansactions

* master:
  Add new line with wallet name on Transaction Confirmation (#866)
  Mark wallet as main when imported
  Add link to help center (#876)

# Conflicts:
#	Trust.xcodeproj/project.pbxproj
@ghost
Copy link
Author

ghost commented Aug 3, 2018

I decided to put it inside of the lock. Seems logical to me, as we use Lock for keychain work with a passcode, and transaction authorization is directly connected to it. Good thing would be to have a new icon for this option in settings, as for now it uses same icon as Passcode app lock.

It works like this:

  1. User enables app passcode protection and sets the passcode
  2. New line in table appears with a switch to authorize transactions
  3. User can turn it 'on'
  4. If user turns App passcode lock off, transaction authorization will turn itself off as well.
  5. When user performs a transaction with Authorization turned on, app checks for this value, and presents passcode protection view.
  6. If the passcode is correct, transaction is executed.

…ansactions

* master:
  Move reload into separate function
  Crash: Signing on watch address via browser #885
  fix crash when signing on watch address via browser #885 (#887)
  Update localized string and use R
  Move into separate function
  Update Analitics.swift (#882)
  Link "Settings → Telegram Group" should open channel according to user's locale (#879)
  Improve currentWalletDescriptionString
  Move Help center higher in order
  Version Bump
@vikmeup
Copy link
Contributor

vikmeup commented Aug 6, 2018

Let's hold off on this one. It still requires UX/UI work to figure this out.

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

Successfully merging this pull request may close these issues.

None yet

2 participants