fakeKeyStore
The fake device numbered index: a DeviceKeyStore whose key is fakeDeviceKey(index), and on which a room signs and checks with scheme. It keeps grants by the same rules as every other store, since an InMemoryDeviceKeyStore keeps them underneath.
One store is one device, and the index is what tells devices apart: a test with a host and two joiners builds fakeKeyStore(0), fakeKeyStore(1) and fakeKeyStore(2). Distinct indices give distinct keys and the same index gives the same key, in every run and on every target, so a red that depends on how the devices' keys sort replays exactly, and a test can name a device's key as fakeDidKey(index) before the store has made it.
The first DeviceKeyStore.deviceKey call runs scheme's before hook with FakeKeyOperation.Generate, so a hook can hold or fail a store's key the way a slow or broken provider would. The store's key never comes from scheme's Random: that only feeds a test that calls FakeKeyScheme.generate itself, and by default it is seeded with index.
Parameters
the scheme a room built on this store signs and checks with. Pass one to share a before hook across devices.