purify
C++ Purify implementation with native circuit and BPP support
Loading...
Searching...
No Matches
purify::puresign::KeyPair Class Reference

#include <legacy.hpp>

Public Member Functions

 KeyPair (const KeyPair &)=delete
KeyPair & operator= (const KeyPair &)=delete
 KeyPair (KeyPair &&other) noexcept=default
KeyPair & operator= (KeyPair &&other) noexcept=default
 ~KeyPair ()=default
const PublicKey & public_key () const noexcept
 Returns the public key bundle associated with this signer.
Result< PreparedNonce > prepare_message_nonce (std::span< const unsigned char > message, purify_secp_context *secp_context) const
 Deterministically prepares a message-bound nonce.
Result< PreparedNonceWithProof > prepare_message_nonce_with_proof (std::span< const unsigned char > message, purify_secp_context *secp_context) const
 Deterministically prepares a message-bound nonce together with its proof.
Result< PreparedNonceWithProof > prepare_message_nonce_with_proof (const MessageProofCache &cache, purify_secp_context *secp_context) const
 Prepares a message-bound nonce proof using a reusable message cache.
Result< PreparedNonce > prepare_topic_nonce (std::span< const unsigned char > topic, purify_secp_context *secp_context) const
 Deterministically prepares a topic-bound nonce.
Result< PreparedNonceWithProof > prepare_topic_nonce_with_proof (std::span< const unsigned char > topic, purify_secp_context *secp_context) const
 Deterministically prepares a topic-bound nonce together with its proof.
Result< PreparedNonceWithProof > prepare_topic_nonce_with_proof (const TopicProofCache &cache, purify_secp_context *secp_context) const
 Prepares a topic-bound nonce proof using a reusable topic cache.
Result< Signature > sign_message (std::span< const unsigned char > message, purify_secp_context *secp_context) const
 Signs a message with a deterministically derived message-bound nonce.
Result< Signature > sign_message_with_prepared (std::span< const unsigned char > message, PreparedNonce &&prepared, purify_secp_context *secp_context) const
 Signs a message using an already prepared message-bound nonce.
Result< ProvenSignature > sign_message_with_prepared_proof (std::span< const unsigned char > message, PreparedNonceWithProof &&prepared, purify_secp_context *secp_context) const
 Signs a message using an already prepared message-bound nonce proof bundle.
Result< Signature > sign_with_topic (std::span< const unsigned char > message, std::span< const unsigned char > topic, purify_secp_context *secp_context) const
 Signs a message using a topic-bound deterministic nonce.
Result< Signature > sign_with_prepared_topic (std::span< const unsigned char > message, PreparedNonce &&prepared, purify_secp_context *secp_context) const
 Signs a message using an already prepared topic-bound nonce.
Result< ProvenSignature > sign_with_prepared_topic_proof (std::span< const unsigned char > message, PreparedNonceWithProof &&prepared, purify_secp_context *secp_context) const
 Signs a message using an already prepared topic-bound nonce proof bundle.
Result< ProvenSignature > sign_message_with_proof (std::span< const unsigned char > message, purify_secp_context *secp_context) const
 Signs a message and returns the signature bundled with its nonce proof.
Result< ProvenSignature > sign_message_with_proof (const MessageProofCache &cache, purify_secp_context *secp_context) const
 Signs a message with proof using a reusable message cache.
Result< ProvenSignature > sign_with_topic_proof (std::span< const unsigned char > message, std::span< const unsigned char > topic, purify_secp_context *secp_context) const
 Signs a message with a topic-bound nonce proof.
Result< ProvenSignature > sign_with_topic_proof (std::span< const unsigned char > message, const TopicProofCache &cache, purify_secp_context *secp_context) const
 Signs a message with a topic-bound nonce proof using a reusable topic cache.

Static Public Member Functions

static Result< KeyPair > from_secret (const SecretKey &secret, purify_secp_context *secp_context)
 Derives a signing key pair from one packed Purify secret.
static Result< KeyPair > from_secret (SecretKey &&secret, purify_secp_context *secp_context)
 Derives a signing key pair from one owned Purify secret.

Detailed Description

Definition at line 445 of file legacy.hpp.

Constructor & Destructor Documentation

◆ KeyPair() [1/2]

purify::puresign::KeyPair::KeyPair ( const KeyPair & )
delete

References KeyPair().

Referenced by from_secret(), KeyPair(), KeyPair(), operator=(), and operator=().

◆ KeyPair() [2/2]

purify::puresign::KeyPair::KeyPair ( KeyPair && other)
defaultnoexcept

References KeyPair().

◆ ~KeyPair()

purify::puresign::KeyPair::~KeyPair ( )
default

Member Function Documentation

◆ from_secret() [1/2]

Result< KeyPair > purify::puresign::KeyPair::from_secret ( const SecretKey & secret,
purify_secp_context * secp_context )
staticnodiscard
Parameters
secretThe secret to clone into the returned key pair.
Returns
A move-only signer object bundling the secret and public key.

Definition at line 779 of file legacy.cpp.

References purify::SecretKey::clone(), from_secret(), and PURIFY_ASSIGN_OR_RETURN.

Referenced by from_secret().

◆ from_secret() [2/2]

Result< KeyPair > purify::puresign::KeyPair::from_secret ( SecretKey && secret,
purify_secp_context * secp_context )
staticnodiscard
Parameters
secretThe secret to move into the returned key pair.
Returns
A move-only signer object bundling the secret and public key.

Definition at line 784 of file legacy.cpp.

References purify::puresign::PublicKey::from_secret(), KeyPair(), public_key(), and PURIFY_ASSIGN_OR_RETURN.

◆ operator=() [1/2]

KeyPair & purify::puresign::KeyPair::operator= ( const KeyPair & )
delete

References KeyPair().

◆ operator=() [2/2]

KeyPair & purify::puresign::KeyPair::operator= ( KeyPair && other)
defaultnoexcept

References KeyPair().

◆ prepare_message_nonce()

Result< PreparedNonce > purify::puresign::KeyPair::prepare_message_nonce ( std::span< const unsigned char > message,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message to bind into the nonce derivation.
Returns
The move-only prepared nonce.

Definition at line 789 of file legacy.cpp.

References purify::puresign::api_impl::prepare_message_nonce().

Referenced by sign_message().

◆ prepare_message_nonce_with_proof() [1/2]

Result< PreparedNonceWithProof > purify::puresign::KeyPair::prepare_message_nonce_with_proof ( const MessageProofCache & cache,
purify_secp_context * secp_context ) const
nodiscard
Parameters
cacheThe prebuilt cache for the exact message to bind.
Returns
The prepared nonce plus its public proof.

Definition at line 799 of file legacy.cpp.

References purify::puresign::api_impl::prepare_message_nonce_with_proof().

◆ prepare_message_nonce_with_proof() [2/2]

Result< PreparedNonceWithProof > purify::puresign::KeyPair::prepare_message_nonce_with_proof ( std::span< const unsigned char > message,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message to bind into the nonce derivation and proof statement.
Returns
The prepared nonce plus its public proof.

Definition at line 794 of file legacy.cpp.

References purify::puresign::api_impl::prepare_message_nonce_with_proof().

Referenced by sign_message_with_proof(), and sign_message_with_proof().

◆ prepare_topic_nonce()

Result< PreparedNonce > purify::puresign::KeyPair::prepare_topic_nonce ( std::span< const unsigned char > topic,
purify_secp_context * secp_context ) const
nodiscard
Parameters
topicThe topic to bind into the nonce derivation.
Returns
The move-only prepared nonce.

Definition at line 804 of file legacy.cpp.

References purify::puresign::api_impl::prepare_topic_nonce().

Referenced by sign_with_topic().

◆ prepare_topic_nonce_with_proof() [1/2]

Result< PreparedNonceWithProof > purify::puresign::KeyPair::prepare_topic_nonce_with_proof ( const TopicProofCache & cache,
purify_secp_context * secp_context ) const
nodiscard
Parameters
cacheThe prebuilt cache for the exact topic to bind.
Returns
The prepared nonce plus its public proof.

Definition at line 814 of file legacy.cpp.

References purify::puresign::api_impl::prepare_topic_nonce_with_proof().

◆ prepare_topic_nonce_with_proof() [2/2]

Result< PreparedNonceWithProof > purify::puresign::KeyPair::prepare_topic_nonce_with_proof ( std::span< const unsigned char > topic,
purify_secp_context * secp_context ) const
nodiscard
Parameters
topicThe topic to bind into the nonce derivation and proof statement.
Returns
The prepared nonce plus its public proof.

Definition at line 809 of file legacy.cpp.

References purify::puresign::api_impl::prepare_topic_nonce_with_proof().

Referenced by sign_with_topic_proof(), and sign_with_topic_proof().

◆ public_key()

const PublicKey & purify::puresign::KeyPair::public_key ( ) const
inlinenodiscardnoexcept
Returns
The derived public-key bundle.

Definition at line 473 of file legacy.hpp.

Referenced by from_secret().

◆ sign_message()

Result< Signature > purify::puresign::KeyPair::sign_message ( std::span< const unsigned char > message,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message to sign.
Returns
The resulting BIP340 signature.

Definition at line 819 of file legacy.cpp.

References prepare_message_nonce(), PURIFY_ASSIGN_OR_RETURN, and sign_message_with_prepared().

◆ sign_message_with_prepared()

Result< Signature > purify::puresign::KeyPair::sign_message_with_prepared ( std::span< const unsigned char > message,
PreparedNonce && prepared,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message that must match the prepared nonce binding.
preparedThe prepared message-bound nonce to consume.
Returns
The resulting BIP340 signature.

Definition at line 825 of file legacy.cpp.

References purify::derive_bip340_key(), and PURIFY_ASSIGN_OR_RETURN.

Referenced by sign_message().

◆ sign_message_with_prepared_proof()

Result< ProvenSignature > purify::puresign::KeyPair::sign_message_with_prepared_proof ( std::span< const unsigned char > message,
PreparedNonceWithProof && prepared,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message that must match the prepared nonce binding.
preparedThe prepared nonce-plus-proof bundle to consume.
Returns
The resulting signature bundled with its nonce proof.

Definition at line 832 of file legacy.cpp.

Referenced by sign_message_with_proof(), and sign_message_with_proof().

◆ sign_message_with_proof() [1/2]

Result< ProvenSignature > purify::puresign::KeyPair::sign_message_with_proof ( const MessageProofCache & cache,
purify_secp_context * secp_context ) const
nodiscard
Parameters
cacheThe prebuilt cache for the exact signed message.
Returns
The resulting signature-plus-proof bundle.

Definition at line 865 of file legacy.cpp.

References purify::puresign::MessageProofCache::message, prepare_message_nonce_with_proof(), PURIFY_ASSIGN_OR_RETURN, and sign_message_with_prepared_proof().

◆ sign_message_with_proof() [2/2]

Result< ProvenSignature > purify::puresign::KeyPair::sign_message_with_proof ( std::span< const unsigned char > message,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message to sign.
Returns
The resulting signature-plus-proof bundle.

Definition at line 858 of file legacy.cpp.

References prepare_message_nonce_with_proof(), PURIFY_ASSIGN_OR_RETURN, and sign_message_with_prepared_proof().

◆ sign_with_prepared_topic()

Result< Signature > purify::puresign::KeyPair::sign_with_prepared_topic ( std::span< const unsigned char > message,
PreparedNonce && prepared,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message to sign.
preparedThe topic-bound nonce to consume.
Returns
The resulting BIP340 signature.

Definition at line 845 of file legacy.cpp.

References purify::derive_bip340_key(), and PURIFY_ASSIGN_OR_RETURN.

Referenced by sign_with_topic().

◆ sign_with_prepared_topic_proof()

Result< ProvenSignature > purify::puresign::KeyPair::sign_with_prepared_topic_proof ( std::span< const unsigned char > message,
PreparedNonceWithProof && prepared,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message to sign.
preparedThe topic-bound nonce-plus-proof bundle to consume.
Returns
The resulting signature bundled with its nonce proof.

Definition at line 852 of file legacy.cpp.

Referenced by sign_with_topic_proof(), and sign_with_topic_proof().

◆ sign_with_topic()

Result< Signature > purify::puresign::KeyPair::sign_with_topic ( std::span< const unsigned char > message,
std::span< const unsigned char > topic,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message to sign.
topicThe topic that the nonce must be bound to.
Returns
The resulting BIP340 signature.

Definition at line 838 of file legacy.cpp.

References prepare_topic_nonce(), PURIFY_ASSIGN_OR_RETURN, and sign_with_prepared_topic().

◆ sign_with_topic_proof() [1/2]

Result< ProvenSignature > purify::puresign::KeyPair::sign_with_topic_proof ( std::span< const unsigned char > message,
const TopicProofCache & cache,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message to sign.
cacheThe prebuilt cache for the exact topic bound into the proof.
Returns
The resulting signature-plus-proof bundle.

Definition at line 880 of file legacy.cpp.

References prepare_topic_nonce_with_proof(), PURIFY_ASSIGN_OR_RETURN, and sign_with_prepared_topic_proof().

◆ sign_with_topic_proof() [2/2]

Result< ProvenSignature > purify::puresign::KeyPair::sign_with_topic_proof ( std::span< const unsigned char > message,
std::span< const unsigned char > topic,
purify_secp_context * secp_context ) const
nodiscard
Parameters
messageThe message to sign.
topicThe topic that the nonce proof must bind to.
Returns
The resulting signature-plus-proof bundle.

Definition at line 872 of file legacy.cpp.

References prepare_topic_nonce_with_proof(), PURIFY_ASSIGN_OR_RETURN, and sign_with_prepared_topic_proof().


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