OTPKit 0.1.6

OTPKit 0.1.6

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最后发布2017年1月
SwiftSwift 版本3.0
SPM支持 SPM

Chris Amanse 维护。



OTPKit 0.1.6

OTPKit

OTPKit 是一个包含一次性密码算法实现的 Swift 框架。

支持的算法

使用

生成基于时间的一次性密码

// 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

许可证

版权所有 © 2016 Joe Christopher Paul Amanse

此软件根据 MIT 许可证分发。