Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Reproducible local writers #163
Summary of changes:
Adds two (optional) options to the options object you can pass when creating a hyperdb to support reproducible local writers:
If present, these are used when creating the local writer instead of randomly choosing a keypair.
This is a non-breaking change. If the local writer key details are not passed in, hyperdb works as before.
In a multiwriter system, once a writer (e.g., a browser node) has been authorised, we do not want it to have to re-apply for authorisation if the local database is destroyed (e.g., local data is cleared) as this adds a non-trivial experience cost to the person using the system. The alternative is to create a new writer every time which also adds to the overhead of the hyperdb.
This pull request makes it possible to implement seamless device/node authorisation for multiwriter when used in conjuction with passphrase-derived keys and a module like secure-ephemeral-messaging-channel.
Reopening this as I now have a genuine use case for it:
In order to recreate the same writer on node/device 2 we need reproducible writers for hyperdb.
* It’s too soon to speculate either way and trying to use reproducible local writers at this point (along with the work of trying to create unique ids for nodes) feels like a premature optimisation. It is also very difficult to do without some sort of centralised counter, etc., which I do not want.
OK, I’m confusing myself now. Whether or not we have pre-determined or random key material for local writers is unrelated to our need to have reproducible local writers so that we can recreate the same writer. e.g., with random key material, we can save an ecrypted copy of the secret key and then recreate the writer from that. So, yes, we need this functionality.
(At least you can be sure I’m trying to ensure that we don’t add anything unnecessary to the core modules.) :)