DriveBackupStorage

class DriveBackupStorage(fileName: String, tokenProvider: suspend (forceRefresh: Boolean) -> String) : BackupStorage

BackupStorage over Google Drive's appDataFolder — a hidden, per-account folder that syncs across the user's devices and is invisible in the Drive UI. Right for the large (~500 KB) encrypted dust-state blob that exceeds Block Store's 4 KB/entry cap.

The blob is already AES-256-GCM encrypted before it reaches here (Drive is pure transport — Google sees only ciphertext). REST calls go over plain HttpURLConnection with a Bearer token, mirroring ProvingKeyManager's download path, so no heavy google-api-services-drive client (and its transitive httpclient/guava conflicts) is pulled in.

Parameters

fileName

the single file we keep in appDataFolder (overwritten on each store)

tokenProvider

yields a valid drive.appdata access token; called again (with forceRefresh=true) once on a 401 so an expired token is transparently renewed.

Constructors

Link copied to clipboard
constructor(fileName: String, tokenProvider: suspend (forceRefresh: Boolean) -> String)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun delete()

Delete the stored backup.

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

True iff we can obtain a token (consent already granted). Never triggers UI.

Link copied to clipboard
open suspend override fun retrieve(): ByteArray?

Retrieve the stored encrypted blob, or null if no backup exists.

Link copied to clipboard
open suspend override fun store(encryptedBlob: ByteArray)

Store an encrypted blob. Overwrites any existing backup.