Skip to content

Micro-framework to enable and facilitate the use of LocalAuthentication (Touch / Face ID) on your iOS Projects

License

Notifications You must be signed in to change notification settings

plspalding/aiDee

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aiDee

aiDee (/ɪd/), noun

"... abbreviation for identification: any official card or document with your name and photograph or other information on it that you use to prove who you are."

iOS Biometrics Micro-Framework

aiDee is a Swift micro-framework that can be used to authenticate with iOS Devices using biometrics: Touch ID or Face ID. Written in Swift this aims to be a simple example of Apple's not-so-new LocalAuthentication API usage.

Platform Swift CocoaPods Carthage compatible SPM apm

Requirements

Xcode 11, iOS 11.0

Get Started

As a first step you should add an entry on your Info.plist file for key NSFaceIDUsageDescription.

The value should be a string describing the reason why your app uses Touch or Face ID. More information on this subject can be found on Apple's Documentation.

Installation

Cocoapods

aiDee is available through CocoaPods. Just add the following line to your PodFile:

pod 'aiDee'

And then run the following command on the terminal:

pod install

Carthage

Add the entry to your Cartfile:

github "aiFigueiredo/aiDee"

And then run the following command on the terminal:

carthage update

Usage

import aiDee
...

// Instantiate BiometricAuthentication object
let biometricAuth = BiometricAuthentication()

// Get Biometric Availability Information

let biometricsAvailable: Bool = biometricAuth.isBiometricsAvailable()
let biometricsType: BiometricType = biometricAuth.biometricType() // .touchId / .faceId / .none

// Authenticate using Biometrics providing a LocalizedString with a reason for the request

biometricAuth.authenticateUser(localizedReason: "Reason for Biometric request") { [weak self] result in
    switch result {
        case .success: self?.showAlert(title: "Success", message: "Biometric Auth Successful")
        case .failure(let error): self?.showAlert(title: "Error", message: error.errorDescription)
    }
}

Useful Tips

  • Both FaceID and TouchID can be tested in the simulator by selecting "Hardware" > "TouchID"/"FaceID" > "Enrolled"
  • This micro framework should be used alongside the use of Keychain to store sensitive information.

Contributing

Feel free to contribute to this project by opening issues or opening pull requests.

License

aiDee's available under the MIT license. See the LICENSE file for more information.

About

Micro-framework to enable and facilitate the use of LocalAuthentication (Touch / Face ID) on your iOS Projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 92.6%
  • Ruby 5.1%
  • Objective-C 2.3%