/n software 3-D Secure V2 iOS Edition

Questions / Feedback?

Client Event Listener

The ClientEventListener class exposes a number of events that are fired at certain points during the SDK's operation. Below is a list of the available events:

DataPacketIn

Fired when receiving a data packet from the server.
class MyClientEventListener: ClientEventListener {
  ...
  func onDataPacketIn(_ dataPacket: Data) {
  	  //...
  }
  ...
}
This event fires when a packet is received. The entire data packet (including all framing and error detection characters) is contained in the dataPacket parameter. This parameter may be inspected for advanced troubleshooting, or to extract additional response properties beyond the scope of the SDK.

DataPacketOut

Fired when sending a data packet to the server.
class MyClientEventListener: ClientEventListener {
  ...
  func onDataPacketOut(_ dataPacket: Data) {
  	  //...
  }
  ...
}
This event fires right before each data packet is sent. The entire data packet (including all framing and error detection characters) is contained in the dataPacket parameter. This parameter may be inspected for advanced troubleshooting.

Log

Fires once for each log message.
class MyClientEventListener: ClientEventListener {
  ...
  func onLog(_ logLevel: Int32, _ message: String, _ logType: String) {
  	  print("[\(logType)]\(message)")
  }
  ...
}
Logging is handled through the Log event. This will fire any time a message is built or a response is parsed, including error messages.

When the Log event is fired, the message in question is made available via the message event parameter. The other event arguments are logType and logLevel.

The logType parameter indicates the type of the log entry. Possible values are:

  • Info
  • RequestHeaders
  • ResponseHeaders
  • RequestBody
  • ResponseBody
  • ProxyRequest
  • ProxyResponse
  • FirewallRequest
  • FirewallResponse
  • CReq
  • CRes
  • Erro
  • EphemeralKey
  • DeviceParams
  • SW

A logType of SW indicates a Security Warning. When this value is present, the message parameter will contain a code to indicate a more specific cause of the warning. Below is a list of possible warning message values and their meanings:

SW Message ValueDescription
01Tampered; installed from Ad-Hoc or XCode
02Tampered; invalid info dictionary
03Tampered; Info.plist was modified after the app was built
04Tampered; Bundle ID mismatch
05, XXJailbroken; suspicious jailbreak files present on the device
06, XXJailbroken; suspicious jailbreak library loaded
07, XXJailbroken; write permissions enabled on system directories
08Jailbroken; app has permission to fork
09, XXJailbroken; app can query jailbreak URL schemes
10Debugging; p_trace flag detected
11Debugging; internal error: cannot find sysctl
12Debugging; internal error: cannot find getpid
13Debugging; invalid PID
14, XXDebugging; reverse engineering tool detected on the device
15, XXDebugging; suspicious TCP port detected

The logLevel parameter in the event indicates the log level to which the current message belongs. Possible values are:

  • 0 - None
  • 1 - Info
  • 2 - Verbose
  • 3 - Debug
Info level logs are available by default. The LogLevel configuration setting, specified in the Client Config settings, can be used to instruct the SDK to raise more or less detailed logs.

It is recommended to output all messages raised in this event to a file for record keeping or troubleshooting purposes.

SSLServerAuthentication

Fired after the server presents its certificate to the client.
class MyClientEventListener: ClientEventListener {
  ...
  func onSSLServerAuthentication(_ certEncoded: Data, _ certSubject: String, _ certIssuer: String, _ status: String, _ accept: UnsafeMutablePointer<Int32>) {
  	//...
  }
  ...
}
This event fires when establishing a TLS connection and provides information about the server's certificate. The accept parameter indicates whether the certificate is trusted by default.

When accept is False, status shows why the verification failed (otherwise, status contains the string "OK"). If it is decided to continue, you can override and accept the certificate by setting the accept parameter to True.

SSLStatus

Shows the progress of the secure connection.
class MyClientEventListener: ClientEventListener {
  ...
  func onSSLStatus(_ message: String) {
  	  //...
  }
  ...
}
The event is fired for informational and logging purposes only. Used to track the progress of the connection.

Copyright (c) 2021 /n software inc. - All rights reserved.
/n software 3-D Secure V2 iOS Edition - Version 2.2 [Build 7954]