DataStoreAppGrantStore

An AppGrantStore that keeps every grant as one JSON list under one key of a Preferences DataStore the host supplies.

The list is small (one row per app and account) and read on every guarded call, so one key read whole is cheaper than a table. A value that no longer parses reads as no grants and is reported once, so a damaged store fails closed rather than crashing the host.

Constructors

Link copied to clipboard
constructor(dataStore: DataStore<Preferences>)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun get(packageName: String, webId: String): AppGrant?
Link copied to clipboard
open override fun grants(): Flow<List<AppGrant>>

Every grant, live; emits again on each change.

Link copied to clipboard

The grants for one WebID, live.

Link copied to clipboard
open suspend override fun put(grant: AppGrant)

Writes grant, replacing the grant its package holds for its WebID.

Link copied to clipboard
open suspend override fun revoke(packageName: String, webId: String)
Link copied to clipboard
open suspend override fun revokeAll(webId: String)

Drops every grant for webId; the hook for signing that account out.

Link copied to clipboard
open suspend override fun revokePackage(packageName: String)

Drops every grant packageName holds; the hook for an uninstalled app.