purify
C++ Purify implementation with native circuit and BPP support
Loading...
Searching...
No Matches
api.hpp File Reference

High-level Purify key generation, evaluation, witness generation, and circuit helpers. More...

#include <array>
#include <concepts>
#include <span>
#include <type_traits>
#include <utility>
#include "purify/bulletproof.hpp"
#include "purify/secret.hpp"

Go to the source code of this file.

Data Structures

struct  purify::GeneratedKey
 Derived Purify keypair bundle with an owned packed secret and its matching public key. More...
 
struct  purify::Bip340Key
 Canonical BIP340 keypair derived deterministically from a packed Purify secret. More...
 
struct  purify::BulletproofWitnessData
 Complete witness bundle for evaluating and proving a Purify instance. More...
 

Namespaces

namespace  purify
 

Concepts

concept  purify::NoexceptByteFill
 Callable concept for byte-fill RNG adapters that cannot fail.
 
concept  purify::NoexceptCheckedByteFill
 Callable concept for byte-fill RNG adapters that report failure via Status.
 

Typedefs

using purify::KeySeed = SpanAtLeast< 16, const unsigned char >
 Minimum-length checked wrapper for deterministic key-generation seed material.
 

Functions

Result< GeneratedKeypurify::derive_key (const SecretKey &secret)
 Derives the packed public key corresponding to a packed secret.
 
Result< GeneratedKeypurify::derive_key (SecretKey &&secret)
 Derives the packed public key corresponding to a packed secret.
 
Result< Bip340Keypurify::derive_bip340_key (const SecretKey &secret, purify_secp_context *secp_context)
 Derives a canonical BIP340 signing keypair from an owned Purify secret.
 
UInt512 purify::key_space_size ()
 Returns the size of the packed Purify secret-key space.
 
Status purify::fill_secure_random (std::span< unsigned char > bytes) noexcept
 Fills a buffer with operating-system randomness.
 
template<typename FillRandom >
requires NoexceptCheckedByteFill<FillRandom>
Result< UInt512purify::random_below (const UInt512 &range, FillRandom &&fill_random)
 Samples a uniformly random packed secret below a range using a checked byte-fill source.
 
template<typename FillRandom >
requires NoexceptByteFill<FillRandom>
Result< UInt512purify::random_below (const UInt512 &range, FillRandom &&fill_random)
 Samples a uniformly random packed secret below a range using a no-fail byte-fill source.
 
Result< UInt512purify::random_below (const UInt512 &range)
 Samples a uniformly random packed secret below a range using the built-in OS RNG.
 
Result< GeneratedKeypurify::generate_key ()
 Generates a random Purify keypair using the built-in OS RNG.
 
Result< GeneratedKeypurify::generate_key (KeySeed seed)
 Deterministically derives a Purify keypair from seed material.
 
Result< GeneratedKeypurify::generate_key (std::span< const unsigned char > seed)
 Deterministically derives a Purify keypair from seed material.
 
template<typename FillRandom >
requires (NoexceptByteFill<FillRandom> || NoexceptCheckedByteFill<FillRandom>)
Result< GeneratedKeypurify::generate_key (FillRandom &&fill_random)
 Generates a random Purify keypair using a caller-supplied byte-fill routine.
 
Result< FieldElementpurify::eval (const SecretKey &secret, const Bytes &message)
 Evaluates the Purify PRF for an owned secret key and message.
 
Result< std::string > purify::verifier (const Bytes &message, const UInt512 &pubkey)
 Builds the legacy serialized verifier description for a message and public key.
 
Result< NativeBulletproofCircuitpurify::verifier_circuit (const Bytes &message, const UInt512 &pubkey)
 Builds the native verifier circuit for a message and public key.
 
Result< BulletproofWitnessDatapurify::prove_assignment_data (const Bytes &message, const SecretKey &secret)
 Computes the native Purify witness for a message and secret.
 
Result< bool > purify::evaluate_verifier_circuit (const Bytes &message, const BulletproofWitnessData &witness)
 Evaluates the generated verifier circuit against an explicit witness.
 
Result< bool > purify::evaluate_verifier_circuit (const Bytes &message, const SecretKey &secret)
 Evaluates the generated verifier circuit using a witness derived from a secret.
 
Result< Bytespurify::prove_assignment (const Bytes &message, const SecretKey &secret)
 Serializes the witness assignment produced for a message and secret.