OTPKit is a Swift framework containing implementations of one-time password algorithms.
Supported Algorithms
// Shared unique secret (usually represented by a Base 32 string)
let base32String = "V3ZMBGAETLLSXRJZ6QZD42Z33O3DK3R7"
let secret = try! Base32.decode(base32String)
let passwordGenerator = TOTPGenerator(key: secret, period: 30, digits: 6, hashFunction: .sha1)
let now = Date()
try? passwordGenerator.password(for: now) // Password for current time
try? passwordGenerator.password(for: now + 30) // Password for 30 seconds from now
Copyright (c) 2016 Joe Christopher Paul Amanse
This software is distributed under the MIT License.