photon-sdk / photon-lib

A high level library for building bitcoin wallets with react native
https://docs.photonsdk.org
MIT License
53 stars 12 forks source link

Add Google Drive api support on Android #11

Closed tanx closed 3 years ago

tanx commented 3 years ago

Currently the CloudStore module only supports iCloud on iOS and currently falls back to AsyncStorage on Android. This allows encrypted backup payloads such as private key seeds to be synced to Google Drive using Android's native backup feature. Unfortunately this backup option isn't really reliable since the schedule of the backup is not transparent to the app. Even worse if users don't use Android backups at all and they lose their phone, their photon backup will not be synced to the GDrive.

An alternative method would be to use the Google Drive api:

https://developers.google.com/drive/api/v3/about-sdk

There already seems to be a Google Drive react native module that wraps this functionality behind a JS api:

https://github.com/RobinBobin/react-native-google-drive-api-wrapper

We could integrate this behind the same api in the CloudStore module so that backups are synced to the cloud using a common api on both iOS and Android:

https://github.com/photon-sdk/photon-lib/blob/master/src/cloudstore.js