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

#include <sr25519_provider_impl.hpp>

Inheritance diagram for kagome::crypto::Sr25519ProviderImpl:
Collaboration diagram for kagome::crypto::Sr25519ProviderImpl:

Public Member Functions

 Sr25519ProviderImpl (std::shared_ptr< CSPRNG > generator)
 
 ~Sr25519ProviderImpl () override=default
 
Sr25519KeypairAndSeed generateKeypair () const override
 
Sr25519Keypair generateKeypair (const Sr25519Seed &seed) const override
 
outcome::result< Sr25519Signature > sign (const Sr25519Keypair &keypair, gsl::span< const uint8_t > message) const override
 
outcome::result< bool > verify_deprecated (const Sr25519Signature &signature, gsl::span< const uint8_t > message, const Sr25519PublicKey &public_key) const override
 
outcome::result< bool > verify (const Sr25519Signature &signature, gsl::span< const uint8_t > message, const Sr25519PublicKey &public_key) const override
 
- Public Member Functions inherited from kagome::crypto::Sr25519Provider
virtual ~Sr25519Provider ()=default
 

Private Types

using CSPRNG = libp2p::crypto::random::CSPRNG
 

Private Attributes

std::shared_ptr< CSPRNGgenerator_
 

Detailed Description

Definition at line 18 of file sr25519_provider_impl.hpp.

Member Typedef Documentation

using kagome::crypto::Sr25519ProviderImpl::CSPRNG = libp2p::crypto::random::CSPRNG
private

Definition at line 19 of file sr25519_provider_impl.hpp.

Constructor & Destructor Documentation

kagome::crypto::Sr25519ProviderImpl::Sr25519ProviderImpl ( std::shared_ptr< CSPRNG generator)
explicit

Definition at line 12 of file sr25519_provider_impl.cpp.

kagome::crypto::Sr25519ProviderImpl::~Sr25519ProviderImpl ( )
overridedefault

Member Function Documentation

Sr25519KeypairAndSeed kagome::crypto::Sr25519ProviderImpl::generateKeypair ( ) const
overridevirtual

Generates random keypair for signing the message

Implements kagome::crypto::Sr25519Provider.

Definition at line 17 of file sr25519_provider_impl.cpp.

Sr25519Keypair kagome::crypto::Sr25519ProviderImpl::generateKeypair ( const Sr25519Seed &  seed) const
overridevirtual

Generate random keypair from seed

Implements kagome::crypto::Sr25519Provider.

Definition at line 23 of file sr25519_provider_impl.cpp.

outcome::result< Sr25519Signature > kagome::crypto::Sr25519ProviderImpl::sign ( const Sr25519Keypair keypair,
gsl::span< const uint8_t >  message 
) const
overridevirtual

Sign message

Parameters
msgusing
keypair.If computed value is less than
thresholdthen return optional containing this value and proof. Otherwise none returned
keypairpair of public and secret sr25519 keys
messagebytes to be signed
Returns
signed message

Implements kagome::crypto::Sr25519Provider.

Definition at line 39 of file sr25519_provider_impl.cpp.

outcome::result< bool > kagome::crypto::Sr25519ProviderImpl::verify ( const Sr25519Signature &  signature,
gsl::span< const uint8_t >  message,
const Sr25519PublicKey &  public_key 
) const
overridevirtual

Verifies that

Parameters
messagewas derived using
public_keyon
signature

Implements kagome::crypto::Sr25519Provider.

Definition at line 70 of file sr25519_provider_impl.cpp.

outcome::result< bool > kagome::crypto::Sr25519ProviderImpl::verify_deprecated ( const Sr25519Signature &  signature,
gsl::span< const uint8_t >  message,
const Sr25519PublicKey &  public_key 
) const
overridevirtual

Implements kagome::crypto::Sr25519Provider.

Definition at line 56 of file sr25519_provider_impl.cpp.

Member Data Documentation

std::shared_ptr<CSPRNG> kagome::crypto::Sr25519ProviderImpl::generator_
private

Definition at line 45 of file sr25519_provider_impl.hpp.


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