-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Introduces author_hasKey and author_hasSessionKeys rpc endpoints
#4720
Conversation
Both endpoints can be used to check if a key is present in the keystore. - `hasKey` works on with an individual public key and key type. It checks if a private key for the given combination exists in the keystore. - `hasSessionKeys` works with the full encoded session key blob stored on-chain in `nextKeys`. This requires that the given blob can be decoded by the runtime. It will return `true`, iff all public keys of the session key exist in the storage. Fixes: #4696
|
This really can save some time bootstrapping node/network |
Co-Authored-By: Nikolay Volf <[email protected]>
tomusdrw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good apart from the seed / pubkey mismatch. Potentially just a documentation issue.
| fn insert_ephemeral_pair<Pair: PairT>(&mut self, pair: &Pair, seed: &str, key_type: KeyTypeId) { | ||
| let key = (key_type, pair.public().to_raw_vec()); | ||
| self.additional.insert(key, pair.to_raw_vec()); | ||
| self.additional.insert(key, seed.into()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs for additional say it should be raw public key, but here it seems we just put seed in.
Also we can just put bulshit, cause we don't check that the pair is derived from that seed, do we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs say: (KeyTypeId, Raw public key) -> Key phrase/seed
Key -> Value
(the key is build above in exactly this way.
Both endpoints can be used to check if a key is present in the keystore.
hasKeyworks on with an individual public key and key type. Itchecks if a private key for the given combination exists in the
keystore.
hasSessionKeysworks with the full encoded session key blob storedon-chain in
nextKeys. This requires that the given blob can be decodedby the runtime. It will return
true, iff all public keys of thesession key exist in the storage.
Fixes: #4696