Structure
TOTP
Create a one-time password using hash-based message authentication codes and taking uniqueness from the time.
struct TOTP
Overview
let key = SymmetricKey(size: .bits128)
let code = TOTP.SHA1(key: key).generate(time: Date())
print(code) "501247"
See HOTP for hash-based one-time passwords.
Topics
Initializers
init(key:digest:digits:interval:)Initialize the TOTP object.
Instance Methods
generate(time:)Generate the TOTP based on a time.generate(time:range:)Generates several TOTP’s for a range.
Type Methods
generate(key:digest:digits:interval:time:)Compute the TOTP for the key, time interval and time.
Relationships
Conforms To
Swift.SendableSwift.SendableMetatype