Trait StateSignatureKey

Source
pub trait StateSignatureKey:
    Send
    + Sync
    + Clone
    + Sized
    + Debug
    + Hash
    + Serialize
    + for<'a> Deserialize<'a>
    + PartialEq
    + Eq
    + Display
    + Default
    + ToFieldsLightClientCompat
    + for<'a> TryFrom<&'a TaggedBase64>
    + Into<TaggedBase64> {
    type StatePrivateKey: PrivateSignatureKey;
    type StateSignature: Send + Sync + Sized + Clone + Debug + Eq + Serialize + for<'a> Deserialize<'a> + Hash;
    type SignError: Error + Send + Sync;

    // Required methods
    fn sign_state(
        private_key: &Self::StatePrivateKey,
        light_client_state: &LightClientState,
        next_stake_table_state: &StakeTableState,
    ) -> Result<Self::StateSignature, Self::SignError>;
    fn verify_state_sig(
        &self,
        signature: &Self::StateSignature,
        light_client_state: &LightClientState,
        next_stake_table_state: &StakeTableState,
    ) -> bool;
    fn generated_from_seed_indexed(
        seed: [u8; 32],
        index: u64,
    ) -> (Self, Self::StatePrivateKey);
}
Expand description

Light client state signature key with minimal requirements

Required Associated Types§

Source

type StatePrivateKey: PrivateSignatureKey

The private key type

Source

type StateSignature: Send + Sync + Sized + Clone + Debug + Eq + Serialize + for<'a> Deserialize<'a> + Hash

The type of the signature

Source

type SignError: Error + Send + Sync

Type of error that can occur when signing data

Required Methods§

Source

fn sign_state( private_key: &Self::StatePrivateKey, light_client_state: &LightClientState, next_stake_table_state: &StakeTableState, ) -> Result<Self::StateSignature, Self::SignError>

Sign the light client state

Source

fn verify_state_sig( &self, signature: &Self::StateSignature, light_client_state: &LightClientState, next_stake_table_state: &StakeTableState, ) -> bool

Verify the light client state signature

Source

fn generated_from_seed_indexed( seed: [u8; 32], index: u64, ) -> (Self, Self::StatePrivateKey)

Generate a new key pair

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl StateSignatureKey for SchnorrPubKey

Source§

type StatePrivateKey = SignKey<Fp<MontBackend<FrConfig, 4>, 4>>

Source§

type StateSignature = Signature<EdwardsConfig>

Source§

type SignError = SignatureError