PCSDKModule Documentation Beta

Structure PCKYCManager

public struct PCKYCManager

Works with PC KYC-Connector — a server component to perform the remote identification of the client before creating the key.

Properties

sessions

var sessions: [PCKYCSession]

The opened KYC sessions

Methods

start​Session(kyc​Info​JSON:​device​Token:​target​Queue:​completion:​)

public static func startSession(kycInfoJSON: String, deviceToken: String?, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<PCKYCSession, Error>) -> Void)

Creates and start session to interact with KYC-Connector using configuration from JSON

Includes following steps:

  1. Key pair generation
  2. Registration of public key
  3. Saving received session ID for further interaction

Parameters

kyc​Info​JSON String

The KYC-connector configuration in JSON format

device​Token String?

The device's token for PUSH-notifications

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<PCKYCSession, Error>) -> Void

A closure to be invoked after getting result

result

Returns the new PCKYCSession or error

start​Session(kyc​Connector​URL:​system​ID:​app​Extra:​device​Token:​target​Queue:​completion:​)

public static func startSession(kycConnectorURL: URL, systemID: String?, appExtra: [String: Any]?, deviceToken: String?, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<PCKYCSession, Error>) -> Void)

Creates and start session to interact with KYC-Connector

Includes following steps:

  1. Key pair generation
  2. Registration of public key
  3. Saving received session ID for further interaction

Parameters

kyc​Connector​URL URL

The url of the KYC-connector

system​ID String?

The identifier of the system paired with KYC-connector

app​Extra [String:​ Any]?

An additional information

device​Token String?

The device's token for PUSH-notifications

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<PCKYCSession, Error>) -> Void

A closure to be invoked after getting result

result

Returns the new PCKYCSession or error

close​Session(session:​)

public static func closeSession(session: PCKYCSession)

Closes the session and removes all it data

Parameters

session PCKYCSession

The session to be closed

get​Session​Status(session:​target​Queue:​completion:​)

public static func getSessionStatus(session: PCKYCSession, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<PCKYCSessionStatus, Error>) -> Void)

Retrieves the current status of the session

Parameters

session PCKYCSession

The session to be retrieved the status for

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<PCKYCSession​Status, Error>) -> Void

A closure to be invoked after getting result

result

Returns PCKYCSessionStatus or error

get​Required​Sources(session:​target​Queue:​completion:​)

public static func getRequiredSources(session: PCKYCSession, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<Set<PCKYCMediaType>, Error>) -> Void)

Gets required sources from server which must be uploaded again to succeed OCR

Parameters

session PCKYCSession

The session to be the required sources fetched for

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<Set<PCKYCMedia​Type>, Error>) -> Void

A closure to be invoked after getting result

result

Returns the set of PCKYCSourceType or error

get​Status​History(session:​target​Queue:​completion:​)

public static func getStatusHistory(session: PCKYCSession, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<[PCKYCSessionStatus], Error>) -> Void)

Gets status history

Parameters

session PCKYCSession

The session to be the history fetched for

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<[PCKYCSession​Status], Error>) -> Void

A closure to be invoked after getting result

result

Returns the array of PCKYCStatusHistoryItem or error

upload​Media(media​URL:​type:​session:​target​Queue:​completion:​)

public static func uploadMedia(mediaURL: URL, type: PCKYCMediaType, session: PCKYCSession, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<Void, Error>) -> Void)

Uploads the media of specified type to the server in order to perform an analysis

Parameters

media​URL URL

The url of the file to be uploaded

source​Type

The type of the media

session PCKYCSession

The session to be used for uploading media

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<Void, Error>) -> Void

A closure to be invoked after getting result

result

Returns nothing when success. Otherwise, returns error

upload​Media(data:​extension:​type:​session:​target​Queue:​completion:​)

public static func uploadMedia(data: Data, extension: String, type: PCKYCMediaType, session: PCKYCSession, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<Void, Error>) -> Void)

Uploads the media of specified type to the server in order to perform an analysis

Parameters

data Data

The data of the file to be uploaded

extension String

The extension of the media. E.g. 'png'.

source​Type

The type of the media

session PCKYCSession

The session to be used for uploading media

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<Void, Error>) -> Void

A closure to be invoked after getting result

result

Returns nothing when success. Otherwise, returns error

get​OCRResults(session:​target​Queue:​completion:​)

public static func getOCRResults(session: PCKYCSession, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<String, Error>) -> Void)

Gets results of OCR procedure. If OCR is done successfully, the results are returned as a raw string. Its content depends on the type of enabled analyser

Parameters

session PCKYCSession

The session to be used to get results

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<String, Error>) -> Void

A closure to be invoked after getting result

result

Returns OCR results or error

approve​OCRResults(session:​target​Queue:​completion:​)

public static func approveOCRResults(session: PCKYCSession, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<Void, Error>) -> Void)

Approves results of OCR. Supposed to be called after OCR is successful and user is shown the way their documents were processed

Parameters

session PCKYCSession

The session to be used to approve results

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<Void, Error>) -> Void

A closure to be invoked after getting result

result

Returns OCR results or error

decline​OCRResults(session:​target​Queue:​completion:​)

public static func declineOCRResults(session: PCKYCSession, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<Void, Error>) -> Void)

Declined results of OCR. Supposed to be called after OCR is successful and user is shown the way their documents were processed

Parameters

session PCKYCSession

The session to be used to decline results

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<Void, Error>) -> Void

A closure to be invoked after getting result

result

Returns OCR results or error

get​PCUser(session:​target​Queue:​completion:​)

public static func getPCUser(session: PCKYCSession, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<PCUser, Error>) -> Void)

Retrieves a PC key from server and returns PCUser object ready to be used in the app. This function is supposed to be called only when the session reaches status PCKYCSessionStatus.analysedSuccessfully

Parameters

session PCKYCSession

The session to be used to decline results

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<PCUser, Error>) -> Void

A closure to be invoked after getting result

result

Returns OCR results or error