Durable

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)

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.