purify
C++ Purify implementation with native circuit and BPP support
Loading...
Searching...
No Matches
certificate_nonce_leaf_accumulation.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 Judica, Inc.
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or https://opensource.org/license/mit/.
4
5#pragma once
6
7#include <array>
8#include <cstddef>
9#include <span>
10#include <utility>
11
14
16
28
39
42public:
44 delete;
46 const PreparedCertificateNonceLeaf&) = delete;
48 PreparedCertificateNonceLeaf&&) noexcept = default;
50 PreparedCertificateNonceLeaf&&) noexcept = default;
51
52 [[nodiscard]] const bppp::ScalarBytes& circuit_precommitment()
53 const noexcept {
54 return circuit_precommitment_;
55 }
56
58 [[nodiscard]] const bppp::PointBytes& nonce_point() const noexcept {
59 return nonce_point_;
60 }
61
63 [[nodiscard]] const std::array<unsigned char, 64>& nonce_host()
64 const noexcept {
65 return nonce_host_;
66 }
67
69 [[nodiscard]] std::span<const unsigned char> topic() const noexcept {
70 return topic_;
71 }
72
75 const noexcept {
76 return proof_digest_;
77 }
78
81 const noexcept {
82 return binding_digest_;
83 }
84
87 public_descriptor() const noexcept
88 {
89 return {
90 circuit_precommitment_, nonce_point_, binding_digest_};
91 }
92
94 const noexcept {
95 return norm_;
96 }
97
99 [[nodiscard]] const CertificateNonceLeafParentConstants&
100 parent_constants() const noexcept {
101 return parent_constants_;
102 }
103
104private:
108 std::array<unsigned char, 64> nonce_host,
109 Bytes topic,
114 : circuit_precommitment_(circuit_precommitment),
115 nonce_point_(nonce_point), nonce_host_(nonce_host),
116 topic_(std::move(topic)), proof_digest_(proof_digest),
117 binding_digest_(binding_digest),
118 parent_constants_(std::move(parent_constants)),
119 norm_(std::move(norm)) {}
120
121 bppp::ScalarBytes circuit_precommitment_{};
122 bppp::PointBytes nonce_point_{};
123 std::array<unsigned char, 64> nonce_host_{};
124 Bytes topic_;
125 bppp::accumulation::Digest proof_digest_{};
126 bppp::accumulation::Digest binding_digest_{};
127 CertificateNonceLeafParentConstants parent_constants_;
128 bppp::accumulation::AlgebraicPreparedNorm norm_;
129
131};
132
141public:
142 static constexpr std::size_t kNormVectorLength = 4096;
143
145 const CertificateNonceLeafAccumulator&) = delete;
147 const CertificateNonceLeafAccumulator&) = delete;
149 CertificateNonceLeafAccumulator&&) noexcept = default;
151 CertificateNonceLeafAccumulator&&) noexcept = default;
152
153 [[nodiscard]] static Result<CertificateNonceLeafAccumulator> create(
154 purify_secp_context* secp_context);
155
156 [[nodiscard]] const bppp::accumulation::Basis& basis() const noexcept {
157 return basis_;
158 }
159
168 const PublicKey& public_key,
169 const TopicProofCache& cache,
170 const NonceProof& proof,
171 const bppp::ScalarBytes& circuit_precommitment,
172 purify_secp_context* secp_context) const;
173
184 const PublicKey& public_key,
185 const TopicProofCache& cache,
186 const bppp::ScalarBytes& circuit_precommitment,
187 const bppp::PointBytes& nonce_point,
188 purify_secp_context* secp_context) const;
189
191 const PublicKey& public_key,
192 const TopicProofCache& cache,
193 const NonceProof& proof,
194 purify_secp_context* secp_context,
195 bppp::ExperimentalCircuitBackend* circuit_cache = nullptr) const;
196
197private:
200 : basis_(std::move(basis)) {}
201
203};
204
205} // namespace purify::puresign_plusplus
Common interface for reusable experimental BPPP backend state.
Definition bppp.hpp:129
Result< CertificateNonceLeafParentConstants > derive_parent_constants_from_public_data(const PublicKey &public_key, const TopicProofCache &cache, const bppp::ScalarBytes &circuit_precommitment, const bppp::PointBytes &nonce_point, purify_secp_context *secp_context) const
Definition bppp.cpp:1149
Result< CertificateNonceLeafParentConstants > derive_parent_constants(const PublicKey &public_key, const TopicProofCache &cache, const NonceProof &proof, const bppp::ScalarBytes &circuit_precommitment, purify_secp_context *secp_context) const
Definition bppp.cpp:1129
static Result< CertificateNonceLeafAccumulator > create(purify_secp_context *secp_context)
Definition bppp.cpp:1115
Result< PreparedCertificateNonceLeaf > prepare(const PublicKey &public_key, const TopicProofCache &cache, const NonceProof &proof, purify_secp_context *secp_context, bppp::ExperimentalCircuitBackend *circuit_cache=nullptr) const
Definition bppp.cpp:1193
CertificateNonceLeafAccumulator(CertificateNonceLeafAccumulator &&) noexcept=default
CertificateNonceLeafAccumulator & operator=(const CertificateNonceLeafAccumulator &)=delete
CertificateNonceLeafAccumulator(const CertificateNonceLeafAccumulator &)=delete
const bppp::accumulation::Digest & binding_digest() const noexcept
const CertificateNonceLeafParentConstants & parent_constants() const noexcept
const bppp::accumulation::AlgebraicPreparedNorm & norm() const noexcept
CertificateNoncePublicLeafDescriptor public_descriptor() const noexcept
PreparedCertificateNonceLeaf(PreparedCertificateNonceLeaf &&) noexcept=default
const bppp::accumulation::Digest & proof_digest() const noexcept
PreparedCertificateNonceLeaf & operator=(const PreparedCertificateNonceLeaf &)=delete
const std::array< unsigned char, 64 > & nonce_host() const noexcept
PreparedCertificateNonceLeaf(const PreparedCertificateNonceLeaf &)=delete
std::array< unsigned char, 32 > Digest
std::array< unsigned char, 33 > PointBytes
Compressed 33-byte curve-point encoding.
Definition bppp.hpp:32
std::array< unsigned char, 32 > ScalarBytes
Big-endian 32-byte scalar encoding.
Definition bppp.hpp:30
Expected< T, Error > Result
Expected-returning convenience alias for Purify value-producing APIs.
Definition error.hpp:99
std::vector< unsigned char > Bytes
Dynamically sized byte string used for messages, serialized witnesses, and proofs.
Definition common.hpp:99
Experimental BPPP-backed PureSign proof(R) helpers.
friend bool operator==(const CertificateNonceLeafParentConstants &, const CertificateNonceLeafParentConstants &)=default
friend bool operator==(const CertificateNoncePublicLeafDescriptor &, const CertificateNoncePublicLeafDescriptor &)=default
Cacheable topic-bound nonce-proof template for the BPPP-backed PureSign++ proof(R) flow.
Definition bppp.hpp:278