mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 01:11:10 +00:00
Remove footgun around session keys/handlers (#3949)
* Remove footgun around session keys/handlers - `OpaqueKeys` now has an associated type `KeyTypeIdProviders`. This can be used in the runtime as input for `SessionHandler` from the session trait. - `impl_opaque_keys` now works with modules and extracts the `KeyTypeId` from the module directly. - Added some checks to the `session` storage initialization that checks that the `SessionHandler` and `Keys` use the same number of keys and that the order is equal. * Update core/sr-primitives/src/traits.rs
This commit is contained in:
@@ -23,6 +23,10 @@ pub use primitives::ed25519::*;
|
||||
mod app {
|
||||
use primitives::testing::ED25519;
|
||||
crate::app_crypto!(super, ED25519);
|
||||
|
||||
impl crate::traits::BoundToRuntimeAppPublic for Public {
|
||||
type Public = Self;
|
||||
}
|
||||
}
|
||||
|
||||
pub use app::Public as AppPublic;
|
||||
|
||||
@@ -23,6 +23,10 @@ pub use primitives::sr25519::*;
|
||||
mod app {
|
||||
use primitives::testing::SR25519;
|
||||
crate::app_crypto!(super, SR25519);
|
||||
|
||||
impl crate::traits::BoundToRuntimeAppPublic for Public {
|
||||
type Public = Self;
|
||||
}
|
||||
}
|
||||
|
||||
pub use app::Public as AppPublic;
|
||||
|
||||
@@ -127,3 +127,8 @@ pub trait RuntimeAppPublic: Sized {
|
||||
fn verify<M: AsRef<[u8]>>(&self, msg: &M, signature: &Self::Signature) -> bool;
|
||||
}
|
||||
|
||||
/// Something that bound to a fixed `RuntimeAppPublic`.
|
||||
pub trait BoundToRuntimeAppPublic {
|
||||
/// The `RuntimeAppPublic` this type is bound to.
|
||||
type Public: RuntimeAppPublic;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user