EMOtpTools Class Reference

Inherits from NSObject
Declared in EMOtpTools.h

Overview

The EMOtpTools class for utility functions like OTP scrambling and formatting functions. It was originally called EMToolBox.

+ scrambleOtpWithType:otp:

Computes a scrambled OTP from original OTP.

+ (id<EMSecureString>)scrambleOtpWithType:(EMScrambleType)type otp:(id<EMSecureString>)otp

Parameters

type

Specifies the type of scrambling function, See EMScrambleType define list of supported modes.

otp

Original OTP. Length must greater or equal to 5, lower than 18 and only digits are accepted.

Return Value

The scrambled OTP.

Declared In

EMOtpTools.h

+ formatOtpWithType:otp:

Formats the OTP with according provided mode.

+ (id<EMSecureString>)formatOtpWithType:(EMFormatType)type otp:(id<EMSecureString>)otp

Parameters

type

Specifies the type of formatting function, See EMFormatType define list of supported modes.

otp

Original OTP.

if mode is EMFormatTypeCap

Token length Formatted Token
1 X
2 XX
3 XXX
4 XXXX
5 XX XXX
6 XXX XXX
7 XXX XXXX
8 XXXX XXXX
9 XXX XXX XXX
10 XX XXXX XXXX
11 XXXXXXXXXXX
12 XXXXXXXXXXXX
>12 no change

Return Value

The formatted OTP.

Declared In

EMOtpTools.h

+ UTC

Gets the UTC time in milliseconds.

+ (unsigned long long)UTC

Return Value

The UTC time.

Declared In

EMOtpTools.h

+ padOtpWithZero:minLength:

left pad an OTP with Zero if needed.

+ (id<EMSecureString>)padOtpWithZero:(id<EMSecureString>)otp minLength:(int)minLength

Parameters

otp

OTP to pad.

minLength

The minimum length of the padded OTP. If minLength is lower than the OTP length, no padding is added and a copy of OTP is returned (so original one can be wiped).

Return Value

The OTP value left-padded.

Availability

2.4

Declared In

EMOtpTools.h