Git Product home page Git Product logo

aidee's Introduction

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

  • Swift 5.1
  • Xcode 11
  • iOS 11

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

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

Add the entry to your Cartfile:

github "aiFigueiredo/aiDee"

And then run the following command on the terminal:

carthage update

Add the package to your Package.swift file, under dependencies:

dependencies: [
    .package(url: "https://github.com/aiFigueiredo/aiDee.git", from: "1.0.1")
]

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.

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.