Trait RuntimeAppPublic

Source
pub trait RuntimeAppPublic: Sized {
    type Signature: Codec + Debug + MaybeHash + Eq + PartialEq + Clone;

    const ID: KeyTypeId;
    const CRYPTO_ID: CryptoTypeId;

    // Required methods
    fn all() -> Vec<Self>;
    fn generate_pair(seed: Option<Vec<u8>>) -> Self;
    fn sign<M>(&self, msg: &M) -> Option<Self::Signature>
       where M: AsRef<[u8]>;
    fn verify<M>(&self, msg: &M, signature: &Self::Signature) -> bool
       where M: AsRef<[u8]>;
    fn to_raw_vec(&self) -> Vec<u8> ;
}
Expand description

A runtime interface for an application’s public key.

Required Associated Constants§

Source

const ID: KeyTypeId

An identifier for this application-specific key type.

Source

const CRYPTO_ID: CryptoTypeId

The identifier of the crypto type of this application-specific key type.

Required Associated Types§

Source

type Signature: Codec + Debug + MaybeHash + Eq + PartialEq + Clone

The signature that will be generated when signing with the corresponding private key.

Required Methods§

Source

fn all() -> Vec<Self>

Returns all public keys for this application in the keystore.

Source

fn generate_pair(seed: Option<Vec<u8>>) -> Self

Generate a public/private pair with an optional seed and store it in the keystore.

The seed needs to be valid utf8.

Returns the generated public key.

Source

fn sign<M>(&self, msg: &M) -> Option<Self::Signature>
where M: AsRef<[u8]>,

Sign the given message with the corresponding private key of this public key.

The private key will be requested from the keystore.

Returns the signature or None if the private key could not be found or some other error occurred.

Source

fn verify<M>(&self, msg: &M, signature: &Self::Signature) -> bool
where M: AsRef<[u8]>,

Verify that the given signature matches the given message using this public key.

Source

fn to_raw_vec(&self) -> Vec<u8>

Returns Self as raw vec.

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 RuntimeAppPublic for tet_application_crypto::ecdsa::app::Public
where Public: RuntimePublic<Signature = Signature>,

Source§

const ID: KeyTypeId = ECDSA

Source§

const CRYPTO_ID: CryptoTypeId = super::CRYPTO_ID

Source§

type Signature = Signature

Source§

impl RuntimeAppPublic for tet_application_crypto::ed25519::app::Public
where Public: RuntimePublic<Signature = Signature>,

Source§

const ID: KeyTypeId = ED25519

Source§

const CRYPTO_ID: CryptoTypeId = super::CRYPTO_ID

Source§

type Signature = Signature

Source§

impl RuntimeAppPublic for tet_application_crypto::sr25519::app::Public
where Public: RuntimePublic<Signature = Signature>,

Source§

const ID: KeyTypeId = SR25519

Source§

const CRYPTO_ID: CryptoTypeId = super::CRYPTO_ID

Source§

type Signature = Signature

Source§

impl RuntimeAppPublic for UintAuthorityId