-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Specification
The node ID of a Polykey keynode is the public key fingerprint (based on the root keypair of the keynode). As such, on a key renewal/refresh, the node ID of the keynode will also change. Therefore, the node ID can be seen as dynamic state.
Currently we've had to be careful when we retrieve the node ID. We shouldn't be storing it as local, static state, otherwise this state needs to be updated when the root key changes.
The current solution has been to inject the KeyManager
into any class where we require the node ID to be retrieved, such that we can call getNodeId
to compute the node ID directly from the root key. This isn't the ideal solution: we shouldn't have to expose all of the KeyManager
whenever we need just the node ID.
We should look into changing the node ID to be similar to the Id
class in js-id
, or making use of the js-permaproxy
library to do this (https://github.com/matrixai/js-permaproxy). Therefore, only the node ID's proxy instance would need to be injected where we need the node ID.
Would we expose any other functionality other than a getter? If we wanted to do an "update" functionality, we'd actually need to perform an update on the root key itself (given that the node ID is derived from the public key). So perhaps instead, we could look into abstracting the root key as a proxy, such that a key update/renewal can be called without the KeyManager
... this is potentially completely unnecessary though.
Additional context
- original discussion of changing the node ID to be a proxy/singleton instance https://gitlab.com/MatrixAI/Engineering/Polykey/js-polykey/-/merge_requests/205#note_708488228
- previous thread from !209 (nodes claims) discussing the problems arising in the
nodes
domain when injecting the node ID as a local, static property https://gitlab.com/MatrixAI/Engineering/Polykey/js-polykey/-/merge_requests/209#note_675531967 - Propagate root keypair changes to domains external to
KeyManager
#312 - Propagate keypair changes to other domains - Review js-id usage for NodeId, VaultId, NotificationId, PermId, ClaimId, Gestalts and
GenericIdTypes.ts
#299 - NodeId applied to thejs-id
Tasks
- ...
- ...
- ...