PrefsDataStore

class PrefsDataStore @JvmOverloads constructor(val name: String, val dataStore: DataStore<Preferences>, val policy: ValuePolicy = ValuePolicy.MASK_SENSITIVE, val readOnly: Boolean = false, unmasked: Set<String> = emptySet(), masked: Set<String> = emptySet())

A Preferences DataStore that the app registers with PrefsDebugTab.create.

The tab reads and edits dataStore itself, so that the app sees an edit at once. DataStore allows one instance for each file in a process: the tab never opens one of its own, and it reads a store that the app does not register from its file, read-only.

DataStore is a compileOnly dependency of this artifact: the app that registers a store has DataStore 1.0 or newer, and coroutines with it. A byte array value needs DataStore 1.1.

Parameters

unmasked

the keys whose values ValuePolicy.MASK_SENSITIVE shows although they look like they hold a secret, such as an oauth_scopes key, which has auth in its name but holds no secret. A name matches a key with exactly that name, in any case: it is no pattern. A JSON value of such a key shows whole, with no field replaced. It changes nothing under ValuePolicy.VISIBLE, which shows every value, or ValuePolicy.KEYS_ONLY, which shows none: the tab ignores it there, so that a change of the policy never shows more than the policy says.

masked

the keys whose values the tab always leaves out, under every policy, also ValuePolicy.VISIBLE: a key whose name the check does not find, such as an account_info key that holds a JSON string with a token in it, or a key that must stay hidden when someone changes the policy. A name matches a key with exactly that name, in any case: it is no pattern. A key in both unmasked and masked is masked.

Throws

when name is empty or contains / or \.

Constructors

Link copied to clipboard
constructor(name: String, dataStore: DataStore<Preferences>, policy: ValuePolicy = ValuePolicy.MASK_SENSITIVE, readOnly: Boolean = false, unmasked: Set<String> = emptySet(), masked: Set<String> = emptySet())

Properties

Link copied to clipboard

the instance that the tab reads and edits: the app's own.

Link copied to clipboard

The keys whose values the tab always leaves out, as the app passed them. A key matches in any case.

Link copied to clipboard

the store's name, as the app passes it to preferencesDataStore: the file on disk is files/datastore/<name>.preferences_pb. The API names the store by it, and discovery leaves out the file with this name, so that dataStore stands for it.

Link copied to clipboard

what the tab shows of the values.

Link copied to clipboard

whether the tab refuses to edit, delete, and clear: those routes answer 403.

Link copied to clipboard

The keys whose values ValuePolicy.MASK_SENSITIVE shows, as the app passed them. A key matches in any case.