EMCapDevice

Objective-C

@protocol EMCapDevice <NSObject>

Swift

protocol EMCapDevice : NSObjectProtocol

A protocol defining a device that generates CAP based OTPs.

  • Checks if amount is required for a mode 1 operation (otpMode1WithAuthInput:challenge:amount:currencyCode:error:)

    Declaration

    Objective-C

    - (BOOL)isMode1AmountRequired;

    Swift

    func isMode1AmountRequired() -> Bool

    Return Value

    YES if amount is required, NO otherwise.

  • Checks if currency is required for a mode 1 operation (otpMode1WithAuthInput:challenge:amount:currencyCode:error:)

    Declaration

    Objective-C

    - (BOOL)isMode1CurrencyRequired;

    Swift

    func isMode1CurrencyRequired() -> Bool

    Return Value

    YES if currency is required, NO otherwise.

  • Creates a mode 1 OTP.

    The typical use case of this OTP is for purchasing items from a merchant.

    Warning

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

    Since

    3.2

    Declaration

    Objective-C

    - (id<EMSecureString>)otpMode1WithAuthInput:(id<EMAuthInput>)authInput
                                      challenge:(id<EMSecureString>)challenge
                                         amount:(id<EMSecureString>)amount
                                   currencyCode:(NSString *)currencyCode
                                          error:(NSError **)error;

    Swift

    func otpMode1(with authInput: (any EMAuthInput)!, challenge: (any EMSecureString)!, amount: (any EMSecureString)!, currencyCode: String!) throws -> any EMSecureString

    Parameters

    authInput

    The authInput.

    challenge

    The merchant challenge: An unpredictable number of up to 8 hexdecimal digits.

    amount

    The amount of the transaction. This value should only contain digits and cannot be nil, empty string is a valid input. Minimum digit length is 0 and maximum is 12. The SDK takes the original value of the amount, there will be no truncate, rounding off or append. This feature should be done by the application.

    currencyCode

    The currency as an ISO 4217 currency code, for example “USD”. for United States Dollar. This value cannot be nil, empty string is a valid input.

    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 mode 1 OTP.

  • Creates a mode 2 OTP.

    The typical use case of this mode is for simple authentication.

    Warning

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

    Since

    3.2

    Declaration

    Objective-C

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

    Swift

    func otpMode2(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 mode 2 OTP.

  • Creates a mode 2 transaction data signature OTP.

    The typical use case of this mode is for signing a set of transaction data. One such example is to sign the destination bank account in a transaction.

    Warning

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

    Since

    3.2

    Declaration

    Objective-C

    - (id<EMSecureString>)otpMode2TdsWithAuthInput:(id<EMAuthInput>)authInput
                                        dataToSign:(NSArray *)dataToSign
                                             error:(NSError **)error;

    Swift

    func otpMode2Tds(with authInput: (any EMAuthInput)!, dataToSign: [Any]!) throws -> any EMSecureString

    Parameters

    authInput

    The authInput.

    dataToSign

    The data to sign (as an array of EMSecureString instances). Data should only contain digits, maximum 10 digit per data and maximum 10 data fields in the list. Don’t pass empty data, at least one non-empty data is required.

    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 mode 2 TDS OTP.

  • Creates a Mode3 OTP.

    The typical use case of this mode is for challenge/response. One such example is to log into a bank’s website.

    Warning

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

    Since

    3.2

    Declaration

    Objective-C

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

    Swift

    func otpMode3(with authInput: (any EMAuthInput)!, challenge: (any EMSecureString)!) throws -> any EMSecureString

    Parameters

    authInput

    The authInput.

    challenge

    The login challenge: An unpredictable number of up to 8 hexdecimal digits.

    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 mode 3 OTP.