PrefsFile

class PrefsFile @JvmOverloads constructor(val name: String, val prefs: SharedPreferences, val policy: ValuePolicy = ValuePolicy.MASK_SENSITIVE, val readOnly: Boolean = false, unmasked: Set<String> = emptySet(), masked: Set<String> = emptySet())

A SharedPreferences file that the app registers with PrefsDebugTab.create.

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, prefs: SharedPreferences, policy: ValuePolicy = ValuePolicy.MASK_SENSITIVE, readOnly: Boolean = false, unmasked: Set<String> = emptySet(), masked: Set<String> = emptySet())

Properties

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 file's name, as the app passes it to Context.getSharedPreferences. The API names the file by it, and discovery leaves out the file on disk with this name, so that prefs stands for it.

Link copied to clipboard

what the tab shows of the values.

Link copied to clipboard

the instance that the tab reads and edits. It can be an EncryptedSharedPreferences that decrypts: then the tab shows the plain values, as policy lets it.

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.