EMProtectorCapTokenDevice

@interface EMProtectorCapTokenDevice : EMProtectorTokenDevice

A class defining a device that generates CAP based OTPs.

  • - Since: 5.3
  • Creates a mode 1 OTP.

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

    Declaration

    Objective-C

    - (nullable NSString *)otpMode1WithPin:(nonnull NSString *)pin
                                 challenge:(nonnull NSString *)challenge
                                    amount:(nullable NSString *)amount
                              currencyCode:(nullable NSString *)currencyCode
                                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    func otpMode1(withPin pin: String, challenge: String, amount: String?, currencyCode: String?) throws -> String

    Parameters

    pin

    The pin.

    challenge

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

    amount

    The amount of the transaction. This value should only contain digits and can not 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.

    error

    If an error occurs, upon return contains an NSError object that describes the problem.

    Return Value

    The mode 1 OTP.

  • Creates a mode 1 OTP with AuthInput.

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

    Declaration

    Objective-C

    - (nullable NSString *)
        otpMode1WithAuthInput:(nonnull EMProtectorAuthInput *)authInput
                    challenge:(nonnull NSString *)challenge
                       amount:(nullable NSString *)amount
                 currencyCode:(nullable NSString *)currencyCode
                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    func otpMode1(with authInput: EMProtectorAuthInput, challenge: String, amount: String?, currencyCode: String?) throws -> String

    Parameters

    authInput

    The authInput.

    challenge

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

    amount

    The amount of the transaction. This value should only contain digits and can not 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.

    error

    If an error occurs, upon return contains an NSError object that describes the problem.

    Return Value

    The mode 1 OTP.

  • Creates a mode 2 OTP.

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

    Declaration

    Objective-C

    - (nullable NSString *)otpMode2WithPin:(nonnull NSString *)pin
                                     error:(NSError *_Nullable *_Nullable)error;

    Swift

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

  • Creates a mode 2 OTP with AuthInput.

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

    Declaration

    Objective-C

    - (nullable NSString *)
        otpMode2WithAuthInput:(nonnull EMProtectorAuthInput *)authInput
                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    func otpMode2(with authInput: EMProtectorAuthInput) throws -> String

    Parameters

    authInput

    The authInput.

    error

    If an error occurs, upon return contains an NSError object that describes the problem.

    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.

    Declaration

    Objective-C

    - (nullable NSString *)otpMode2TdsWithPin:(nonnull NSString *)pin
                                   dataToSign:(nonnull NSMutableArray *)dataToSign
                                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    func otpMode2Tds(withPin pin: String, dataToSign: NSMutableArray) throws -> String

    Parameters

    pin

    The pin.

    dataToSign

    The data to sign. 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.

    Return Value

    The mode 2 TDS OTP.

  • Creates a mode 2 transaction data signature OTP with authInput.

    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.

    Declaration

    Objective-C

    - (nullable NSString *)
        otpMode2TdsWithAuthInput:(nonnull EMProtectorAuthInput *)authInput
                      dataToSign:(nonnull NSMutableArray *)dataToSign
                           error:(NSError *_Nullable *_Nullable)error;

    Swift

    func otpMode2Tds(with authInput: EMProtectorAuthInput, dataToSign: NSMutableArray) throws -> String

    Parameters

    authInput

    The authInput.

    dataToSign

    The data to sign. 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.

    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.

    Declaration

    Objective-C

    - (nullable NSString *)otpMode3WithPin:(nonnull NSString *)pin
                                 challenge:(nonnull NSString *)challenge
                                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    func otpMode3(withPin pin: String, challenge: String) throws -> String

    Parameters

    pin

    The pin.

    challenge

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

    error

    If an error occurs, upon return contains an NSError object that describes the problem.

    Return Value

    The mode 3 OTP.

  • Creates a Mode3 OTP with AuthInput.

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

    Declaration

    Objective-C

    - (nullable NSString *)
        otpMode3WithAuthInput:(nonnull EMProtectorAuthInput *)authInput
                    challenge:(nonnull NSString *)challenge
                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    func otpMode3(with authInput: EMProtectorAuthInput, challenge: String) throws -> String

    Parameters

    authInput

    The authInput.

    challenge

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

    error

    If an error occurs, upon return contains an NSError object that describes the problem.

    Return Value

    The mode 3 OTP.

  • Checks if amount is required for a mode 1 operation.

    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

    Declaration

    Objective-C

    - (BOOL)isMode1CurrencyRequired;

    Swift

    func isMode1CurrencyRequired() -> Bool

    Return Value

    YES if amount is required, NO otherwise.