public class PCUserRestore
extends java.lang.Object
Constructor and Description |
---|
PCUserRestore() |
Modifier and Type | Method and Description |
---|---|
static void |
createBackupData(PCUser user,
java.lang.String backupPassword,
PCUserBackupCallback callback)
Creates a set of backup data which can be used to restore the key on another device.
This data is sensitive and must be placed in secure area like private folder in user's Google Drive |
static void |
restoreBackup(PCUserBackupData backupData,
java.lang.String backupPassword,
PCRestoreCallback callback)
Restores the user from provided backup data.
|
public static void createBackupData(PCUser user, java.lang.String backupPassword, PCUserBackupCallback callback)
user
- Target PCUser
backupPassword
- Password which will be used to restore the key. It is never stored on the device
and never transferred via network connection. The user is supposed to remember it.callback
- Callback for handling results. Upon success, the PCUserBackupData
is passed
to it's success() method. You are recommended then call the
PCUserBackupData.toJson()
to save it as json-string in secure area.public static void restoreBackup(PCUserBackupData backupData, java.lang.String backupPassword, PCRestoreCallback callback)
PCUserBackupData.toJson()
,
now you can call PCUserBackupData.fromJson(String)
to get an object ready to be used.PCUser
object, returned in callback is not stored yet. You are supposed to call
PCUsersManager.store(PCUser, String, String)
manually.backupData
- Object with all necessary data to restore the user.backupPassword
- Password to decrypt the backup data. Must be the same as used while backupcallback
- Callback for handling results. Upon success the PCUser
is passed to it's
success() method.