1#include <xrpld/conditions/Condition.h>
2#include <xrpld/conditions/Fulfillment.h>
3#include <xrpld/conditions/detail/PreimageSha256.h>
4#include <xrpld/conditions/detail/utils.h>
6#include <xrpl/basics/safe_cast.h>
9namespace cryptoconditions {
58 auto const p = parsePreamble(s, ec);
63 if (!isConstructed(p) || !isContextSpecific(p))
69 if (p.length > s.
size())
75 if (p.length < s.
size())
89 using TagType =
decltype(p.tag);
An immutable linear range of bytes.
bool empty() const noexcept
Return true if the byte range is empty.
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
std::size_t size() const noexcept
Returns the number of bytes in the storage.
std::size_t length() const noexcept
static std::unique_ptr< Fulfillment > deserialize(Slice s, std::error_code &ec)
Parse the payload for a PreimageSha256 condition.
bool validate(Fulfillment const &f, Condition const &c, Slice m)
Verify if the given message satisfies the fulfillment.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static std::unique_ptr< Fulfillment > deserialize(Slice s, std::error_code &ec)
Load a fulfillment from its binary form.
virtual Type type() const =0
Returns the type of this condition.
virtual bool validate(Slice data) const =0
Validates a fulfillment.
static constexpr std::size_t maxSerializedFulfillment
The largest binary fulfillment we support.
virtual Condition condition() const =0
Returns the condition associated with the given fulfillment.