hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
signature.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_PROTO_SIGNATURE_HPP
7 #define IROHA_PROTO_SIGNATURE_HPP
8 
11 #include "cryptography/signed.hpp"
13 #include "primitive.pb.h"
14 
15 namespace shared_model {
16  namespace proto {
17  class Signature final : public CopyableProto<interface::Signature,
18  iroha::protocol::Signature,
19  Signature> {
20  public:
21  template <typename SignatureType>
22  explicit Signature(SignatureType &&signature)
23  : CopyableProto(std::forward<SignatureType>(signature)) {}
24 
25  Signature(const Signature &o) : Signature(o.proto_) {}
26 
27  Signature(Signature &&o) noexcept : Signature(std::move(o.proto_)) {}
28 
29  const PublicKeyType &publicKey() const override {
30  return public_key_;
31  }
32 
33  const SignedType &signedData() const override {
34  return signed_;
35  }
36 
37  private:
38  const PublicKeyType public_key_{
39  PublicKeyType::fromHexString(proto_->public_key())};
40 
41  const SignedType signed_{SignedType::fromHexString(proto_->signature())};
42  };
43  } // namespace proto
44 } // namespace shared_model
45 
46 #endif // IROHA_PROTO_SIGNATURE_HPP
detail::ReferenceHolder< iroha::protocol::Signature > proto_
Definition: trivial_proto.hpp:65
const PublicKeyType & publicKey() const override
Definition: signature.hpp:29
Definition: peer.hpp:48
const SignedType & signedData() const override
Definition: signature.hpp:33
Signature(const Signature &o)
Definition: signature.hpp:25
Signature(Signature &&o) noexcept
Definition: signature.hpp:27
Signature(SignatureType &&signature)
Definition: signature.hpp:22
Definition: signed.hpp:17
Definition: signature.hpp:17
crypto::PublicKey PublicKeyType
Definition: signature.hpp:29
static Blob fromHexString(const std::string &hex)
Definition: blob.cpp:34
Definition: command_executor.hpp:12
Definition: trivial_proto.hpp:45