Adds with_pair! macro to application-crypto (#4885)

* Adds `with_pair!` macro to application-crypto

This macro will "generate" the given code only when the crypto pair is
available. So, when either the `std` or the `full_crypto` feature is
enabled.

* Fix example
This commit is contained in:
Bastian Köcher
2020-02-14 15:46:41 +01:00
committed by GitHub
parent d3a3e288b6
commit 91989cab46
6 changed files with 54 additions and 24 deletions
@@ -30,9 +30,10 @@ pub mod sr25519 {
app_crypto!(sr25519, AURA);
}
/// An Aura authority keypair using S/R 25519 as its crypto.
#[cfg(feature = "std")]
pub type AuthorityPair = app_sr25519::Pair;
sp_application_crypto::with_pair! {
/// An Aura authority keypair using S/R 25519 as its crypto.
pub type AuthorityPair = app_sr25519::Pair;
}
/// An Aura authority signature using S/R 25519 as its crypto.
pub type AuthoritySignature = app_sr25519::Signature;
@@ -47,9 +48,10 @@ pub mod ed25519 {
app_crypto!(ed25519, AURA);
}
/// An Aura authority keypair using Ed25519 as its crypto.
#[cfg(feature = "std")]
pub type AuthorityPair = app_ed25519::Pair;
sp_application_crypto::with_pair! {
/// An Aura authority keypair using Ed25519 as its crypto.
pub type AuthorityPair = app_ed25519::Pair;
}
/// An Aura authority signature using Ed25519 as its crypto.
pub type AuthoritySignature = app_ed25519::Signature;