PCSDKModule Documentation

Class PCUser​Restore

public final class PCUserRestore  

Restores and backups users

Methods

get​Registered​Ext​Auth​Type(for:​target​Queue:​completion:​)

public static func getRegisteredExtAuthType(
        for user: PCUser,
        targetQueue: DispatchQueue = .main,
        completion: @escaping (_ result: Result<PCExtendedAuthType, Error>) -> Void
    )  

Returns registered extended authentication method for a user

Parameters

user PCUser

The user templates will be provided for

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

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

A closure to be invoked after finishing registration

result

Returns registered templates when success. Otherwise, returns error

create​Backup​Data(user:​backup​Password:​target​Queue:​completion:​)

public static func createBackupData(
        user: PCUser,
        backupPassword: String,
        targetQueue: DispatchQueue = .main,
        completion: @escaping (_ result: Result<PCUserBackupData, Error>) -> Void
    )  

Creates a backup data for the user

Parameters

user PCUser

The user a backup data will be created for

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

A closure to be invoked after finishing registration

result

Returns a backup data when success. Otherwise, returns error

restore(user​ID:​system​ID:​interaction​URL:​ext​Auth​Template:​target​Queue:​completion:​)

public static func restore(
        userID: String,
        systemID: String,
        interactionURL: URL,
        extAuthTemplate: PCExtendedAuthTemplate,
        targetQueue: DispatchQueue = .main,
        completion: @escaping (_ result: Result<PCUser, Error>) -> Void
    )  

Restores PCUser using extended authentication template

Parameters

user​ID String

The identifier of the user to be restored

system​ID String

The system identifier of the user to be restored

interaction​URL URL

The interaction url of the user to be restored

ext​Auth​Template PCExtended​Auth​Template

The registered extended authentication template

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 finishing registration

result

Returns activated instance of restoredPCUser when success. Otherwise, returns error

restore(qr​Value:​ext​Auth​Template:​target​Queue:​completion:​)

public static func restore(
        qrValue: String,
        extAuthTemplate: PCExtendedAuthTemplate,
        targetQueue: DispatchQueue = .main,
        completion: @escaping (_ result: Result<PCUser, Error>) -> Void
    )  

Restores PCUser using extended authentication template using QR code with restoration requisites

Parameters

requisites

The qr code with requisites

ext​Auth​Template PCExtended​Auth​Template

The registered extended authentication template

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 finishing registration

result

Returns activated instance of restoredPCUser when success. Otherwise, returns error

restore(backup​Data:​backup​Password:​target​Queue:​completion:​)

public static func restore(
        backupData: PCUserBackupData,
        backupPassword: String,
        targetQueue: DispatchQueue = .main,
        completion: @escaping (_ result: Result<PCUser, Error>) -> Void
    )  

Restores PCUser from a backup data

Parameters

backup​Data PCUser​Backup​Data

The user's backup data

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 finishing registration

result

Returns activated instance of restoredPCUser when success. Otherwise, returns error