class CrOTP::TOTP

Included Modules

Defined in:

crotp/totp.cr

Constant Summary

ALLOWED_ALGORITHMS = [OpenSSL::Algorithm::SHA1, OpenSSL::Algorithm::SHA256, OpenSSL::Algorithm::SHA512]
PERIOD = 30

Constructors

Instance Method Summary

Instance methods inherited from module CrOTP::OTP

base32_secret : String base32_secret

Constructor Detail

def self.new(secret : String, digits : Int = 6, algorithm : OpenSSL::Algorithm = OpenSSL::Algorithm::SHA1) #

[View source]

Instance Method Detail

def authenticator_uri(issuer : String, user : String) : String #

[View source]
def authenticator_uri(issuer : String) : String #

[View source]
def generate(at : Int = Time.utc.to_unix) : String #

[View source]
def generate(at : Time) : String #

[View source]
def verify(token : String, at : Int = Time.utc.to_unix, allowed_drift : Int = 0) : Bool #

[View source]
def verify(token : String, at : Time, allowed_drift : Int = 0) : Bool #

[View source]