EMProtectorOathTokenDevice
@interface EMProtectorOathTokenDevice : EMProtectorTokenDevice
A class defining a device that generates OATH based OTPs.
- - Since: 5.3
-
Get OTP with PIN.
Declaration
Objective-C
- (nullable NSString *)otpWithPin:(nonnull NSString *)pin error:(NSError *_Nullable *_Nullable)error;
Swift
func otp(pin: String) throws -> String
Parameters
pin
The pin.
error
If an error occurs, upon return contains an
NSError
object that describes the problem.Return Value
The OTP.
-
Get OTP with AuthInput.
Declaration
Objective-C
- (nullable NSString *)otpWithAuthInput: (nonnull EMProtectorAuthInput *)authInput error:(NSError *_Nullable *_Nullable)error;
Swift
func otp(authInput: EMProtectorAuthInput) throws -> String
Parameters
authInput
The protectorAuthInput.
error
If an error occurs, upon return contains an
NSError
object that describes the problem.Return Value
The OTP.
-
Get the OCRA with PIN and given parameters.
Declaration
Objective-C
- (nullable NSString *)ocraWithPin:(nonnull NSString *)pin serverChallengeQuestion:(nonnull NSString *)serverChallengeQuestion clientChallengeQuestion:(nullable NSString *)clientChallengeQuestion passwordHash:(nullable NSData *)passwordHash session:(nullable NSString *)session error:(NSError *_Nullable *_Nullable)error;
Swift
func ocra(pin: String, serverChallengeQuestion: String, clientChallengeQuestion: String?, passwordHash: Data?, session: String?) throws -> String
Parameters
pin
The pin.
serverChallengeQuestion
The server challenge question.
clientChallengeQuestion
The client challenge question.
passwordHash
The hash value of password.
session
The session data.
error
If an error occurs, upon return contains an
NSError
object that describes the problem.Return Value
The OCRA OTP.
-
Get the OCRA with AuthInput and given parameters.
Declaration
Objective-C
- (nullable NSString *) ocraWithAuthInput:(nonnull EMProtectorAuthInput *)authInput serverChallengeQuestion:(nonnull NSString *)serverChallengeQuestion clientChallengeQuestion:(nullable NSString *)clientChallengeQuestion passwordHash:(nullable NSData *)passwordHash session:(nullable NSString *)session error:(NSError *_Nullable *_Nullable)error;
Swift
func ocra(authInput: EMProtectorAuthInput, serverChallengeQuestion: String, clientChallengeQuestion: String?, passwordHash: Data?, session: String?) throws -> String
Parameters
authInput
The authInput.
serverChallengeQuestion
The server challenge question.
clientChallengeQuestion
The client challenge question.
passwordHash
The hash value of password.
session
The session data.
error
If an error occurs, upon return contains an
NSError
object that describes the problem.Return Value
The OCRA OTP.
-
Gets password hash value according the algorithm defined on OCRA settings.
Declaration
Objective-C
- (nullable NSData *)ocraPasswordHash:(nonnull NSString *)password error:(NSError *_Nullable *_Nullable)error;
Swift
func ocraPasswordHash(_ password: String) throws -> Data
Parameters
password
The password.
error
If an error occurs, upon return contains an
NSError
object that describes the problem.Return Value
passwordHash The hash value of the password.
-
Returns lifespan of the last OTP computed by this token device for time-based OTP. In case last OTP computed is event-based, or no OTP has been computed yet, the function returns ‘NSIntegerMax’. Each time this function is called, it returns the remaining lifespan in seconds of the last time-based OTP. Lifespan is computed with respect of device’s settings.
Declaration
Objective-C
- (NSInteger)lastOtpLifeSpan;
Swift
func lastOtpLifeSpan() -> Int
Return Value
lifespan If positive, the last OTP is still valid according current time and token device. If negative,the last OTP computed is obsolete, it indicates the time elapsed since the OTP has become obsolete