Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@bkchr
Copy link
Member

@bkchr bkchr commented Jan 23, 2020

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

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
@bkchr bkchr added the A0-please_review Pull request needs code review. label Jan 23, 2020
@bkchr bkchr requested a review from tomusdrw as a code owner January 23, 2020 11:15
@NikVolf
Copy link
Contributor

NikVolf commented Jan 23, 2020

This really can save some time bootstrapping node/network

Copy link
Contributor

@tomusdrw tomusdrw left a 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());
Copy link
Contributor

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?

Copy link
Member Author

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.

@bkchr bkchr merged commit 82428e0 into master Jan 24, 2020
@bkchr bkchr deleted the bkchr-rpc-has-keys branch January 24, 2020 14:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Endpoint to Retrieve Info About Keystore

4 participants