GithubHelp home page GithubHelp logo

ventouchlock's Introduction

VENTouchLock

Build Status

VENTouchLock secures your app by requiring a Touch ID fingerprint scan or passcode to gain access when the app is launched cold or from the background. It is used in the official Venmo app.

Installation

The easiest way to get started is to use CocoaPods. Just add the following line to your Podfile:

pod 'VENTouchLock', '~> 1.0'

Usage

1. Create a splash view controller

VENTouchLock requires a custom splash view controller to hide the contents of your app during app-switch and present the Touch ID prompt or passcode view controller. In order to create one, subclass VENTouchLockSplashViewController and override its init function with any customization. The splash view controller is usually a good place to give your users the option to logout in case another user is attempting to sign in.

2. Start the framework

Add the VENTouchLock header file to your app delegate. Import this header in any of your implementation files to use the framework.

#import <VENTouchLock/VENTouchLock.h>

Add the following code to initialize VENTouchLock in your app delegate's application:didFinishLaunchingWithOptions: method.

[[VENTouchLock sharedInstance] setKeychainService:@"KEYCHAIN_SERVICE_NAME"
								  keychainAccount:@"KEYCHAIN_ACCOUNT_NAME"
                                    touchIDReason:@"TOUCHID_REASON"
                             passcodeAttemptLimit:ATTEMPT_LIMIT
                        splashViewControllerClass:[CUSTOM_SPLASH_VIEW_CONTROLLER class]];
  • KEYCHAIN_SERVICE_NAME: A service name used to set and return a passcode from Apple's Keychain Services interface. Example: Venmo
  • KEYCHAIN_ACCOUNT_NAME: An account name used to set and return a passcode from Apple's Keychain Services interface. Example: [email protected]
  • TOUCHID_REASON: A message displayed on the Touch ID prompt. Example: Scan your fingerprint to unlock
  • ATTEMPT_LIMIT: The maximum number of passcode attempts before the splash view controller fails to authenticate (Your app should logout when the user reaches this limit)
  • CUSTOM_SPLASH_VIEW_CONTROLLER: The name of the VENTouchLockSplashViewController subclass.

3. Set a passcode

In order for your users to enable Touch ID and / or a passcode, they must set a passcode. In the Venmo app, this option is in the settings page. To let your users create a passcode, use a VENTouchLockCreatePasscodeViewController.

4. Enable Touch ID

If the user's device supports Touch ID (i.e. [VENTouchLock canUseTouchID] returns YES), after setting a passcode prompt, allow the user to set an option to unlock with Touch ID. Set their preference with the VENTouchLock class method setShouldUseTouchID:(BOOL)preference

Sample Project

Check out the sample project in this repo for sample usage.

Contributing

We'd love to see your ideas for improving this library! The best way to contribute is by submitting a pull request. We'll do our best to respond to your patch as soon as possible. You can also submit a new Github issue if you find bugs or have questions. :octocat:

Please make sure to follow our general coding style and add test coverage for new features!

ventouchlock's People

Contributors

ayanonagon avatar dasmer avatar diogeneshamilton avatar duanhong169 avatar eliperkins avatar ericlewis avatar hyperspacemark avatar ianyh avatar jasdev avatar jesusantoniogil avatar maxmuermann avatar ronshapiro avatar scottphc avatar soffes avatar stevemoser avatar valeriomazzeo avatar zinthemoney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ventouchlock's Issues

Passcode persists between app installs

A passcode set by the user will persist after the user has removed the app and reinstalled. In effect this means that someone who removes the app then reinstalls at a later time will be presented with the lock screen and is required to enter the original password.

Steps to reproduce

  1. Given an app that has implemented VENTouchLock set up a passcode.
  2. Remove the app.
  3. Re-install the app.
  4. Re-launch newly installed app.

Expected Behavior

  • User should not be prompted for passcode set in a previous install.

Actual Behavior

  • User should is prompted for passcode set in a previous install.

Does not work in Swift

let viewController = VENTouchLockCreatePasscodeViewController()
    if let navigationController = self.navigationController {
navigationController.pushViewController(viewController, animated: true)
}
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/evgenii/Library/Developer/CoreSimulator/Devices/F0D6421C-E864-4818-A22F-137647C02EA4/data/Containers/Bundle/Application/D7448CC5-BC1B-43DC-80DA-38E8E809ECB7/Roscredit.app> (loaded)' with name 'VENTouchLockPasscodeView''
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001033b3a75 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000105179bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x00000001033b39ad +[NSException raise:format:] + 205
    3   UIKit                               0x000000010417b133 -[UINib instantiateWithOwner:options:] + 552
    4   UIKit                               0x000000010417cf92 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 160
    5   VENTouchLock                        0x0000000102e32ba1 -[VENTouchLockPasscodeView initWithTitle:frame:titleColor:characterColor:] + 289
    6   VENTouchLock                        0x0000000102e3327f -[VENTouchLockPasscodeView initWithTitle:frame:] + 207
    7   VENTouchLock                        0x0000000102e33353 -[VENTouchLockPasscodeView initWithFrame:] + 99
    8   VENTouchLock                        0x0000000102e333ec -[VENTouchLockPasscodeView init] + 92
    9   VENTouchLock                        0x0000000102e349c0 -[VENTouchLockPasscodeViewController configurePasscodeView] + 64
    10  VENTouchLock                        0x0000000102e34456 -[VENTouchLockPasscodeViewController viewDidLoad] + 406
    11  VENTouchLock                        0x0000000102e2f1c6 -[VENTouchLockCreatePasscodeViewController viewDidLoad] + 54
    12  UIKit                               0x0000000103fda580 -[UIViewController loadViewIfRequired] + 738

2.0 Wish List

Starting to think about a wish list for VENTouchLock V2.

My initial thoughts:

  • Option to show Touch ID on top of a passcode view controller instead of a splash view controller
  • Save Number of Incorrect Passcode Attempts in Keychain.
  • Create VENTouchLockOptions class (and move some stuff out of VENTouchLockAppearance)
    • This should handle embedding in Navigation Controller Options / Option to opt-in to to splash view controller, etc.
  • Option to show PIN entry in UIModalPresentationFormSheet style.

isPasscodeSet returning false occasionally

We have had an issue in production where isPasscodeSet is returning false and prompting the user to create a passcode even though they have created a passcode before, it seems to popup semi regularly for some users, and never for others. We are unsure what is causing this behavior, but it seems to be due to inactivity at times. Like waiting a few days, then opening the app and bam.

VENTouchLockAppearance should be more configurable.

I looks like you want us to be able to configure the look and feel of the VENTouchLockAppearance, but the only visual configuration option available is passcodeViewControllerBackgroundColor, which is kinda useless if you can't also adjust the text color, circle color etc... I want a dark background yet the colors are locked in at black.

As an enhancement request, it would be great to open up font choice, text color, attributed text options, circle color, etc...

User can't change passcode

Is there a way to allow the user to change their set passcode?
If not, can that feature be added without much effort?

Passcode view controoler can be Splash view controller?

Hi,
it's very useful and convenient library.

As title, I want to let users immediately see passcode view controller rather than popup from the bottom. If a user enable Touch ID functionality and press "Enter Passcode", UIAlertview will be just dismissed and then passcode view controller display.

So can I use VENTouchLockPasscodeViewController as splashViewControllerClass?

Thanks!

iPad Support & customization

Hi ,
I wanna ask about your control support for iPad and if there are any ways of customisation for the passcode view and text fields.

Thanks

iOS 11 Issue with TouchID

I am testing my app in iOS 11 and I found an issue in VENTouchLock.

When the app enters the background it calls [self lock] which in turn brings up the Touch ID prompt.

In iOS 10 and earlier the Touch ID screen would load inside the app and the user doesn't see it until they bring the app to the foreground. In iOS 11 beta 4 the Touch ID screen opens in the main window as soon the app is in the background.

If you authorise at that point then when the app comes to the foreground it is already unlocked.

I've made a video to explain it better. I can investigate a fix for this, but as the authors of this module I assume you will do a better job :)

2017-08-12 14 14 14

Demo automatically restart

Runing Demo in iPhone6(iOS9.2),Foreground state,Opened the Touch ID,and When I killed Demo,Demo will automatically restart .But if Demo didEnterBackground,it can be killed.

Does this work on iOS 7.1?

I wonder if it works on iOS 7.1, because on the simulator the demo fails with message:

"dyld: Symbol not found: _objc_isAuto
Referenced from: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/lib/libobjc.A.dylib
in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
"

Localization issue

Which is the official way to localize strings in this library, looks like this is impossible atm using cocoapods?

We would like to help

Hate to leave an issue for this, but the chime team (myself and zinthemoney) would love to tack on and help develop some possible 2.0 features. It would be really nice to do some localization for 2.0. We also have a few other ideas. But it would be nice to have either a public thread or a way for us to contribute our ideas. :)

Snapshotting looks like it doesn't work if splash vc has no background color

I end up with a Unbalanced calls to begin/end appearance transitions error and locking from background doesn't actually work. Well, it works in that you can't open the app without unlocking, but it doesn't snapshot correctly.

I haven't had time to investigate in detail. I'll probably also ask Crashlytics for any info they might have and can report back here.

Update for Face ID?

Just wondering if any plan on updating this framework align with Face ID?

Doesn't work on iOS 10

After setting the passcode, if user wants to show or delete the passcode, it says passcode is not set. Works fine on previous iOS versions.

Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.

Everything is working fine since the last update.
but still, i'm getting the following messages in the console:

Can't find keyplane that supports type 4 for keyboard iPhone-PortraitChoco-NumberPad; using 2382260317_PortraitChoco_iPhone-Simple-Pad_Default

and

Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.

Disabling touch id

After trying 3 times with a invalid finger print VENTouchLock disabled the TouchID option (canUseTouchId some how was set to false even considering that I'm testing it in an iPhone 6s)

Any idea about how to fix it?

Touch ID for Ipad2

Hi, I would like to ask if this library supports the touch id for ipad air2? We are currently working on an App and we tried using this library but in only works on iphones. Thanks

Nil result for parentSplashViewController

While debugging why recordIncorrectPasscodeAttempt was never called, I traced through the framework and found that parentSplashViewController is always nil. This is reproducible 100% in the sample app as-is.

I think the solution is to edit this line to return navController instead of nil if a navigation controller is not found, or at least do some more robust checking to determine the parent.

Random False Positive

isPasscodeSet sometimes return NO, even though passcode is set.

- (BOOL)isPasscodeSet
{
    return !![self currentPasscode];
}

This code is weird. Is there a better way to check whether or not SSKeychain sets password for the current account and service?

iPhone freeze

My iPhone is freezes sometime when I canceled alert of touch ID.

Keyboard doesn't appear if Touch ID if "Enter Passcode" is selected after a failed attempt

Using iOS 10.2

  1. Enable TouchID
  2. Attempt to unlock with wrong finger
  3. Choose "Enter Passcode"
  4. Passcode screen appears without the keyboard.

Looking at the debug view hierarchy, it's just not there.

It seems to be a timing issue. If I insert a wait (a lame workaround, I know) in requestTouchIDWithCompletion in LAErrorUserFallback, it appears.

response = VENTouchLockTouchIDResponseUsePasscode;
[NSThread sleepForTimeInterval: 0.001];

Not a great solution, but might help in tracking down a real one.

screen shot 2016-12-27 at 11 03 05 am
screen shot 2016-12-27 at 11 03 38 am
screen shot 2016-12-27 at 11 13 06 am

Keyboard dismiss delayed in Passcode VCs

In the passcode screens, the keyboard is dismissed with a delay when the user does cancel action. The issue is because you are dismissing the modal on cancel but the self.invisibleTextField is set to resignFirstResponder in the parent VC (VENTouchLockPasscodeViewController).

I fixed it in my fork by exposing invisibleTextField as public property in VENTouchLockPasscodeViewController and then on cancelTapped I first resignFirstResponder on the text field before dismissing the modal.

Ideally, I would try and dismiss the modal only on the presenting view controller. This gives me the opportunity to do any UI cleanups (for eg., resignFirstResponder) as well prevent any memory leaks that might be caused through delegation.

passcode

Keyboard doesn't appear if closed in Passcode-only

If you disable TouchID option and use Passcode-only option, the keyboard will not appear if you close/dismiss it once.
Functionally, it should reappear once you tap any of the boxes of Passcode to enter it, but it doesn't

Option to manually handle the UIApplication notifications / use own splash screen

I noticed you're taking feedback for the v2.0 release. We handle our splash/lock screen in a way that's different than VENTouchLock so I've subclassed VENTouchLock and overridden the UIApplication notification methods with empty stub methods. I then manually invoke the passcode functionality from our own splash screen that's not a subclass of VENTouchLockSplashViewController.

Perhaps the ability to decouple the splash/lock screen in some way would be useful to others as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.