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

#include <bppp.hpp>

Public Member Functions

 PreparedNonceWithProof (const PreparedNonceWithProof &)=delete
PreparedNonceWithProof & operator= (const PreparedNonceWithProof &)=delete
 PreparedNonceWithProof (PreparedNonceWithProof &&other) noexcept=default
PreparedNonceWithProof & operator= (PreparedNonceWithProof &&other) noexcept=default
 ~PreparedNonceWithProof ()=default
const Nonce & public_nonce () const noexcept
 Returns the public nonce proved by this bundle.
bool available () const noexcept
 Returns whether the wrapped secret nonce remains available.
const NonceProof & proof () const noexcept
 Returns the public nonce proof carried by this bundle.
Result< Scalar32 > scalar () const
 Explicitly exports the secret nonce scalar from the wrapped prepared nonce.
Result< Scalar32 > raw_scalar () const
 Explicitly exports the scalar for the proof's full raw point.
Result< ProvenSignature > sign_message (const SecretKey &secret, std::span< const unsigned char > message, purify_secp_context *secp_context) &&
 Consumes this message-bound prepared proof bundle and signs the message.
Result< ProvenSignature > sign_topic_message (const SecretKey &secret, std::span< const unsigned char > message, purify_secp_context *secp_context) &&
 Consumes this topic-bound prepared proof bundle and signs the message.

Static Public Member Functions

static PreparedNonceWithProof from_parts (PreparedNonce prepared, NonceProof proof)
 Bundles a prepared nonce with its matching BPPP-backed public nonce proof.

Detailed Description

Definition at line 421 of file bppp.hpp.

Constructor & Destructor Documentation

◆ PreparedNonceWithProof() [1/2]

purify::puresign_plusplus::PreparedNonceWithProof::PreparedNonceWithProof ( const PreparedNonceWithProof & )
delete

◆ PreparedNonceWithProof() [2/2]

purify::puresign_plusplus::PreparedNonceWithProof::PreparedNonceWithProof ( PreparedNonceWithProof && other)
defaultnoexcept

◆ ~PreparedNonceWithProof()

purify::puresign_plusplus::PreparedNonceWithProof::~PreparedNonceWithProof ( )
default

Member Function Documentation

◆ available()

bool purify::puresign_plusplus::PreparedNonceWithProof::available ( ) const
inlinenodiscardnoexcept

Definition at line 439 of file bppp.hpp.

◆ from_parts()

PreparedNonceWithProof purify::puresign_plusplus::PreparedNonceWithProof::from_parts ( PreparedNonce prepared,
NonceProof proof )
staticnodiscard
Parameters
preparedThe prepared nonce carrying the secret scalar.
proofThe public nonce proof matching prepared.
Returns
The constructed move-only prepared nonce-plus-proof bundle.

Definition at line 517 of file bppp.cpp.

References PreparedNonceWithProof(), and proof().

Referenced by purify::puresign_plusplus::api_impl::prepare_message_nonce_with_proof(), purify::puresign_plusplus::api_impl::prepare_message_nonce_with_proof(), purify::puresign_plusplus::api_impl::prepare_topic_nonce_with_proof(), and purify::puresign_plusplus::api_impl::prepare_topic_nonce_with_proof().

◆ operator=() [1/2]

PreparedNonceWithProof & purify::puresign_plusplus::PreparedNonceWithProof::operator= ( const PreparedNonceWithProof & )
delete

◆ operator=() [2/2]

PreparedNonceWithProof & purify::puresign_plusplus::PreparedNonceWithProof::operator= ( PreparedNonceWithProof && other)
defaultnoexcept

◆ proof()

const NonceProof & purify::puresign_plusplus::PreparedNonceWithProof::proof ( ) const
inlinenodiscardnoexcept
Returns
The BPPP-backed nonce proof paired with the prepared nonce.

Definition at line 447 of file bppp.hpp.

Referenced by from_parts().

◆ public_nonce()

const Nonce & purify::puresign_plusplus::PreparedNonceWithProof::public_nonce ( ) const
inlinenodiscardnoexcept
Returns
The x-only public nonce that the bundled proof refers to.

Definition at line 434 of file bppp.hpp.

◆ raw_scalar()

Result< Scalar32 > purify::puresign_plusplus::PreparedNonceWithProof::raw_scalar ( ) const
nodiscard

scalar() follows BIP340's even-point normalization. This accessor reverses that normalization when the proof binds an odd compressed point, so the returned scalar always satisfies raw_scalar * G == proof().commitment_point.

Definition at line 521 of file bppp.cpp.

References purify::BindingMismatch, purify::InternalMismatch, PURIFY_ASSIGN_OR_RETURN, purify_scalar_get_b32(), purify_scalar_is_zero(), purify_scalar_negate(), purify_scalar_set_b32(), purify::RangeViolation, scalar(), purify::detail::secure_clear_bytes(), purify::unexpected_error(), and purify::UninitializedState.

◆ scalar()

Result< Scalar32 > purify::puresign_plusplus::PreparedNonceWithProof::scalar ( ) const
inlinenodiscard
Returns
A scalar copy, or UninitializedState after the nonce is consumed.

Definition at line 455 of file bppp.hpp.

Referenced by raw_scalar().

◆ sign_message()

Result< ProvenSignature > purify::puresign_plusplus::PreparedNonceWithProof::sign_message ( const SecretKey & secret,
std::span< const unsigned char > message,
purify_secp_context * secp_context ) &&
nodiscard
Parameters
secretThe owned secret corresponding to the prepared nonce.
messageThe message that must match the nonce binding.
Returns
The resulting signature bundled with its nonce proof.

Definition at line 558 of file bppp.cpp.

References purify::InternalMismatch, purify::puresign_plusplus::NonceProof::nonce, PURIFY_ASSIGN_OR_RETURN, purify::puresign_plusplus::api_impl::sign_message_with_prepared(), purify::unexpected_error(), and purify::puresign_plusplus::Nonce::xonly.

◆ sign_topic_message()

Result< ProvenSignature > purify::puresign_plusplus::PreparedNonceWithProof::sign_topic_message ( const SecretKey & secret,
std::span< const unsigned char > message,
purify_secp_context * secp_context ) &&
nodiscard
Parameters
secretThe owned secret corresponding to the prepared nonce.
messageThe message to sign.
Returns
The resulting signature bundled with its nonce proof.

Definition at line 571 of file bppp.cpp.

References purify::InternalMismatch, purify::puresign_plusplus::NonceProof::nonce, PURIFY_ASSIGN_OR_RETURN, purify::puresign_plusplus::api_impl::sign_with_prepared_topic(), purify::unexpected_error(), and purify::puresign_plusplus::Nonce::xonly.


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