Skip to content

Kadkad195/DU21SmartOTPSwiftt

Repository files navigation

DU21SmartOTPSwiftt

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

DU21SmartOTPSwiftt is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DU21SmartOTPSwiftt'

Author

kadkad195, dat.pham.kad@gmail.com

License

DU21SmartOTPSwiftt is available under the MIT license. See the LICENSE file for more info.

Easy implement Smart OTP into you projects.

Step1:

  • @param period: otp will be expired after that period. Default 30000 = 30s
  • @param digit: length of otp value. Default 6
  • @param generateTime: how many otp will be generated. Default 2
let smartOTP = DU21SmartOTP(period, digit, generateTime)
let shareKey = smartOTP.createShareKey("YOUR_SECRET") //Should be your PIN code + your device id

Then send this secret to server to register. Your server will use this secret to generate OTP too

Step2:

  • register listenser and expired handler
smartOTP.listenerOTP: Listener will return current otp and seconds before expired
smartOTP.listenerOTPExpired: Listener invoke when otp is expired 

Step3:

  • Each time create otp, inout your secret (PIN, password,....) as you use to generate shareKey to generate right OTP
  • If input wrong secret -> Your OTP will be wrong
smartOTP.createTOTP("YOUR_SECRET")

Step4:

  • Use clear() when stop using
smartOTP.clear()

Create TOTP From ShareKey:

smartOTP.createTOTPFromShareKey(shareKey)

Min: IOS 13. Must be Allow Arbitrary Loads

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published