EMDcvOathDevice

Objective-C

@protocol EMDcvOathDevice <NSObject>

Swift

protocol EMDcvOathDevice : NSObjectProtocol

An DCV OATH device complying with the Standard Gemalto DCV options.

Since

4.1
  • Gets a time based DCV value as defined by the Standard Gemalto DCV options.

    Warning

    Depending of the EMAuthInput type you are using, you may have to use this function asynchronously, please see EMAuthInput for more details

    Since

    4.1

    Declaration

    Objective-C

    - (id<EMSecureString>)dcvWithAuthInput:(id<EMAuthInput>)authInput
                                     error:(NSError **)error;

    Swift

    func dcv(with authInput: (any EMAuthInput)!) throws -> any EMSecureString

    Parameters

    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 NULL.

    Return Value

    The DCV.

  • Returns lifespan of the last DCV computed by this device.

    • If positive, the last DCV is still valid according to current time and device’s timestep settings. The returned value indicates the remaining seconds before the DCV becomes obsolete.
    • If negative, the last DCV computed is obsolete. The absolute value indicates the time elapsed since the OTP has become obsolete.
    • In case no DCV has been computed yet, the function returns NSIntegerMax.

    The following example illustrates the usage

     // Create OATH DCV settings (see EMOathFactory)
    id<EMMutableSoftOathDcvSettings> oathDcvSettings = ...
    
    // Set up OATH DCV settings (for example a 20 minutes timestep)
    [oathDcvSettings setDcvTimeSettingsWithTimeStep:EMOathTimestepTypeMinutes timestepSize:20 starTime:0];
    
    // Create a OATH DCV device (see EMOathFactory)
    id<EMOathDcvDevice> device = ...
    
    // Compute DCV with device (with pin EMSecureString)
    [device getDcv:pin];
    
    // Each time selector [... lastDcvLifespan] is called, it returns the
    // remaining lifespan in seconds of the last time-based DCV. Lifespan is
    // computed with respect of device's settings (in this example it returns
    // the lifespan according the 20-minutes timestep)
    

    Since

    4.1

    Declaration

    Objective-C

    - (NSInteger)lastDcvLifespan;

    Swift

    func lastDcvLifespan() -> Int

    Return Value

    lifespan