6 #ifndef IROHA_UNSIGNED_PROTO_HPP 7 #define IROHA_UNSIGNED_PROTO_HPP 38 : object_(
std::move(w.object_)),
39 object_finalized_(w.object_finalized_) {
40 w.object_finalized_ =
true;
44 object_ = std::move(w.object_);
45 object_finalized_ = w.object_finalized_;
46 w.object_finalized_ =
true;
62 if (object_finalized_) {
63 throw std::runtime_error(
"object has already been finalized");
66 object_.addSignature(SignedHexStringView{signature_hex},
67 PublicKeyHexStringView{keypair.
publicKey()});
77 if (boost::size(object_.signatures()) == 0) {
78 throw std::invalid_argument(
"Cannot get object without signatures");
80 if (object_finalized_) {
81 throw std::runtime_error(
"object has already been finalized");
84 object_finalized_ =
true;
85 return std::move(object_);
89 return object_.hash();
92 template <
typename U = T>
94 std::is_base_of<shared_model::interface::Transaction, U>::value,
97 return object_.reducedHash();
102 bool object_finalized_{
false};
107 #endif // IROHA_UNSIGNED_PROTO_HPP std::string const & publicKey() const
Definition: keypair.cpp:15
std::enable_if_t< std::is_base_of< shared_model::interface::Transaction, U >::value, interface::types::HashType > reducedHash() const
Definition: unsigned_proto.hpp:96
UnsignedWrapper(T &&o)
Definition: unsigned_proto.hpp:35
T ModelType
Definition: unsigned_proto.hpp:27
Definition: keypair.hpp:19
static std::string sign(const Blob &blob, const Keypair &keypair)
Definition: crypto_signer.cpp:29
UnsignedWrapper< T > & operator=(UnsignedWrapper< T > &&w)
Definition: unsigned_proto.hpp:43
Definition: byte_range.hpp:14
UnsignedWrapper(const T &o)
Definition: unsigned_proto.hpp:33
Definition: unsigned_proto.hpp:25
UnsignedWrapper(UnsignedWrapper< T > &&w)
Definition: unsigned_proto.hpp:37
interface::types::HashType hash()
Definition: unsigned_proto.hpp:88
Definition: command_executor.hpp:12
T finish()
Definition: unsigned_proto.hpp:76
UnsignedWrapper & signAndAddSignature(const crypto::Keypair &keypair)
Definition: unsigned_proto.hpp:59