Skip to content

sgns::crypto::SR25519Provider

#include <sr25519_provider.hpp>

Inherits from IComponent

Inherited by sgns::crypto::SR25519ProviderImpl

Public Functions

Name
~SR25519Provider() override =default
virtual SR25519Keypair generateKeypair() const =0
virtual SR25519Keypair generateKeypair(const SR25519Seed & seed) const =0
virtual outcome::result< SR25519Signature > sign(const SR25519Keypair & keypair, gsl::span< const uint8_t > message) const =0
Sign a message using the given keypair.
virtual outcome::result< bool > verify(const SR25519Signature & signature, gsl::span< const uint8_t > message, const SR25519PublicKey & public_key) const =0
Verifies that the message was signed by the given public key.

Additional inherited members

Public Functions inherited from IComponent

Name
virtual ~IComponent() =default
virtual std::string GetName() =0

Public Functions Documentation

function ~SR25519Provider

~SR25519Provider() override =default

function generateKeypair

virtual SR25519Keypair generateKeypair() const =0

Reimplemented by: sgns::crypto::SR25519ProviderImpl::generateKeypair

Generates random keypair for signing the message

function generateKeypair

virtual SR25519Keypair generateKeypair(
    const SR25519Seed & seed
) const =0

Reimplemented by: sgns::crypto::SR25519ProviderImpl::generateKeypair

Generate random keypair from seed

function sign

virtual outcome::result< SR25519Signature > sign(
    const SR25519Keypair & keypair,
    gsl::span< const uint8_t > message
) const =0

Sign a message using the given keypair.

Parameters:

  • keypair Pair of public and secret sr25519 keys.
  • message Bytes to be signed.

Return: Signature of the message.

Reimplemented by: sgns::crypto::SR25519ProviderImpl::sign

function verify

virtual outcome::result< bool > verify(
    const SR25519Signature & signature,
    gsl::span< const uint8_t > message,
    const SR25519PublicKey & public_key
) const =0

Verifies that the message was signed by the given public key.

Parameters:

  • signature Signature to verify.
  • message Message bytes.
  • public_key Public key to verify against.

Return: true if signature is valid, false otherwise.

Reimplemented by: sgns::crypto::SR25519ProviderImpl::verify


Updated on 2026-03-04 at 13:10:43 -0800