Navigate browser to http://127.0.0.1:5002/
-## Creating fake printers
+## Creating fake printers and friends
Resetting the actual hardware all the time gets a bit tiresome so
there's a fake command that creates unclaimed fake little printers:
Functionally there is no difference between resetting and creating a
new printer so we don't distinguish between the two.
+To create a fake friend from twitter who signed up do this:
+
+```console
+$ ./manage.py fake user stephenfry
+```
+
# Sirius Architecture
## Layers
+The design is somewhat stratified: each layer only talks to the one
+below and above. The ugliest bits are how database and protocol loop
+interact.
+
```
UI / database
----------------------------
loops forever, decoding messages as they come in.
-## Information flow (user-facing)
-
-So far we aren't sending any messages to the devices or bridges other
-than encryption keys derived from claim codes (see below).
-
-In order to inject messages into the flow we need to look up a device
-in the `connected_devices` member of
-`sirius.protocol.protocol_loop.BridgeState`. If we found a matching
-`BridgeState` we can use its websocket to send the message.
-
-As gunicorn spawns several processes we'll need to publish updates
-over the process boundary which will probably necessitate a message
-broker like redis.
-
-
## Claim codes
Devices are associated with an account when a user enters a "claim
code". This claim code contains a "hardware-xor" which is derived via
-a lossy 3-byte hash from the device address. These codes are meant to
-be used "timely", i.e. within a short window of the printer
-reset. Hence collisions shouldn't be an issue.
+a lossy 3-byte hash from the device address. The XOR-code for a device
+is always the same even though the address changes!
+
+The claim codes are meant to be used "timely", i.e. within a short
+window of the printer reset. If there are multiple, conflicting claim
+codes we always pick the most recently created code.
We are also deriving this hardware xor when a device calls home with
an "encryption_key_required". In that case we connect the device to
the claim code via the hardware-xor and send back the correct
encryption key.
-
-
-## TODO
-
-* Can't read images from the net because we're rendering a local file
- with phantomjs. The way to fix is probably to run an in-process
- web-server for the duration of rendering (urg).
-* What to do with twitter users that have > 5000 followers? More
- generally the UI becomes unusable.