Skip to content

account/GeniusSigner.hpp

In-memory Genius keypair and canonical signature operations.

Namespaces

Name
sgns

Classes

Name
class sgns::GeniusSigner
Owns a Genius keypair without imposing account persistence or lifecycle concerns.

Source code

#ifndef SGNS_GENIUS_SIGNER_HPP
#define SGNS_GENIUS_SIGNER_HPP

#include <cstddef>
#include <cstdint>
#include <string>
#include <string_view>
#include <vector>

#include <ProofSystem/EthereumKeyGenerator.hpp>

namespace sgns
{
    class GeniusSigner
    {
    public:
        static GeniusSigner Generate();

        explicit GeniusSigner( ethereum::EthereumKeyGenerator keypair );

        [[nodiscard]] std::string GetAddress() const;

        [[nodiscard]] std::vector<uint8_t> Sign( const std::vector<uint8_t> &data ) const;

        static bool VerifySignature( const std::string          &address,
                                     std::string_view            signature,
                                     const std::vector<uint8_t> &data );

        static bool VerifySignature( const std::string          &address,
                                     const std::vector<uint8_t> &signature,
                                     const std::vector<uint8_t> &data );

    private:
        static constexpr size_t SIGNATURE_SIZE = 64;

        ethereum::EthereumKeyGenerator keypair_;
    };
} // namespace sgns

#endif // SGNS_GENIUS_SIGNER_HPP

Updated on 2026-08-07 at 17:48:03 +0000