From e60370de752661e6125e72dbc3001c6fef0ecdaf Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 23 Mar 2018 00:42:24 -0700 Subject: [PATCH] ircd::json: Remove redundant. --- include/ircd/json/tuple/tuple.h | 71 --------------------------------- 1 file changed, 71 deletions(-) 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()