LCOV - code coverage report
Current view: top level - shared_model/backend/protobuf/common_objects - signature.hpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 6 6 100.0 %
Date: 2019-03-07 14:46:43 Functions: 17 17 100.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #ifndef IROHA_PROTO_SIGNATURE_HPP
       7             : #define IROHA_PROTO_SIGNATURE_HPP
       8             : 
       9             : #include "backend/protobuf/common_objects/trivial_proto.hpp"
      10             : #include "cryptography/public_key.hpp"
      11             : #include "cryptography/signed.hpp"
      12             : #include "interfaces/common_objects/signature.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       27264 :           : 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       95390 :         return public_key_;
      31             :       }
      32             : 
      33             :       const SignedType &signedData() const override {
      34       39292 :         return signed_;
      35             :       }
      36             : 
      37             :      private:
      38       26927 :       const PublicKeyType public_key_{
      39       27017 :           PublicKeyType::fromHexString(proto_->public_key())};
      40             : 
      41       27264 :       const SignedType signed_{SignedType::fromHexString(proto_->signature())};
      42             :     };
      43             :   }  // namespace proto
      44             : }  // namespace shared_model
      45             : 
      46             : #endif  // IROHA_PROTO_SIGNATURE_HPP

Generated by: LCOV version 1.13