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

High-level Purify API implementations, including key generation and proof helpers. More...

#include "purify/api.hpp"
#include <algorithm>
#include <cassert>
#include "purify.h"
#include "error_bridge.hpp"

Go to the source code of this file.

Namespaces

namespace  purify
 

Functions

Status purify::fill_secure_random (std::span< unsigned char > bytes) noexcept
 Fills a buffer with operating-system randomness.
 
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::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.
 
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< NativeBulletproofCircuitTemplatepurify::verifier_circuit_template (const Bytes &message)
 Builds a reusable public-key-agnostic verifier-circuit template for a message.
 
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.