20 #include <ripple/basics/safe_cast.h>
21 #include <ripple/conditions/Condition.h>
22 #include <ripple/conditions/Fulfillment.h>
23 #include <ripple/conditions/impl/PreimageSha256.h>
24 #include <ripple/conditions/impl/utils.h>
29 namespace cryptoconditions {
78 auto const p = parsePreamble(s, ec);
83 if (!isConstructed(p) || !isContextSpecific(p))
89 if (p.length > s.
size())
95 if (p.length < s.
size())
109 using TagType = decltype(p.tag);
std::size_t size() const noexcept
Returns the number of bytes in the storage.
static std::unique_ptr< Fulfillment > deserialize(Slice s, std::error_code &ec)
Load a fulfillment from its binary form.
static constexpr std::size_t maxSerializedFulfillment
The largest binary fulfillment we support.
An immutable linear range of bytes.
virtual Type type() const =0
Returns the type of this condition.
virtual bool validate(Slice data) const =0
Validates a fulfillment.
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
std::size_t length() const noexcept
bool empty() const noexcept
Return true if the byte range is empty.
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.
virtual Condition condition() const =0
Returns the condition associated with the given fulfillment.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool match(Fulfillment const &f, Condition const &c)
Determine whether the given fulfillment and condition match.