PCSDKModule Documentation Beta

Class PCSDK

final public class PCSDK

The root class of The PCSDK

Configures initial variables, setting up logging levels

Nested Types

PCSDK.Mode

SDK's using mode

Properties

version

var version: String

The current version of the SDK (e.g. 5.0.265)

api​Version

var apiVersion: Int

The maximum supported version of the server API

now

var now: Date

The current date with synced time offset

default​Database​File​Name

let defaultDatabaseFileName: String = "PCStorage.sqlite"

The default database file name

url​Session

var urlSession: URLSession = .sdkSession

The instance of URLSession with .ephemeral configuration which performs all network requests.

default​Database​URL

var defaultDatabaseURL: URL

The default url for users database

requests​Timeout​Interval

var requestsTimeoutInterval = 30.0

The timeout interval of network requests. The default value is 30 seconds

Methods

initialize(database​URL:​access​Group:​mode:​)

public static func initialize(databaseURL: URL? = nil, accessGroup: String? = nil, mode: Mode = .app)

Initializes the SDK

Parameters

database​URL URL?

The url for storing users data. If it is not set - SDK will use the default URL provided by PCSDK.defaultDatabaseURL property

access​Group String?

The access group to store new Keychain's keys. If not set, the default access group will be used (app ID or Keychain Access Group).

mode Mode

The SDK's using mode. When using SDK in extensions the main app bundle identifier should be provided. Location updates with granted "When In Use" permissions are not avaiable in extensions.

set​Handles​Background​Timeout(_:​)

public static func setHandlesBackgroundTimeout(_ timeout: TimeInterval)

Sets background timeout for handles

Parameters

timeout Time​Interval

Timeout (in seconds)

set​Logger(_:​options:​)

public static func setLogger(_ logger: PCLoggerProtocol, options: PCLoggingOptions = .debug)

Set custom logger with provided log level

Set the required level of logging:

  • .debug - shows SDK's debug information (default value)

  • .sensitive - shows sensitive data, e.g.: crypting keys, some requests with user info

Parameters

logger PCLogger​Protocol

The logger

options PCLogging​Options

The logging options

set​Log​Level(_:​)

public static func setLogLevel(_ logLevel: PCLoggingOptions)

Configures the log level

Set the required level of logging:

  • .debug - shows SDK's debug information

  • .sensitive - shows sensitive data, e.g.: crypting keys, some requests with user info

Parameters

log​Level PCLogging​Options

The required level of logging (OptionSet).

check​Root()

public static func checkRoot() -> Bool

Checking if device is jailbroken

Returns

true if jailbroken or false

analyze(qr​Value:​)

public static func analyze(qrValue: String) -> PCQRType

Return the type of the QR code

remove​Local​Keypair()

@available(iOS 10.0, iOSApplicationExtension 10.0, *) public static func removeLocalKeypair()

Removes the keypair for the device specific encryption and decryption

⚠️ Warning! All available users will be unusable anymore after removing. There is no way to restore deleted keys.

remove​All​Users()

public static func removeAllUsers()

Removes all users and all corresponding data

⚠️ Warning! All users will be removed. There is no way to restore removed users.