EMOathDevice Protocol Reference
| Conforms to | NSObject |
|---|---|
| Declared in | EMOathDevice.h |
– hotpWithAuthInput:error:
required method
Gets an event based OTP (HOTP).
- (id<EMSecureString>)hotpWithAuthInput:(id<EMAuthInput>)authInput error:(NSError **)errorParameters
authInput |
The authInput. |
|---|---|
error |
If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in |
Return Value
The OTP.
Availability
3.2
Discussion
Warning: Depending of the EMAuthInput type you are using, you may have to use this function asynchronously, please @see EMAuthInput for more details
Exceptions
NSInternalInconsistencyException |
When the associated token has the |
|---|
Declared In
EMOathDevice.h
– totpWithAuthInput:error:
required method
Gets a time based OTP (TOTP).
- (id<EMSecureString>)totpWithAuthInput:(id<EMAuthInput>)authInput error:(NSError **)errorParameters
authInput |
The authInput. |
|---|---|
error |
If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in |
Return Value
The OTP.
Availability
3.2
Discussion
Warning: Depending of the EMAuthInput type you are using, you may have to use this function asynchronously, please @see EMAuthInput for more details
Declared In
EMOathDevice.h
– ocraOtpWithAuthInput:serverChallengeQuestion:clientChallengeQuestion:passwordHash:session:error:
required method
Gets an OCRA OTP.
- (id<EMSecureString>)ocraOtpWithAuthInput:(id<EMAuthInput>)authInput serverChallengeQuestion:(id<EMSecureByteArray>)serverChallengeQuestion clientChallengeQuestion:(id<EMSecureByteArray>)clientChallengeQuestion passwordHash:(id<EMSecureByteArray>)passwordHash session:(id<EMSecureByteArray>)session error:(NSError **)errorParameters
authInput |
The authInput. |
|---|---|
serverChallengeQuestion |
The server question. mandatory field, cannot be |
clientChallengeQuestion |
The client 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. If you are not interested in possible errors, you may pass in |
Return Value
The OTP.
Availability
3.2
Discussion
Warning: Depending of the EMAuthInput type you are using, you may have to use this function asynchronously, please @see EMAuthInput for more details
Exceptions
NSInvalidArgumentException |
When the serverChallengeQuestion or the
|
|---|---|
NSInvalidArgumentException |
When the passwordHash is |
NSInvalidArgumentException |
When the session is not |
NSInvalidArgumentException |
When the session’s byte length is longer than the value returned by [EMSoftOathSettings ocraSessionLength]. |
NSInvalidArgumentException |
When the session cannot be decoded using UTF-8. |
NSInvalidArgumentException |
When the token’s key length is not compatible with the OCRA hash algorithm (see [EMSoftOathSettings ocraHashAlgorithm]). |
NSInternalInconsistencyException |
When the associated token has the
|
Declared In
EMOathDevice.h
– ocraPasswordHash:error:
required method
Gets password hash value according the algorithm defined by device settings.
- (id<EMSecureString>)ocraPasswordHash:(id<EMSecureString>)password error:(NSError **)errorParameters
password |
The password, can be |
|---|---|
error |
If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in |
Return Value
passwordHash
- The hash value of the password.
- 'nil' if password is 'nil' or hash algorithm for OCRA password is set to 'EMOcraPasswordNone' by the device settings
Declared In
EMOathDevice.h
– lastOtpLifespan
required method
Returns lifespan of the last OTP computed by this device.
- (NSInteger)lastOtpLifespanReturn Value
lifespan
- In case last OTP computed with this device is time-based
- If positive, the last OTP is still valid according current time and device's timestep settings. The returned value indicates the remaining seconds before the OTP becomes obsolete.
- If negative, the last OTP computed is obsolete. The absolute value indicates the time elapsed since the OTP has become obsolete.
- In case last OTP computed with this device is event-based, or no OTP has been computed yet, the function returns 'NSIntegerMax'
Availability
2.3
Discussion
The following example illustrates the usage.
// Create OATH settings
id
// Set up OATH time-based settings (for example a 30 seconds timestep) [oathSettings setTotpTimestepSize:30];
// Create a OATH device
id
// Compute a time-based OTP with device (with pin EMSecureString) [device getTotpWithPin:pin];
// Each time selector [… lastOtpLifespan] is called, it returns the // remaining lifespan in seconds of the last time-based OTP. Lifespan is // computed with respect of device’s settings (in this example it returns // the lifespan according the 30-seconds timestep). NSInteger lifespan = [device lastOtpLifespan];
Declared In
EMOathDevice.h