Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. 2018 All Rights Reserved.
3 : * http://soramitsu.co.jp
4 : *
5 : * Licensed under the Apache License, Version 2.0 (the "License");
6 : * you may not use this file except in compliance with the License.
7 : * You may obtain a copy of the License at
8 : *
9 : * http://www.apache.org/licenses/LICENSE-2.0
10 : *
11 : * Unless required by applicable law or agreed to in writing, software
12 : * distributed under the License is distributed on an "AS IS" BASIS,
13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : * See the License for the specific language governing permissions and
15 : * limitations under the License.
16 : */
17 :
18 : #include "cryptography/keypair.hpp"
19 :
20 : #include "utils/string_builder.hpp"
21 :
22 : namespace shared_model {
23 : namespace crypto {
24 :
25 : const Keypair::PublicKeyType &Keypair::publicKey() const {
26 11856 : return public_key_;
27 : }
28 :
29 : const Keypair::PrivateKeyType &Keypair::privateKey() const {
30 5930 : return private_key_;
31 : }
32 :
33 : bool Keypair::operator==(const Keypair &keypair) const {
34 0 : return publicKey() == keypair.publicKey()
35 0 : and privateKey() == keypair.privateKey();
36 : }
37 :
38 : std::string Keypair::toString() const {
39 6 : return detail::PrettyStringBuilder()
40 6 : .init("Keypair")
41 6 : .append("publicKey", publicKey().toString())
42 6 : .append("privateKey", privateKey().toString())
43 6 : .finalize();
44 0 : }
45 :
46 : Keypair *Keypair::clone() const {
47 0 : return new Keypair(publicKey(), privateKey());
48 0 : }
49 :
50 : Keypair::Keypair(const Keypair::PublicKeyType &public_key,
51 : const Keypair::PrivateKeyType &private_key)
52 3506 : : public_key_(public_key), private_key_(private_key) {}
53 :
54 : } // namespace crypto
55 : } // namespace shared_model
|