diff --git a/include/ircd/json/tuple/tuple.h b/include/ircd/json/tuple/tuple.h index ed08a8ea9..efbfe66fd 100644 --- a/include/ircd/json/tuple/tuple.h +++ b/include/ircd/json/tuple/tuple.h @@ -1216,77 +1216,6 @@ const }; } -template -enable_if_tuple -sign(const tuple &t, - const ed25519::sk &sk) -{ - //TODO: XXX - const auto preimage - { - json::strung(t) - }; - - return ed25519::sig - { - [&sk, &preimage](auto &buf) - { - sk.sign(buf, const_buffer{preimage}); - } - }; -} - -template -enable_if_tuple -verify(const tuple &t, - const ed25519::pk &pk, - const ed25519::sig &sig, - std::nothrow_t) -noexcept try -{ - //TODO: XXX - const auto preimage - { - json::strung(t) - }; - - return pk.verify(const_buffer{preimage}, sig); -} -catch(const std::exception &e) -{ - log::error("Verification of json::tuple unexpected failure: %s", e.what()); - return false; -} - -template -enable_if_tuple -verify(const tuple &t, - const ed25519::pk &pk, - const ed25519::sig &sig) -{ - if(!verify(t, pk, sig, std::nothrow)) - throw ed25519::bad_sig{"Verification failed"}; -} - -template -enable_if_tuple -verify(const tuple &t, - const ed25519::pk &pk) -{ - const ed25519::sig sig - { - [&t](auto &buf) - { - b64decode(buf, at<"signatures"_>(t)); - } - }; - - auto copy(t); - at<"signatures"_>(copy) = string_view{}; - if(!verify(copy, pk, sig, std::nothrow)) - throw ed25519::bad_sig{"Verification failed"}; -} - template tuple::operator json::value()