2

I would like to sign and gossip messages in an offchain service and leverage keys from the keystore used by the SessionKeys such as the Aura/Grandpa/etc. key. Our current strategy requires us to create an independent sr25519 key. Instead, we'd like to use an existing key so we can cross-reference signatures within the authority set.

What is the proper way to access the keys in this keystore?

0

1 Answer 1

2

In order to fetch the keys for a specific KEY_TYPE such as AURA you just need to use that keystore and pass in the respective KeyType w/ sr25519 / ecdsa / ed25519.

pub fn sr25519_public_keys(&self) -> Result<Vec<sr25519::Public>, error::Error> {
    let store: SyncCryptoStorePtr = self.0.clone().ok_or_else(|| error::Error::Keystore("no Keystore".into()))?;

    let pk: Vec<sr25519::Public> = SyncCryptoStore::sr25519_public_keys(&*store, AURA)
        .iter()
        .map(|k| sr25519::Public::from(k.clone()))
        .collect();

    Ok(pk)
}
1
  • how do you verify messages signed with sign_with() method
    – dadzerlaze
    Nov 14, 2022 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.