OtpGeneratorContext
open class OtpGeneratorContext : NSObject
A class of Generator used to generate the one-time password.
-
Construct an instance containing the given secret, digits length and algorithm. Initialization returns
nil
if digits length is invalid.Declaration
Swift
public init?(secret: String, digits: Int = 6, algorithm: HmacAlgorithm = HmacAlgorithm.sha1)
Parameters
secret
The secret key used to generate the password.
digits
A value of 6 or 8 representing the length of the password to be generated. The default is 6.
algorithm
The algorithm used to generate the password. The default is
HmacAlgorithm.SHA1
.