Ready to use on iOS 13+, tvOS 13+ & watchOS 6+
In Xcode go to File
-> Packages
-> Update to Latest Package Versions
and insert url:
https://github.com/sparrowcode/OTP
or adding it to the dependencies
value of your Package.swift
:
dependencies: [
.package(url: "https://github.com/sparrowcode/OTP", .upToNextMajor(from: "1.0.0"))
]
Specify it in your Podfile
:
pod 'OTP'
If you prefer not to use any of dependency managers, you can integrate manually. Put Sources/OTP
folder in your Xcode project. Make sure to enable Copy items if needed
and Create groups
.
// With default parametrs
let password = OTP.generateOTP(secret: "secret")
// With custom values
let password = OTP.generateOTP(secret: "secret", algorithm: OTPAlgorithm = .sha1, expirationTimeInSeconds: Int = 30, digits: Int = 6)
If you use a OTP
, add your application via Pull Request.