To run the example project, clone the repo, and run pod install
from the Example directory first.
DU21SmartOTPSwiftt is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'DU21SmartOTPSwiftt'
kadkad195, dat.pham.kad@gmail.com
DU21SmartOTPSwiftt is available under the MIT license. See the LICENSE file for more info.
Easy implement Smart OTP into you projects.
- @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
- register listenser and expired handler
smartOTP.listenerOTP: Listener will return current otp and seconds before expired
smartOTP.listenerOTPExpired: Listener invoke when otp is expired
- 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")
- Use clear() when stop using
smartOTP.clear()
smartOTP.createTOTPFromShareKey(shareKey)