23 volatile unsigned char* out =
reinterpret_cast<volatile unsigned char*
>(data);
33 if (value ==
nullptr) {
36 static_assert(std::is_trivially_destructible_v<UInt512>);
103 return packed() == other.packed();
107 explicit SecretKey(std::unique_ptr<UInt512, detail::SecureUInt512Deleter>&&
packed) noexcept
108 : packed_(std::move(
packed)) {}
110 std::unique_ptr<UInt512, detail::SecureUInt512Deleter> packed_;
Purify result carrier that either holds a value or an error.
Move-only packed Purify secret stored in dedicated heap memory.
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.
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
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.
static Result< BigUInt > try_from_hex(std::string_view hex)
Parses a hexadecimal string, ignoring optional 0x and whitespace.
void operator()(UInt512 *value) const noexcept