urbit / bridge

An application for interacting with Azimuth.
MIT License
98 stars 25 forks source link

keys: generate multikeys in Activate flow, single keys in Home view #937

Closed tomholford closed 2 years ago

tomholford commented 2 years ago

Context

A previous refactor unified all keyfile generation to a single hook, useMultiKeyfileGenerator, to be used in all Keyfile download interactions. This turned out to cause issues booting L1 ships.

Changes

This PR resolves #895 ~by restoring single keyfile generation for Home view touchpoints (Network Keys, Home > OS, etc.). It also updates the single keyfile generator to use the new compileMultikey implementation~

~There is also some renaming for improved readability, and simplification of the multi key generator (now that it's only used during Activation flow).~

update To address PR feedback, the implementation of useKeyfileGenerator is refactored. It is now a base hook that can be used by itself, or composed within other React hooks.

There are two new hooks that wrap it to provide the keyfile generation functionality, based on the application context:

In the Home view (Set Network Keys, Home > OS, Home > ID), a hook called useHomeKeyfileGenerator is now used. In the Activation view, a hook called useActivationKeyfileGenerator is now used.

Both wrap the base hook, the difference is how the network key seeds are derived (for consumption by the base hook).

Testing