23 volatile unsigned char* out =
reinterpret_cast<volatile unsigned char*
>(data);
52 return std::allocator<T>{}.allocate(count);
56 if (data ==
nullptr) {
60 std::allocator<T>{}.deallocate(data, count);
69template <
typename T,
typename U>
76 if (value ==
nullptr) {
79 static_assert(std::is_trivially_destructible_v<UInt512>);
146 return packed() == other.packed();
150 explicit SecretKey(std::unique_ptr<UInt512, detail::SecureUInt512Deleter>&&
packed) noexcept
151 : packed_(std::move(
packed)) {}
153 std::unique_ptr<UInt512, detail::SecureUInt512Deleter> packed_;
SecretKey(const SecretKey &)=delete
static Result< SecretKey > from_hex(std::string_view hex)
Parses and validates a packed Purify secret from hexadecimal text.
SecretKey & operator=(const SecretKey &)=delete
const UInt512 & packed() const noexcept
Exposes the packed secret for lower-level cryptographic operations.
SecretKey(SecretKey &&) noexcept=default
static Result< SecretKey > from_packed(const UInt512 &packed)
Constructs a validated secret key from packed Purify secret bytes.
Result< SecretKey > clone() const
Creates a second owned copy of this secret key.
bool operator==(const SecretKey &other) const noexcept
Compares two owned secrets by their packed values.
Allocator that clears an allocation immediately before releasing it.
T * allocate(std::size_t count)
std::true_type is_always_equal
void deallocate(T *data, std::size_t count) noexcept
std::true_type propagate_on_container_move_assignment
SecureAllocator() noexcept=default
Elliptic-curve helpers, fixed parameters, and hash-to-curve utilities for Purify.
#define PURIFY_RETURN_IF_ERROR(expr, context)
Evaluates an expected-like expression and returns the wrapped error on failure.
#define PURIFY_ASSIGN_OR_RETURN(lhs, expr, context)
Evaluates an expected-like expression, binds the value to lhs, and propagates errors.
void secure_clear_bytes(void *data, std::size_t size) noexcept
bool operator==(const SecureAllocator< T > &, const SecureAllocator< U > &) noexcept
Status validate_secret_key(const UInt512 &z)
Validates the packed secret-key encoding range.
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.
static Result< BigUInt > try_from_hex(std::string_view hex)
SecureAllocator< U > other
void operator()(UInt512 *value) const noexcept