AppDataBackupProvider
Hook for host apps to round-trip arbitrary state through the Sigil cloud-backup pipeline. The seed payload is always included; this interface is the seam for everything else the app wants to preserve across uninstall / device hop (active matches, draft messages, contract-specific session data, etc.).
Wire-up:
Bind the implementation as
@Provides @Singleton AppDataBackupProviderin the host's Hilt graph.The SDK's
SigilPanelViewModeldiscovers the binding viaOptional<AppDataBackupProvider>and passes the snapshot bytes asAppStateBackup.backup(appMetadata = …)on the next backup, then hands restored bytes back via restore on the next sigil restore.
Apps that don't bind a provider get a default empty Optional — the backup blob then carries zero-length appMetadata (BBoard behavior). The seed and sigil identity are NOT in the blob — they derive from the passkey via PRF and are reconstructed locally, not restored.
Encoding: opaque to the SDK. Producers pick a format (JSON, Protobuf, custom binary) and ideally include a schema version so a future revision can decline to restore an unrecognized blob rather than crash on parse. See MatchStore.snapshotBytes for an example.
Sensitivity: the bytes are encrypted under the user's passkey PRF before reaching Block Store — same protection that secures the seed itself. Implementations don't need to encrypt at this layer.
Both methods are suspend so implementations can do IO (read EncryptedSharedPreferences, query a Room DB, etc.) without forcing blocking work on the caller's thread.
Functions
Apply a previously-captured blob. Called from the sigil restore pipeline immediately after the seed is unsealed. The provider decides whether to replace, merge, or skip — the SDK doesn't impose semantics. Errors should be caught and logged inside the implementation: a malformed blob shouldn't fail the whole sigil restore.