Skip to content

Instance Method

generate(counter:range:)

Generates several HOTP’s for a range.
func generate(counter: UInt64, range: Int) -> [String]

Parameters

counter

The ‘main’ counter.

range

The number of codes to generate in both the forward and backward direction. This number must be bigger than 0. For example, if range is 2, a total of 5 codes will be returned: The main code, the two codes prior to the main code and the two codes after the main code.

Return Value

All the generated OTP’s in an array.

Discussion

Note

This function will automatically wrap the counter by using integer overflow.