|
purify
C++ Purify implementation with native circuit and BPP support
|
Move-only prepared nonce bound to either a message or a topic. More...
#include <bppp.hpp>
Public Types | |
| enum class | Scope : std::uint8_t { Message , Topic } |
Public Member Functions | |
| PreparedNonce (const PreparedNonce &)=delete | |
| PreparedNonce & | operator= (const PreparedNonce &)=delete |
| PreparedNonce (PreparedNonce &&other) noexcept | |
| PreparedNonce & | operator= (PreparedNonce &&other) noexcept |
| ~PreparedNonce () | |
| const Nonce & | public_nonce () const noexcept |
| Returns the public nonce corresponding to this prepared secret nonce scalar. | |
| Scalar32 | scalar () const |
| Explicitly exports the secret nonce scalar. | |
| Result< Signature > | sign_message (const Bip340Key &signer, std::span< const unsigned char > message, purify_secp_context *secp_context) && |
| Consumes this message-bound nonce and signs the matching message. | |
| Result< Signature > | sign_topic_message (const Bip340Key &signer, std::span< const unsigned char > message, purify_secp_context *secp_context) && |
| Consumes this topic-bound nonce and signs a message under that topic binding. | |
Static Public Member Functions | |
| static PreparedNonce | from_parts (Scope scope, const Scalar32 &scalar, const Nonce &nonce, const XOnly32 &signer_pubkey, const XOnly32 &binding_digest) |
| Builds a prepared nonce from already-derived nonce components. | |
The public nonce is safe to send over the wire. The secret scalar is intentionally not serializable and is wiped on destruction and after moves.
|
strong |
|
delete |
|
noexcept |
| purify::puresign_plusplus::PreparedNonce::~PreparedNonce | ( | ) |
|
static |
| scope | Whether the nonce is message-bound or topic-bound. |
| scalar | The secret nonce scalar to store. |
| nonce | The public x-only nonce corresponding to scalar. |
| signer_pubkey | The signer's BIP340 x-only public key. |
| binding_digest | The binding digest that this nonce must later match. |
Definition at line 306 of file bppp.cpp.
References binding_digest, nonce, scalar(), scope, and signer_pubkey.
Referenced by purify::puresign_plusplus::api_impl::prepare_message_nonce(), 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(), purify::puresign_plusplus::api_impl::prepare_topic_nonce_with_proof(), and purify::puresign_plusplus::api_impl::prepare_topic_nonce_with_proof().
|
delete |
|
noexcept |
|
inlinenoexcept |
Definition at line 302 of file bppp.hpp.
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(), purify::puresign_plusplus::api_impl::prepare_topic_nonce_with_proof(), and purify::puresign_plusplus::PreparedNonceWithProof::public_nonce().
|
inline |
This is intentionally a copy-returning accessor so callers have to opt in to handling the secret value.
Definition at line 312 of file bppp.hpp.
Referenced by from_parts(), and purify::puresign_plusplus::PreparedNonceWithProof::scalar().
| Result< Signature > purify::puresign_plusplus::PreparedNonce::sign_message | ( | const Bip340Key & | signer, |
| std::span< const unsigned char > | message, | ||
| purify_secp_context * | secp_context | ||
| ) | && |
| signer | The BIP340 signer derived from the same secret as this prepared nonce. |
| message | The message that must match the nonce binding. |
Definition at line 338 of file bppp.cpp.
References purify::BackendRejectedInput, binding_digest, purify::BindingMismatch, purify::InternalMismatch, purify_bip340_sign_with_fixed_nonce(), purify_bip340_verify(), PURIFY_RETURN_IF_ERROR, purify::require_secp_context(), and purify::unexpected_error().
| Result< Signature > purify::puresign_plusplus::PreparedNonce::sign_topic_message | ( | const Bip340Key & | signer, |
| std::span< const unsigned char > | message, | ||
| purify_secp_context * | secp_context | ||
| ) | && |
| signer | The BIP340 signer derived from the same secret as this prepared nonce. |
| message | The message to sign. |
Definition at line 368 of file bppp.cpp.
References purify::BackendRejectedInput, purify::BindingMismatch, purify::InternalMismatch, purify_bip340_sign_with_fixed_nonce(), purify_bip340_verify(), PURIFY_RETURN_IF_ERROR, purify::require_secp_context(), and purify::unexpected_error().