Back up your end users device's key shares to Google Drive.
This is how you set up Google Drive backups in your app. The first five steps are for all apps - both on Android and iOS.
To enable Google Drive backups, first create a Google Project within your organization that will act as the OAuth consumer.
Create a new Google project in the Google Cloud Console. ​
In the APIs & Services page, click ENABLE APIS AND SERVICES.
Search for Google Drive API, select it, and click Enable.
Click the OAuth consent screen.
- For user type, select internal.
- Provide the relevant information.
(Skip scopes.)
Click Credentials in the left menu and select Create Credentials.

Select OAuth client ID and choose Android in the Application Type list.

Provide details in the form, as instructed, with Name, Package name, and SHA-1 from your Keystore.
Note that when testing, it's recommended to use yourdebug.keystoreat/android/app/debug.keystore. However, you'll need to switch this value when pushing it to the store.Find the Sha-1 fingerprint with this command from the root project folder:
keytool -keystore ./app/debug.keystore -list -vOnce you have successfully created your Android Client ID , download the JSON, and rename it to
google-service.json.Move the downloaded file into the
/android/appdirectory.Add emails for internal testing until you've published your app for external use.
Add dependencies to the following Fordefi SDKs into package.json:
npm i @fordefi/wallet-sdk-react-native npm i @fordefi/backup-provider-react-nativeInto your
android/app/build.gradleadd the following dependencies:dependencies{ ... implementation 'com.google.android.gms:play-services-auth:20.7.0' implementation('com.google.api-client:google-api-client-android:2.2.0') { exclude group: 'org.apache.httpcomponents' exclude module: 'guava-jdk5' } implementation('com.google.apis:google-api-services-drive:v3-rev20230822-2.0.0') { exclude group: 'org.apache.httpcomponents' exclude module: 'guava-jdk5' } implementation('com.google.api-client:google-api-client-android:2.2.0'){ exclude group: 'org.apache.httpcomponents' } implementation('com.google.apis:google-api-services-drive:v3-rev197-1.25.0') { exclude group: 'org.apache.httpcomponents' } }Using in a React Native project:
import { backupKeyset, CloudBackupOptions, BackupProvider, } from '@fordefi/wallet-sdk-react-native'; import { initBackupProvider, BackupConfiguration, } from '@fordefi/backup-provider-react-native';Call to init BackupProvider:
await initBackupProvider(null)Call backup with Google Drive backup option:
const backupOptions: CloudBackupOptions = { backupProvider: BackupProvider.GoogleDrive, }; const result = await backupKeyset(keysetId, backupOptions);
Select OAuth client ID and choose iOS in the Application Type list.

Get your Bundle ID from the React Native or iOS project.
Once you've successfully created your iOS client ID, download the
.plistconfiguration and copy theREVERSED_CLIENT_IDto the URL Scheme section of yourinfo.plist- either in Xcode or your IDE:... <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <string>REVERSE_CLIENT_ID</string> </array> </dict> </array> ...Rename the downloaded
.plistfile toGoogleService-Info.plistand save it to your/iosdirectory.Set up in the project:
plugin 'cocoapods-user-defined-build-types' enable_user_defined_build_types! pod 'GoogleSignIn', '7.0.0', :build_type => :dynamic_framework pod 'GoogleAPIClientForREST/Drive', '3.1.0', :build_type => :dynamic_frameworkAfter adding new dependencies, remove the
podsfolder andnode_modulesand run:sudo gem install cocoapods-user-defined- build-typesThen run:
pod install --repo-updateUsing in the React Native project:
import { backupKeyset, FordefiSdkErrorResult, FordefiSdkConfiguration, CloudBackupOptions, BackupProvider, } from '@fordefi/wallet-sdk-react-native'; import { initBackupProvider, BackupConfiguration, } from '@fordefi/backup-provider-react-native';Register your
GOOGLE_DRIVE_IOS_CLIENT_IDin theBackupConfigurationfunction and call toinit BackupProvider:const config: BackupConfiguration = { googleDriveClientID: Config.GOOGLE_DRIVE_IOS_CLIENT_ID, }; await initBackupProvider(config)Call backup with Google Drive backup option:
const backupOptions: CloudBackupOptions = { backupProvider: BackupProvider.GoogleDrive, }; const result = await backupKeyset(keysetId, backupOptions);