GoogleStorage

GoogleStorage class provides an implementation for interacting with Google Drive as a cloud storage provider.

This class allows for:

  • Encrypting and decrypting data before writing to or reading from Google Drive.

  • Writing data to Google Drive.

  • Reading data from Google Drive.

  • Deleting data from Google Drive.

  • Managing authentication with Google Drive.

  • Handling different backup options, including using the AppData folder or a custom folder.

  • Supporting both experimental and older Google authentication APIs.

  • Signing in and out of Google Drive.

  • Validating that operations have been performed successfully.

Constructors

Link copied to clipboard
constructor(api: Api, encryption: PortalEncryption, mpc: PortalMobileMpc)

Properties

Link copied to clipboard

The current activity in which the GoogleStorage operations are being performed.

Link copied to clipboard
open override var api: Api?

The main API object required for getting client data. This is set during initialization by the Portal class.

Link copied to clipboard
open override var method: BackupMethods

The backup method, which is fixed to Gdrive.

Functions

Link copied to clipboard
open override fun decrypt(value: String, key: String): String

Decrypts a given value using the configured encryption mechanism.

Link copied to clipboard
open suspend override fun delete(): Boolean

Deletes the backup file from Google Drive.

Link copied to clipboard
open override fun encrypt(value: String): EncryptedData

Encrypts a given value using the configured encryption mechanism.

Link copied to clipboard
suspend fun isSignedIn(): Boolean
Link copied to clipboard
open suspend override fun read(): String

Reads and retrieves backup data from Google Drive.

Link copied to clipboard
fun setup(config: GDriveConfiguration, gDriveClient: GDriveClient? = null)

Sets up Google Drive configuration and initializes the client.

Link copied to clipboard
suspend fun signIn(): Boolean
Link copied to clipboard
fun signOut()
Link copied to clipboard
open suspend override fun validateOperations(): Boolean

Validates Google Drive authentication and necessary permissions.

Link copied to clipboard
open suspend override fun write(content: String): String

Writes backup data to Google Drive.