Encrypted Backup and Recovery - iCloud

Back up your end users device's key shares to iCloud.

This is how you set up iCloud backups in your iOS app.

  1. Open your project in XCode.

  2. Navigate to Signing & Capabilities.

  1. Click the + button right below, scroll down, and select iCloud.
  1. Under iCloud Services, select Key-value storage.
  1. If you are using the React Native SDK add to your project:

    import {
      backupKeyset,
      CloudBackupOptions,
      BackupProvider,
    } from '@fordefi/wallet-sdk-react-native';
    
  2. Using for backup:

    const backupOptions: CloudBackupOptions = {
      backupProvider: BackupProvider.iCloud,
    };
    const result = await backupKeyset(keysetId, backupOptions);
    
    import FordefiSdk
    import FordefiBackupCloudProvidersSdk
    
    class ViewController: UIViewController {
        private var fordefi: Fordefi
        private let keysetID = "<KEYSET_ID>"
    
        override func viewDidAppear(_ animated: Bool) {
            ...
    			FordefiBackupCloudProviders.getInstance().initialize(
    					configuration: FordefiBackupCloudProvidersConfiguration())
    
    			do {
                self.fordefi = try Fordefi.getInstance(configuration: FordefiConfiguration(
                    baseURL: "https://api.fordefi.com"
                ))
            } catch let error {
                print("Failed to initialize Fordefi. Error: \(error.localizedDescription)")
                return
            }
    
    				self.fordefi?.backupKeyset(keysetID: self.keysetID,
                       backupCloudProvider: FordefiBackupCloudProvider.iCloud,
                       completionHandler: { error in
                self.handleBackupKeyset(error: error)
            })
        }
    
    		private func handleBackupKeyset(error: FordefiError?) {
            if error != nil {
                print("Faield to backup keyset. Error: \(error!.errorDescription!)")
                return
            }
        }