Kagome
Polkadot Runtime Engine in C++17
kagome::crypto::Sr25519Suite Class Reference

#include <crypto_suites.hpp>

Inheritance diagram for kagome::crypto::Sr25519Suite:
Collaboration diagram for kagome::crypto::Sr25519Suite:

Public Member Functions

 Sr25519Suite (std::shared_ptr< Sr25519Provider > sr_provider)
 
 ~Sr25519Suite () override=default
 
outcome::result< Sr25519KeypairAndSeedgenerateRandomKeypair () const noexceptoverride
 
outcome::result< Sr25519KeypairgenerateKeypair (const Sr25519Seed &seed) const noexceptoverride
 
Sr25519Keypair composeKeypair (PublicKey pub, PrivateKey priv) const noexceptoverride
 
std::pair< PublicKey, PrivateKeydecomposeKeypair (const Sr25519Keypair &kp) const noexceptoverride
 
outcome::result< PublicKeytoPublicKey (gsl::span< const uint8_t > bytes) const noexceptoverride
 
outcome::result< SeedtoSeed (gsl::span< const uint8_t > bytes) const noexceptoverride
 
- Public Member Functions inherited from kagome::crypto::CryptoSuite< Sr25519PublicKey, Sr25519SecretKey, Sr25519Keypair, Sr25519KeypairAndSeed, Sr25519Seed >
virtual ~CryptoSuite ()=default
 

Private Attributes

std::shared_ptr< Sr25519Providersr_provider_
 

Additional Inherited Members

- Public Types inherited from kagome::crypto::CryptoSuite< Sr25519PublicKey, Sr25519SecretKey, Sr25519Keypair, Sr25519KeypairAndSeed, Sr25519Seed >
using PublicKey = Sr25519PublicKey
 
using PrivateKey = Sr25519SecretKey
 
using Keypair = Sr25519Keypair
 
using KeypairAndSeed = Sr25519KeypairAndSeed
 
using Seed = Sr25519Seed
 

Detailed Description

Definition at line 174 of file crypto_suites.hpp.

Constructor & Destructor Documentation

kagome::crypto::Sr25519Suite::Sr25519Suite ( std::shared_ptr< Sr25519Provider sr_provider)
inlineexplicit

Definition at line 180 of file crypto_suites.hpp.

kagome::crypto::Sr25519Suite::~Sr25519Suite ( )
overridedefault

Member Function Documentation

Sr25519Keypair kagome::crypto::Sr25519Suite::composeKeypair ( PublicKey  pub,
PrivateKey  priv 
) const
inlineoverridevirtualnoexcept

Create a keypair from a public key and a private key

Note
Although it is typically just a structure with two fields, from the compiler point of view they all are different types, thus this convenience method emerges

Implements kagome::crypto::CryptoSuite< Sr25519PublicKey, Sr25519SecretKey, Sr25519Keypair, Sr25519KeypairAndSeed, Sr25519Seed >.

Definition at line 197 of file crypto_suites.hpp.

std::pair<PublicKey, PrivateKey> kagome::crypto::Sr25519Suite::decomposeKeypair ( const Sr25519Keypair kp) const
inlineoverridevirtualnoexcept

Extrace the private key and the public key from a keypair

See also
composeKeypair()

Implements kagome::crypto::CryptoSuite< Sr25519PublicKey, Sr25519SecretKey, Sr25519Keypair, Sr25519KeypairAndSeed, Sr25519Seed >.

Definition at line 203 of file crypto_suites.hpp.

outcome::result<Sr25519Keypair> kagome::crypto::Sr25519Suite::generateKeypair ( const Sr25519Seed &  seed) const
inlineoverridevirtualnoexcept

Genereate a keypair from

Parameters
seed(mind that in some algorithms a seed is a private key)

Implements kagome::crypto::CryptoSuite< Sr25519PublicKey, Sr25519SecretKey, Sr25519Keypair, Sr25519KeypairAndSeed, Sr25519Seed >.

Definition at line 192 of file crypto_suites.hpp.

outcome::result<Sr25519KeypairAndSeed> kagome::crypto::Sr25519Suite::generateRandomKeypair ( ) const
inlineoverridevirtualnoexcept

Generate a random keypair (randomness source is determined by an underlying crypto provider)

Implements kagome::crypto::CryptoSuite< Sr25519PublicKey, Sr25519SecretKey, Sr25519Keypair, Sr25519KeypairAndSeed, Sr25519Seed >.

Definition at line 187 of file crypto_suites.hpp.

outcome::result<PublicKey> kagome::crypto::Sr25519Suite::toPublicKey ( gsl::span< const uint8_t >  bytes) const
inlineoverridevirtualnoexcept
outcome::result<Seed> kagome::crypto::Sr25519Suite::toSeed ( gsl::span< const uint8_t >  bytes) const
inlineoverridevirtualnoexcept

Member Data Documentation

std::shared_ptr<Sr25519Provider> kagome::crypto::Sr25519Suite::sr_provider_
private

Definition at line 220 of file crypto_suites.hpp.


The documentation for this class was generated from the following file: