EMProtectorOathTokenDevice
Objective-C
@interface EMProtectorOathTokenDevice : EMProtectorTokenDevice
Swift
class 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 -> StringParameters
pinThe pin.
errorIf an error occurs, upon return contains an
NSErrorobject 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 -> StringParameters
authInputThe protectorAuthInput.
errorIf an error occurs, upon return contains an
NSErrorobject 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 -> StringParameters
pinThe pin.
serverChallengeQuestionThe server challenge question.
clientChallengeQuestionThe client challenge question.
passwordHashThe hash value of password.
sessionThe session data.
errorIf an error occurs, upon return contains an
NSErrorobject 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 -> StringParameters
authInputThe authInput.
serverChallengeQuestionThe server challenge question.
clientChallengeQuestionThe client challenge question.
passwordHashThe hash value of password.
sessionThe session data.
errorIf an error occurs, upon return contains an
NSErrorobject 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 -> DataParameters
passwordThe password.
errorIf an error occurs, upon return contains an
NSErrorobject 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() -> IntReturn 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
EMProtectorOathTokenDevice Class Reference