Skip to main content

Logging & webhooks

Logging

The SDK provides a possibility to log users and SDK common actions (lifecycles events, navigation, camera changes). This can be useful for understanding specific scenarios or troubleshooting potential issues. To enable logging you need to provide your implementation of the IdenfyLoggingHandlerUseCase class. You can implement it like this:

        let consoleLogging = ConsoleLoggingImpl()
idenfyController.setIdenfyLoggingHandler(idenfyLoggingHandler: IdenfyLoggingHandlerUseCaseImpl(consoleLogging))
class ConsoleLoggingImpl {
func log(event: String, message: String, token _: String) {
print("SDKLog", event, " - ", message)
}
}
import iDenfySDK

class IdenfyLoggingHandlerUseCaseImpl: IdenfyLoggingHandlerUseCase {
private var consoleLogging: ConsoleLoggingImpl!

init(_ consoleLogging: ConsoleLoggingImpl) {
self.consoleLogging = consoleLogging
}

func logEvent(event: String, message: String, token: String) {
#if DEBUG
consoleLogging.log(event: event, message: message, token: token)
#endif
}
}

User events webhooks

SDK provides webhooks about events occurring throughout the verification process. Results will be delivered while the verification process is occurring and the application is presenting views of the SDK.

Declare a class for receiving events

Declare a class that implements IdenfyUserFlowHandler to call your backend service, log events, or apply changes.

import iDenfySDK

@objc public class IdenfyUserFlowCallbacksHandler: NSObject, IdenfyUserFlowHandler {
public func onPhotoUploaded(photo: String, step: String) {
print("IdenfyUserFlowHandler - onPhotoUploaded \(step)")
}

public func onDocumentSelected(documentType: String) {
print("IdenfyUserFlowHandler - onDocumentSelected \(documentType)")
}

public func onCountrySelected(issuingCountryCode: String) {
print("IdenfyUserFlowHandler - onCountrySelected \(issuingCountryCode)")
}

public func onProcessingStarted(processingStarted: Bool) {
print("IdenfyUserFlowHandler - onProcessingStarted \(processingStarted)")
}
}

Set the idenfyUserFlowCallbacksHandler

Set the idenfyUserFlowCallbacksHandler in the IdenfyController class:

...
idenfyController.setIdenfyUserFlowCallbacksHandler(idenfyUserFlowHandler: IdenfyUserFlowCallbacksHandler())
...