56 const Bytes& encoded);
62 void clear() noexcept;
68 const RecoveryBoundSigningRoster&,
const UInt512&,
86 const std::array<
unsigned char, 32>&
xonly,
89 [[nodiscard]] const std::array<
unsigned char, 32>&
xonly() const noexcept {
98 const std::array<unsigned char, 32>&
xonly) : xonly_(
xonly) {}
100 std::array<unsigned char, 32> xonly_{};
115 std::array<
unsigned char, 32> secret,
129 : key_(std::move(key)), public_key_(key_.xonly_pubkey) {}
132 AnchorPunishmentPublicKey public_key_;
169 std::span<const unsigned char> encoded,
175 [[nodiscard]]
Status validate_encoding(
182 std::array<unsigned char, 32> public_commitment_dlog_nonce_{};
187 const RecoveryBoundSigningRoster&,
const UInt512&,
190 bppp::ExperimentalCircuitBackend*);
193 const RecoveryBoundSigningRoster&,
const UInt512&,
198 const RecoveryBoundSigningRoster&,
const UInt512&,
208 std::array<unsigned char, 32>{}.size() +
225 const UInt512& advertised_anchor_root,
229 bppp::ExperimentalCircuitBackend* cache =
nullptr);
244 const UInt512& advertised_anchor_root,
249 bppp::ExperimentalCircuitBackend* cache =
nullptr);
254 const UInt512& advertised_anchor_root,
259 bppp::ExperimentalCircuitBackend* cache =
nullptr);
272 const FieldElement& exposed_signing_scalar,
273 const UInt512& advertised_anchor_root,
278 bppp::ExperimentalCircuitBackend* cache =
nullptr);
284 const FieldElement& exposed_signing_scalar,
285 const UInt512& advertised_anchor_root,
290 bppp::ExperimentalCircuitBackend* cache =
nullptr);
High-level Purify key generation, evaluation, witness generation, and circuit helpers.
C++ wrappers for the BPPP functionality used by Purify.
Field element modulo the backend scalar field used by this implementation.
AnchorEscrowAuxiliaryScalar()=delete
friend Result< AnchorEscrowRecord > create_anchor_escrow_deterministic(const RecoveryBoundSigningRoster &, const UInt512 &, const AnchorPunishmentKey &, const AnchorEscrowContextDigest &, const AnchorEscrowAuxiliaryScalar &, purify_secp_context *, bppp::ExperimentalCircuitBackend *)
AnchorEscrowAuxiliaryScalar & operator=(const AnchorEscrowAuxiliaryScalar &)=delete
static Result< AnchorEscrowAuxiliaryScalar > from_bytes(const Bytes &encoded)
~AnchorEscrowAuxiliaryScalar()
AnchorEscrowAuxiliaryScalar(const AnchorEscrowAuxiliaryScalar &)=delete
friend Result< AnchorEscrowRecord > create_anchor_escrow(const RecoveryBoundSigningRoster &, const UInt512 &, const AnchorPunishmentKey &, const AnchorEscrowContextDigest &, purify_secp_context *, bppp::ExperimentalCircuitBackend *)
Result< Bytes > serialize(purify_secp_context *secp_context) const
AnchorEscrowRecord(AnchorEscrowRecord &&) noexcept=default
friend Result< AnchorEscrowRecord > create_anchor_escrow_with_aux_randomness(const RecoveryBoundSigningRoster &, const UInt512 &, const AnchorPunishmentKey &, const AnchorEscrowContextDigest &, const bppp::ScalarBytes &, purify_secp_context *, bppp::ExperimentalCircuitBackend *)
AnchorEscrowRecord(const AnchorEscrowRecord &)=default
const AnchorEscrowCiphertext & ciphertext() const noexcept
static constexpr std::size_t kSerializedSize
friend class ConstructionLeafAccumulator
static constexpr std::size_t kNormProofSize
static constexpr unsigned char kSerializationVersion
friend Result< bool > verify_anchor_escrow(const RecoveryBoundSigningRoster &, const UInt512 &, const AnchorPunishmentPublicKey &, const AnchorEscrowContextDigest &, const AnchorEscrowRecord &, purify_secp_context *, bppp::ExperimentalCircuitBackend *)
AnchorEscrowRecord & operator=(const AnchorEscrowRecord &)=default
static Result< AnchorEscrowRecord > deserialize(std::span< const unsigned char > encoded, purify_secp_context *secp_context)
static constexpr std::size_t kProofPayloadSize
AnchorPunishmentKey & operator=(const AnchorPunishmentKey &)=delete
const AnchorPunishmentPublicKey & public_key() const noexcept
AnchorPunishmentKey(const AnchorPunishmentKey &)=delete
static Result< AnchorPunishmentKey > from_secret(std::array< unsigned char, 32 > secret, purify_secp_context *secp_context)
AnchorPunishmentKey(AnchorPunishmentKey &&) noexcept=default
const Bip340Key & bip340_key() const noexcept
AnchorPunishmentPublicKey(AnchorPunishmentPublicKey &&) noexcept=default
AnchorPunishmentPublicKey & operator=(const AnchorPunishmentPublicKey &)=default
AnchorPunishmentPublicKey(const AnchorPunishmentPublicKey &)=default
const std::array< unsigned char, 32 > & xonly() const noexcept
static Result< AnchorPunishmentPublicKey > create(const std::array< unsigned char, 32 > &xonly, purify_secp_context *secp_context)
friend bool operator==(const AnchorPunishmentPublicKey &, const AnchorPunishmentPublicKey &)=default
friend class AnchorPunishmentKey
A nonce-host-bound roster with an authorized recovery-root relation.
Common interface for reusable experimental BPPP backend state.
Result< AnchorPunishmentKey > recover_distributed_escrowed_anchor(const VerifiedDistributedRecoverySetup &setup, const FieldElement &exposed_signing_scalar, const UInt512 &advertised_anchor_root, const AnchorPunishmentPublicKey &punishment_key, const AnchorEscrowContextDigest &context_digest, const AnchorEscrowRecord &record, purify_secp_context *secp_context, bppp::ExperimentalCircuitBackend *cache=nullptr)
Result< AnchorEscrowRecord > create_anchor_escrow_deterministic(const RecoveryBoundSigningRoster &roster, const UInt512 &advertised_anchor_root, const AnchorPunishmentKey &punishment_key, const AnchorEscrowContextDigest &context_digest, const AnchorEscrowAuxiliaryScalar &auxiliary_scalar, purify_secp_context *secp_context, bppp::ExperimentalCircuitBackend *cache=nullptr)
std::array< unsigned char, 32 > AnchorEscrowContextDigest
Result< AnchorEscrowRecord > create_anchor_escrow(const RecoveryBoundSigningRoster &roster, const UInt512 &advertised_anchor_root, const AnchorPunishmentKey &punishment_key, const AnchorEscrowContextDigest &context_digest, purify_secp_context *secp_context, bppp::ExperimentalCircuitBackend *cache=nullptr)
Result< AnchorPunishmentKey > recover_escrowed_anchor(const RecoveryBoundSigningRoster &roster, const FieldElement &exposed_signing_scalar, const UInt512 &advertised_anchor_root, const AnchorPunishmentPublicKey &punishment_key, const AnchorEscrowContextDigest &context_digest, const AnchorEscrowRecord &record, purify_secp_context *secp_context, bppp::ExperimentalCircuitBackend *cache=nullptr)
Result< bool > verify_anchor_escrow(const RecoveryBoundSigningRoster &roster, const UInt512 &advertised_anchor_root, const AnchorPunishmentPublicKey &punishment_key, const AnchorEscrowContextDigest &context_digest, const AnchorEscrowRecord &record, purify_secp_context *secp_context, bppp::ExperimentalCircuitBackend *cache=nullptr)
std::array< unsigned char, 33 > PointBytes
Compressed 33-byte curve-point encoding.
std::array< unsigned char, 32 > ScalarBytes
Big-endian 32-byte scalar encoding.
BigUInt< 8 > UInt512
512-bit unsigned integer used for private and packed public keys.
Expected< T, Error > Result
Expected-returning convenience alias for Purify value-producing APIs.
Expected< void, Error > Status
Expected-returning convenience alias for Purify status-only APIs.
std::vector< unsigned char > Bytes
Dynamically sized byte string used for messages, serialized witnesses, and proofs.
struct purify_secp_context purify_secp_context
Caller-owned reusable secp256k1 context handle shared across Purify C and C++ APIs.
Canonical BIP340 keypair derived deterministically from a packed Purify secret.
FieldElement masked_scalar
static constexpr std::size_t kSerializedSize