Skip to content

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

Instance Methods

Type Methods

Relationships

Conforms To

  • Swift.Sendable
  • Swift.SendableMetatype

See Also

One-Time Passwords

  • HOTP
    Create a one-time password using hash-based message authentication codes.
  • OTPDigits
    Supported OTP output sizes.
  • OTPDigest
    Supported OTP digests.