EMOtpTools
Objective-C
@interface EMOtpTools : NSObject
Swift
class EMOtpTools : NSObject
The EMOtpTools class for utility functions like OTP scrambling and formatting functions. It was originally called EMToolBox.
Since
4.0-
Computes a scrambled OTP from original OTP.
Declaration
Objective-C
+ (id<EMSecureString>)scrambleOtpWithType:(EMScrambleType)type otp:(id<EMSecureString>)otp;Swift
class func scrambleOtp(with type: EMScrambleType, otp: (any EMSecureString)!) -> (any EMSecureString)!Parameters
typeSpecifies the type of scrambling function, See EMScrambleType define list of supported modes.
otpOriginal OTP. Length must greater or equal to 5, lower than 18 and only digits are accepted.
Return Value
The scrambled OTP.
-
Formats the OTP with according provided mode.
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 |
Declaration
Objective-C
+ (id<EMSecureString>)formatOtpWithType:(EMFormatType)type otp:(id<EMSecureString>)otp;Swift
class func formatOtp(with type: EMFormatType, otp: (any EMSecureString)!) -> (any EMSecureString)!Parameters
typeSpecifies the type of formatting function, See EMFormatType define list of supported modes.
otpOriginal OTP.
Return Value
The formatted OTP.
-
Gets the UTC time in milliseconds.
Declaration
Objective-C
+ (unsigned long long)UTC;Swift
class func utc() -> UInt64Return Value
The UTC time.
-
left pad an OTP with Zero if needed.
Since
2.4Declaration
Objective-C
+ (id<EMSecureString>)padOtpWithZero:(id<EMSecureString>)otp minLength:(int)minLength;Swift
class func padOtp(withZero otp: (any EMSecureString)!, minLength: Int32) -> (any EMSecureString)!Parameters
otpOTP to pad.
minLengthThe 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.
EMOtpTools Class Reference