Durable

class Durable(reopen: suspend (beforeKeyIsMade: suspend () -> Unit) -> DeviceKeyStore, val corruptKey: suspend () -> Unit, val plantMismatchedKey: suspend () -> DidKey, val clearKey: suspend () -> Unit, val interruptKeyWrite: suspend () -> DeviceKeyStoreFixture.KeyWriteInterruption, val corruptGrants: suspend () -> Unit, val makeKeyUnreadable: suspend () -> DeviceKeyStoreFixture.UnreadableKey, val makeGrantsUnreadable: suspend () -> DeviceKeyStoreFixture.UnreadableGrants) : DeviceKeyStoreFixture

A store over a medium that outlives the process. Each open is a restart: a new store over the same medium, sharing no memory with the stores opened before it.

Each damage hook leaves the medium as that failure would, with no store open.

Parameters

reopen

opens a new store over this fixture's medium, passing it beforeKeyIsMade.

corruptKey

makes the stored key unreadable: truncated, or bytes that are not a key at all.

plantMismatchedKey

stores a key that decodes, but whose private half does not sign for the name it carries, and returns that name. A store that cannot represent such a pair at all (a key the platform holds as one object) still owes this property: it needs a two-armed fixture here, reasoned in its own KDoc, never a stub that plants nothing.

clearKey

removes the stored key, leaving the grants.

interruptKeyWrite

leaves what a crash part-way through writing a new key would leave, over whatever key is held now, and says whether the medium can leave anything; see KeyWriteInterruption.

corruptGrants

makes the stored grants unreadable, leaving the key.

makeKeyUnreadable

puts the held key out of the store's reach without damaging it — a permission it lacks, a file system loop, a Keychain locked before first unlock — and says how to put it back; see UnreadableKey.

makeGrantsUnreadable

puts the stored grants record out of the store's reach without damaging it — a file the process may not open, as an iPhone's grants file is after a restart until the first unlock — while the medium still takes a new record, and says how to probe and undo it; see UnreadableGrants.

Constructors

Link copied to clipboard
constructor(reopen: suspend (beforeKeyIsMade: suspend () -> Unit) -> DeviceKeyStore, corruptKey: suspend () -> Unit, plantMismatchedKey: suspend () -> DidKey, clearKey: suspend () -> Unit, interruptKeyWrite: suspend () -> DeviceKeyStoreFixture.KeyWriteInterruption, corruptGrants: suspend () -> Unit, makeKeyUnreadable: suspend () -> DeviceKeyStoreFixture.UnreadableKey, makeGrantsUnreadable: suspend () -> DeviceKeyStoreFixture.UnreadableGrants)

Properties

Link copied to clipboard
val clearKey: suspend () -> Unit
Link copied to clipboard
val corruptGrants: suspend () -> Unit
Link copied to clipboard
val corruptKey: suspend () -> Unit
Link copied to clipboard
Link copied to clipboard
val plantMismatchedKey: suspend () -> DidKey

Functions

Link copied to clipboard
open suspend override fun open(beforeKeyIsMade: suspend () -> Unit): DeviceKeyStore

Opens a store over this fixture's medium; see DeviceKeyStoreFixture for beforeKeyIsMade.