mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 13:51:11 +00:00
Keystore overhaul (final) (#13683)
* Introduce keystore specialized sign methods * Get rid of 'AppKey::UntypedGeneric' associated type. Untyped generics are accessible using associated types 'Generic' associated type. I.e. <T as AppKey>::Public::Generic * Get rid of 'CryptoTypePublicPair' * Trivial fix * Small refactory of local keystore implementations * Remove 'crypto_id' method from 'Public' * Trivial rename of 'AppKey' to 'AppCrypto' * Remove unused import * Improve docs * Better signature related errors for authority-discovery * Apply review suggestion * Apply review suggestions Co-authored-by: Koute <koute@users.noreply.github.com> * Authority discoverty signing error revisited * Signing error revisited for babe and aura as well * Further cleanup --------- Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
@@ -762,10 +762,9 @@ pub trait Crypto {
|
||||
) -> Option<ed25519::Signature> {
|
||||
self.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!")
|
||||
.sign_with(id, &pub_key.into(), msg)
|
||||
.ed25519_sign(id, pub_key, msg)
|
||||
.ok()
|
||||
.flatten()
|
||||
.and_then(|sig| ed25519::Signature::from_slice(&sig))
|
||||
}
|
||||
|
||||
/// Verify `ed25519` signature.
|
||||
@@ -902,10 +901,9 @@ pub trait Crypto {
|
||||
) -> Option<sr25519::Signature> {
|
||||
self.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!")
|
||||
.sign_with(id, &pub_key.into(), msg)
|
||||
.sr25519_sign(id, pub_key, msg)
|
||||
.ok()
|
||||
.flatten()
|
||||
.and_then(|sig| sr25519::Signature::from_slice(&sig))
|
||||
}
|
||||
|
||||
/// Verify an `sr25519` signature.
|
||||
@@ -949,10 +947,9 @@ pub trait Crypto {
|
||||
) -> Option<ecdsa::Signature> {
|
||||
self.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!")
|
||||
.sign_with(id, &pub_key.into(), msg)
|
||||
.ecdsa_sign(id, pub_key, msg)
|
||||
.ok()
|
||||
.flatten()
|
||||
.and_then(|sig| ecdsa::Signature::from_slice(&sig))
|
||||
}
|
||||
|
||||
/// Sign the given a pre-hashed `msg` with the `ecdsa` key that corresponds to the given public
|
||||
|
||||
Reference in New Issue
Block a user