Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8c39821
Introduce bandersnatch vrf
davxy Jun 18, 2023
a9446fd
Some documentation
davxy Jun 18, 2023
bb3e022
Fix tests
davxy Jun 18, 2023
bdd3df4
Fix docs refs
davxy Jun 18, 2023
e0e493a
Some more docs
davxy Jun 19, 2023
b665397
Comments about key derivation
davxy Jun 19, 2023
1faf0e2
Make clippy happy
davxy Jun 21, 2023
2a55c7d
Merge branch 'master' into bandersnatch-vrf
davxy Jun 21, 2023
7812da8
Fix ring context enc/dec test
davxy Jun 21, 2023
dd53abc
Fix docs
davxy Jun 21, 2023
03ca535
Switch to upstream ring-vrf
davxy Jun 22, 2023
afb84c5
Use sub-domains to construct VrfInput
davxy Jun 26, 2023
b4e0279
Bandersnatch VRF experimental feature
davxy Jun 26, 2023
584e07e
Restore upstream dep
davxy Jun 29, 2023
7791d66
Fix feature flags
davxy Jun 29, 2023
13ad9ad
Merge branch 'master' into bandersnatch-vrf
davxy Jun 29, 2023
acaab76
Apply typo fix
davxy Jul 18, 2023
f22354d
Bump bandersnatch-vrfs
davxy Jul 18, 2023
62d2ed4
Weiestrass form has been selected
davxy Jul 18, 2023
759406e
Rename bandersnatch testing app crypto id
davxy Jul 18, 2023
935b87b
Merge branch 'master' into bandersnatch-vrf
davxy Jul 18, 2023
3ccdd86
Support for seed recovery
davxy Jul 22, 2023
e8a40ab
Clarified domain size <-> key size relationship
davxy Jul 25, 2023
b770f0d
Merge branch 'master' into bandersnatch-vrf
davxy Jul 25, 2023
84ad4ae
cargo fmt
davxy Jul 25, 2023
63aef58
Merge branch 'master' into bandersnatch-vrf
davxy Jul 25, 2023
ca11f8d
Trigger CI
davxy Jul 26, 2023
9d279fa
Merge branch 'master' into bandersnatch-vrf
davxy Jul 27, 2023
b27c61f
Some required tweaks to crypto types
davxy Jul 28, 2023
a5e4cd4
Remove leftovers from Cargo.toml
davxy Jul 28, 2023
7bf3c70
Remove some TODO notes
davxy Jul 28, 2023
efd39bd
Simplification of structs construction
davxy Jul 28, 2023
ad76f57
Merge branch 'master' into bandersnatch-vrf
davxy Aug 1, 2023
062b13e
Merge branch 'master' into bandersnatch-vrf
davxy Aug 2, 2023
c562181
Trigger CI
davxy Aug 2, 2023
b1f6c58
Apply review suggestion
davxy Aug 9, 2023
9342856
Docs typo
davxy Aug 9, 2023
64ec625
Merge branch 'master' into bandersnatch-vrf
davxy Aug 9, 2023
ece4016
Fix keystore tests
davxy Aug 9, 2023
3b553b6
Consistence
davxy Aug 9, 2023
c2b00b5
Add ref to git rependency
davxy Aug 9, 2023
b339b3a
Static check of MAX_VRF_IOS value
davxy Aug 9, 2023
2b2676b
Clarify behavior for out of ring keys signatures
davxy Aug 9, 2023
0739e0f
Add test for ring-vrf to the keystore
davxy Aug 9, 2023
a457359
Fix docs
davxy Aug 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Some required tweaks to crypto types
  • Loading branch information
davxy committed Jul 28, 2023
commit b27c61f2817853c16f79c1fea86f413e7dba2610
40 changes: 16 additions & 24 deletions primitives/application-crypto/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ use sp_core::crypto::Pair;
use sp_core::crypto::{CryptoType, CryptoTypeId, IsWrappedBy, KeyTypeId, Public};
use sp_std::{fmt::Debug, vec::Vec};

/// An application-specific cryptographic object.
/// Application-specific cryptographic object.
///
/// Combines all the core types and constants that are defined by a particular
/// cryptographic scheme when it is used in a specific application domain.
///
/// Typically, the implementers of this trait are its associated types themselves.
/// This provides a convenient way to access generic information about the scheme
/// given any of the associated types.
pub trait AppCrypto: 'static + Send + Sized + CryptoType + Clone {
pub trait AppCrypto: 'static + Sized + CryptoType {
/// Identifier for application-specific key type.
const ID: KeyTypeId;

Expand Down Expand Up @@ -61,38 +61,30 @@ pub trait MaybeHash {}
#[cfg(all(not(feature = "std"), not(feature = "full_crypto")))]
impl<T> MaybeHash for T {}

/// A application's public key.
pub trait AppPublic:
AppCrypto + Public + Ord + PartialOrd + Eq + PartialEq + Debug + MaybeHash + Codec
{
/// The wrapped type which is just a plain instance of `Public`.
type Generic: IsWrappedBy<Self>
+ Public
+ Ord
+ PartialOrd
+ Eq
+ PartialEq
+ Debug
+ MaybeHash
+ Codec;
}

/// A application's key pair.
/// Application-specific key pair.
#[cfg(feature = "full_crypto")]
pub trait AppPair: AppCrypto + Pair<Public = <Self as AppCrypto>::Public> {
pub trait AppPair:
AppCrypto + Pair<Public = <Self as AppCrypto>::Public, Signature = <Self as AppCrypto>::Signature>
{
/// The wrapped type which is just a plain instance of `Pair`.
type Generic: IsWrappedBy<Self>
+ Pair<Public = <<Self as AppCrypto>::Public as AppPublic>::Generic>
+ Pair<Signature = <<Self as AppCrypto>::Signature as AppSignature>::Generic>;
}

/// A application's signature.
pub trait AppSignature: AppCrypto + Eq + PartialEq + Debug {
/// Application-specific public key.
pub trait AppPublic: AppCrypto + Public + Debug + MaybeHash + Codec {
/// The wrapped type which is just a plain instance of `Public`.
type Generic: IsWrappedBy<Self> + Public + Debug + MaybeHash + Codec;
}

/// Application-specific signature.
pub trait AppSignature: AppCrypto + Eq + PartialEq + Debug + Clone {
/// The wrapped type which is just a plain instance of `Signature`.
type Generic: IsWrappedBy<Self> + Eq + PartialEq + Debug;
}

/// A runtime interface for a public key.
/// Runtime interface for a public key.
pub trait RuntimePublic: Sized {
/// The signature that will be generated when signing with the corresponding private key.
type Signature: Debug + Eq + PartialEq + Clone;
Expand Down Expand Up @@ -123,7 +115,7 @@ pub trait RuntimePublic: Sized {
fn to_raw_vec(&self) -> Vec<u8>;
}

/// A runtime interface for an application's public key.
/// Runtime interface for an application's public key.
pub trait RuntimeAppPublic: Sized {
/// An identifier for this application-specific key type.
const ID: KeyTypeId;
Expand Down
2 changes: 1 addition & 1 deletion primitives/core/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ pub trait ByteArray: AsRef<[u8]> + AsMut<[u8]> + for<'a> TryFrom<&'a [u8], Error
}

/// Trait suitable for typical cryptographic key public type.
pub trait Public: CryptoType + ByteArray + Derive + PartialEq + Eq + Clone + Send {}
pub trait Public: CryptoType + ByteArray + Derive + PartialEq + Eq + Clone + Send + Sync {}

/// An opaque 32-byte cryptographic identifier.
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, MaxEncodedLen, TypeInfo)]
Expand Down